Updated workflow
This commit is contained in:
+104
-32
@@ -1,41 +1,113 @@
|
||||
name: CMake
|
||||
# name: CMake
|
||||
#
|
||||
# on:
|
||||
# push:
|
||||
# branches: [ "master" ]
|
||||
# pull_request:
|
||||
# branches: [ "master" ]
|
||||
#
|
||||
# env:
|
||||
# # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
# BUILD_TYPE: Release
|
||||
#
|
||||
# jobs:
|
||||
# build:
|
||||
# # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
|
||||
# # You can convert this to a matrix build if you need cross-platform coverage.
|
||||
# # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
# runs-on: ubuntu-latest
|
||||
#
|
||||
# steps:
|
||||
# - uses: actions/checkout@v3
|
||||
#
|
||||
# - name: run-vcpkg
|
||||
# uses: lukka/run-vcpkg@v11.1
|
||||
#
|
||||
#
|
||||
# - name: Configure CMake
|
||||
# # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
|
||||
# # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
|
||||
# run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
#
|
||||
# - name: Build
|
||||
# # Build your program with the given configuration
|
||||
# run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
#
|
||||
# - name: Test
|
||||
# working-directory: ${{github.workspace}}/build
|
||||
# # Execute tests defined by the CMake configuration.
|
||||
# # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
|
||||
# run: ctest -C ${{env.BUILD_TYPE}}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Release
|
||||
|
||||
# Copyright (c) 2019-2020-2021-2022-2023 Luca Cappa
|
||||
# Released under the term specified in file LICENSE.txt
|
||||
# SPDX short identifier: MIT
|
||||
#
|
||||
# The peculiarity of this workflow is that assumes vcpkg stored as a submodule of this
|
||||
# repository.
|
||||
# The workflow does the following:
|
||||
# - Sets up vcpkg if needed, then run CMake with CMakePreset.json using a configuration
|
||||
# that leverages the vcpkg's toolchain file.
|
||||
# This will automatically run vcpkg to install dependencies described by the vcpkg.json
|
||||
# manifest file.
|
||||
# vcpkg's Binary Caching backed by GH Action cache is being used. It will be a no-op if
|
||||
# the dependencies are restored from GH Action cache.
|
||||
# - Finally builds the sources with Ninja.
|
||||
name: hosted-ninja_multi-vcpkg_submod-triplet-cacheoff
|
||||
on: [push, workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
|
||||
# You can convert this to a matrix build if you need cross-platform coverage.
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
runs-on: ubuntu-latest
|
||||
job:
|
||||
name: ${{ matrix.os }}-${{ github.workflow }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
include:
|
||||
- os: windows-latest
|
||||
triplet: x64-windows
|
||||
- os: ubuntu-latest
|
||||
triplet: x64-linux
|
||||
- os: macos-latest
|
||||
triplet: x64-osx
|
||||
|
||||
env:
|
||||
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: run-vcpkg
|
||||
uses: lukka/run-vcpkg@v11.1
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- uses: lukka/get-cmake@latest
|
||||
- name: dir
|
||||
run: find $RUNNER_WORKSPACE
|
||||
shell: bash
|
||||
|
||||
- name: Configure CMake
|
||||
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
|
||||
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
|
||||
- name: Build
|
||||
# Build your program with the given configuration
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
|
||||
- name: Test
|
||||
working-directory: ${{github.workspace}}/build
|
||||
# Execute tests defined by the CMake configuration.
|
||||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
|
||||
run: ctest -C ${{env.BUILD_TYPE}}
|
||||
- name: Setup vcpkg
|
||||
uses: lukka/run-vcpkg@main
|
||||
id: runvcpkg
|
||||
with:
|
||||
# This one is not needed, as it is the default value anyway.
|
||||
# vcpkgDirectory: '${{ github.workspace }}/vcpkg'
|
||||
vcpkgJsonGlob: '**/cmakepresets/vcpkg.json'
|
||||
|
||||
- name: List $RUNNER_WORKSPACE before build
|
||||
run: find $RUNNER_WORKSPACE
|
||||
shell: bash
|
||||
- name: Prints output of run-vcpkg's action.
|
||||
run: echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' "
|
||||
- name: Run CMake+vcpkg+NinjaMulti-Config (Release configuration)
|
||||
uses: lukka/run-cmake@v10
|
||||
id: runcmake
|
||||
with:
|
||||
cmakeListsTxtPath: '${{ github.workspace }}/cmakepresets/CMakeLists.txt'
|
||||
configurePreset: 'ninja-multi-vcpkg'
|
||||
buildPreset: 'ninja-multi-vcpkg'
|
||||
buildPresetAdditionalArgs: '[`--config Release`]'
|
||||
- name: List $RUNNER_WORKSPACE after build
|
||||
run: find $RUNNER_WORKSPACE
|
||||
shell: bash
|
||||
|
||||
Reference in New Issue
Block a user