generated from cpp-best-practices/gui_starter_template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Florian Weik
committed
Sep 21, 2023
1 parent
0e48120
commit 44e8295
Showing
1 changed file
with
43 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,55 @@ | ||
name: continuous-integration | ||
name: Linux | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [opened, synchronize] | ||
on: [push] | ||
|
||
env: | ||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | ||
BUILD_TYPE: RelWithDebInfo | ||
|
||
jobs: | ||
test-docs-build: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build Doxygen Docs | ||
uses: mattnotmitt/[email protected] | ||
build: | ||
|
||
continuous-integration: | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
BUILD_TYPE: Debug | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [macos-10.15, ubuntu-20.04] | ||
cxx: [g++-10, clang++] | ||
include: | ||
- os: windows-2019 | ||
cxx: msvc | ||
- os: windows-2019 | ||
cxx: msvc | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Cache CMake dependency source code | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-cmake-dependency-sources | ||
with: | ||
# CMake cache is at ${{github.workspace}}/build/_deps but we only will cache folders ending in '-src' to cache source code | ||
path: ${{github.workspace}}/build/_deps/*-src | ||
# Cache hash is dependent on CMakeLists files anywhere as these can change what's in the cache, as well as cmake modules files | ||
key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} | ||
# it's acceptable to reuse caches for different CMakeLists content if exact match is not available and unlike build caches, we | ||
# don't need to restrict these by OS or compiler as it's only source code that's being cached | ||
restore-keys: | | ||
${{ env.cache-name }}- | ||
- name: Cache CMake dependency build objects | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-cmake-dependency-builds | ||
with: | ||
# CMake cache is at ${{github.workspace}}/build/_deps but we only care about the folders ending in -build or -subbuild | ||
path: | | ||
${{github.workspace}}/build/_deps/*-build | ||
${{github.workspace}}/build/_deps/*-subbuild | ||
# Cache hash is dependent on CMakeLists files anywhere as these can change what's in the cache, as well as cmake modules files | ||
key: ${{ env.cache-name }}-${{ matrix.os }}-${{ matrix.cxx }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} | ||
# it's acceptable to reuse caches for different CMakeLists content if exact match is not available | ||
# as long as the OS and Compiler match exactly | ||
restore-keys: | | ||
${{ env.cache-name }}-${{ matrix.os }}-${{ matrix.cxx }}- | ||
# when building on master branch and not a pull request, build and test in release mode (optimised build) | ||
- name: Set Build Mode to Release | ||
shell: bash | ||
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }} | ||
run: echo "BUILD_TYPE=Release" >> $GITHUB_ENV | ||
|
||
- name: Configure CMake | ||
env: | ||
CXX: ${{ matrix.cxx }} | ||
# Use a bash shell so we can use the same syntax for environment variable | ||
# access regardless of the host operating system | ||
shell: bash | ||
working-directory: ${{github.workspace}}/build | ||
# Note the current convention is to use the -S and -B options here to specify source | ||
# and build directories, but this is only available with CMake 3.13 and higher. | ||
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12 | ||
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX:PATH=$GITHUB_WORKSPACE/test_install -DENABLE_TESTS=ON | ||
|
||
- name: Build | ||
working-directory: ${{github.workspace}}/build | ||
shell: bash | ||
# Execute the build. You can specify a specific target with "--target <NAME>" | ||
run: cmake --build . --config $BUILD_TYPE | ||
|
||
- name: Test | ||
working-directory: ${{github.workspace}}/build | ||
shell: bash | ||
# Execute tests defined by the CMake configuration. | ||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | ||
run: ctest -C $BUILD_TYPE --no-tests=error | ||
|
||
- name: Test Install | ||
working-directory: ${{github.workspace}}/build | ||
shell: bash | ||
# Test install with CMake to the "test_install" directory | ||
run: cmake --install . --config $BUILD_TYPE | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Create Build Environment | ||
# Some projects don't allow in-source building, so create a separate build directory | ||
# We'll use this as our working directory for all subsequent commands | ||
run: cmake -E make_directory ${{runner.workspace}}/build | ||
|
||
- name: Configure CMake | ||
# Use a bash shell so we can use the same syntax for environment variable | ||
# access regardless of the host operating system | ||
shell: bash | ||
working-directory: ${{runner.workspace}}/build | ||
env: | ||
CXX: g++-10 | ||
# Note the current convention is to use the -S and -B options here to specify source | ||
# and build directories, but this is only available with CMake 3.13 and higher. | ||
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12 | ||
# | ||
# We need to source the profile file to make sure conan is in PATH | ||
run: | | ||
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE | ||
- name: Build | ||
working-directory: ${{runner.workspace}}/build | ||
shell: bash | ||
# Execute the build. You can specify a specific target with "--target <NAME>" | ||
run: cmake --build . --config $BUILD_TYPE | ||
|
||
- name: Test | ||
working-directory: ${{runner.workspace}}/build | ||
shell: bash | ||
# Execute tests defined by the CMake configuration. | ||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | ||
run: ctest -C $BUILD_TYPE |