From d49932fb704fbe0f66748a21694f5574aecb1bbd Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Sat, 16 Jul 2022 23:01:48 +0100 Subject: [PATCH 01/19] [gha] Add GitHub Action for building with CMake As per template. --- .github/workflows/cmake.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/cmake.yml diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 0000000..e6073dc --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,37 @@ +name: CMake + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +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: 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}} + From ba50cd0b0954650c0c709e9a08fc88d0add5f299 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Sun, 17 Jul 2022 01:20:07 +0100 Subject: [PATCH 02/19] [gha] Run workflow on any PR --- .github/workflows/cmake.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index e6073dc..82f0aab 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -1,9 +1,8 @@ name: CMake on: - push: - branches: [ "main" ] pull_request: + push: branches: [ "main" ] env: From 8f3fe58bcd5762ae8130b2120de3831270adc4d0 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Sat, 16 Jul 2022 23:38:48 +0100 Subject: [PATCH 03/19] [gha] Use Debug build type --- .github/workflows/cmake.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 82f0aab..b662351 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -6,8 +6,7 @@ on: branches: [ "main" ] env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release + BUILD_TYPE: Debug jobs: build: From 53b4dd86feda608204232e307ac7068edf3e2925 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Sat, 16 Jul 2022 23:39:21 +0100 Subject: [PATCH 04/19] [gha] Rename workflow --- .github/workflows/{cmake.yml => test.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{cmake.yml => test.yml} (99%) diff --git a/.github/workflows/cmake.yml b/.github/workflows/test.yml similarity index 99% rename from .github/workflows/cmake.yml rename to .github/workflows/test.yml index b662351..0910041 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: CMake +name: Test on: pull_request: From 76f0e2b416d8048d2db393a1568a5d68dd9bda80 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Sun, 17 Jul 2022 00:17:53 +0100 Subject: [PATCH 05/19] [cmake] Use FetchContent to get Catch2 for tests --- CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f357b9..581be05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,16 @@ project(scope_guard) include(CheckCXXSymbolExists) include(CheckCXXCompilerFlag) include(GNUInstallDirs) -find_package(Catch2 REQUIRED) + +Include(FetchContent) + +FetchContent_Declare( + Catch2 + GIT_REPOSITORY https://github.com/catchorg/Catch2.git + GIT_TAG v2.13.6 +) + +FetchContent_MakeAvailable(Catch2) # global configurations set(CMAKE_CXX_STANDARD_REQUIRED ON) From 10703c2ee1f6a8af2b339927658758bc67253974 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Sun, 17 Jul 2022 01:16:51 +0100 Subject: [PATCH 06/19] [gha] Add dev errors to cmake config --- .github/workflows/test.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0910041..39fe8f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,7 @@ on: env: BUILD_TYPE: Debug + # TODO NPROC jobs: build: @@ -19,12 +20,9 @@ jobs: - uses: actions/checkout@v3 - 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}} + run: cmake -Wdev -Werror=dev -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 From 0d8834a5c997035d378c12bc4f94e62d16d5f9be Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Sun, 17 Jul 2022 01:14:07 +0100 Subject: [PATCH 07/19] [gha] Adapt command to run tests --- .github/workflows/test.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 39fe8f4..7f8b7c9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,7 +27,6 @@ jobs: - 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}} + run: make test # TODO ARGS=-j... + # TODO drop MAKEFLAGS? From 9e0bd7f594546056340f2b4f8175ee4230275a00 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Mon, 18 Jul 2022 00:51:14 +0100 Subject: [PATCH 08/19] [gha] Run on mac too --- .github/workflows/test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7f8b7c9..f5ed643 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,11 +11,11 @@ env: 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 + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -27,6 +27,6 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build - run: make test # TODO ARGS=-j... + run: cmake --build . --config ${{env.BUILD_TYPE}} --target test # TODO ARGS=-j... # TODO drop MAKEFLAGS? From 94ca25f8e6ec6c6402ae39439ba25d1eb4ee2f83 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Mon, 18 Jul 2022 02:00:24 +0100 Subject: [PATCH 09/19] [gha] Build with different compilers --- .github/workflows/test.yml | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f5ed643..8389708 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,14 +13,37 @@ jobs: build: strategy: matrix: - os: [ubuntu-latest, macos-latest] + include: + - os: ubuntu-latest + compiler: g++-9 + - os: ubuntu-latest + compiler: g++-10 + - os: ubuntu-latest + compiler: clang++-10 + - os: ubuntu-latest + compiler: clang++-11 + - os: ubuntu-latest + compiler: clang++-12 + - os: macos-latest + compiler: g++-9 + - os: macos-latest + compiler: g++-10 + - os: macos-latest + compiler: g++-11 + - os: macos-latest # with default compiler (AppleClang) - runs-on: ${{ matrix.os }} + runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v3 + - name: Determine compiler flag + if: ${{matrix.compiler}} + run: | + echo "CXX=${{matrix.compiler}}" >> $GITHUB_ENV + - name: Configure CMake - run: cmake -Wdev -Werror=dev -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + run: | + cmake -Wdev -Werror=dev -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} From 673efea3f6bb26c04c378a7434b2d0507df05799 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Mon, 18 Jul 2022 03:18:11 +0100 Subject: [PATCH 10/19] [gha] Build with all available cores --- .github/workflows/test.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8389708..ae479a4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,6 @@ on: env: BUILD_TYPE: Debug - # TODO NPROC jobs: build: @@ -36,6 +35,16 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Determine number of cpus on Linux + if: startsWith(matrix.os, 'ubuntu') + run: | + echo "num_cpus=$(nproc)" >> $GITHUB_ENV + + - name: Determine number of cpus on macOS + if: startsWith(matrix.os, 'macos') + run: | + echo "num_cpus=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV + - name: Determine compiler flag if: ${{matrix.compiler}} run: | @@ -46,10 +55,11 @@ jobs: cmake -Wdev -Werror=dev -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - name: Build - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel ${{env.num_cpus}} - name: Test working-directory: ${{github.workspace}}/build - run: cmake --build . --config ${{env.BUILD_TYPE}} --target test # TODO ARGS=-j... - # TODO drop MAKEFLAGS? + run: cmake --build . --config ${{env.BUILD_TYPE}} --target test \ + ARGS=-j$((${{env.num_cpus}} * 2)) # don't pass --parallel, which would affect compilation tests, but do run + # twice as many compilation tests as the number of available threads From 5eb76f479056a83beec559c73573c780c1be51ec Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Tue, 19 Jul 2022 01:01:46 +0100 Subject: [PATCH 11/19] [gha] Build from build dir --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ae479a4..3e21d99 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,7 +55,8 @@ jobs: cmake -Wdev -Werror=dev -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - name: Build - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel ${{env.num_cpus}} + working-directory: ${{github.workspace}}/build + run: cmake --build . --config ${{env.BUILD_TYPE}} --parallel ${{env.num_cpus}} - name: Test working-directory: ${{github.workspace}}/build From eb0a1a3e267863a74de6e814b80d6476ae3c9054 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Tue, 19 Jul 2022 01:48:41 +0100 Subject: [PATCH 12/19] [gha] Add coverage build and report --- .github/workflows/test.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3e21d99..8b7f97e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,6 +17,7 @@ jobs: compiler: g++-9 - os: ubuntu-latest compiler: g++-10 + extra_build_flags: -DENABLE_COVERAGE:BOOL=ON # coverage build - os: ubuntu-latest compiler: clang++-10 - os: ubuntu-latest @@ -52,7 +53,8 @@ jobs: - name: Configure CMake run: | - cmake -Wdev -Werror=dev -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + cmake -Wdev -Werror=dev -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ + ${{matrix.extra_build_flags}} - name: Build working-directory: ${{github.workspace}}/build @@ -64,3 +66,15 @@ jobs: ARGS=-j$((${{env.num_cpus}} * 2)) # don't pass --parallel, which would affect compilation tests, but do run # twice as many compilation tests as the number of available threads + - name: Codecov + if: contains(matrix.extra_build_flags, 'coverage') + working-directory: ${{github.workspace}}/build + run: | + echo "Producing coverage reports..." + find . -name catch_tests.cpp.gcno -exec gcov-7 -pb {} + + + echo "Finding relevant report..." + cov_report=$(find . -name "*scope_guard.hpp.gcov" -exec readlink -e {} +) + + echo "The report is ${cov_report}. Uploading to codecov..." + bash <(curl -s https://codecov.io/bash) -f $cov_report From 2c80767061b3ce27e7732dcf9cee4c187f96534c Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Tue, 19 Jul 2022 02:03:34 +0100 Subject: [PATCH 13/19] [gha] Simplify string formats in yaml --- .github/workflows/test.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8b7f97e..27ea236 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,22 +38,18 @@ jobs: - name: Determine number of cpus on Linux if: startsWith(matrix.os, 'ubuntu') - run: | - echo "num_cpus=$(nproc)" >> $GITHUB_ENV + run: echo "num_cpus=$(nproc)" >> $GITHUB_ENV # TODO use set-output instead - name: Determine number of cpus on macOS if: startsWith(matrix.os, 'macos') - run: | - echo "num_cpus=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV + run: echo "num_cpus=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV # TODO use set-output instead - name: Determine compiler flag if: ${{matrix.compiler}} - run: | - echo "CXX=${{matrix.compiler}}" >> $GITHUB_ENV + run: echo "CXX=${{matrix.compiler}}" >> $GITHUB_ENV - name: Configure CMake - run: | - cmake -Wdev -Werror=dev -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ + run: cmake -Wdev -Werror=dev -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{matrix.extra_build_flags}} - name: Build @@ -62,7 +58,7 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build - run: cmake --build . --config ${{env.BUILD_TYPE}} --target test \ + run: cmake --build . --config ${{env.BUILD_TYPE}} --target test ARGS=-j$((${{env.num_cpus}} * 2)) # don't pass --parallel, which would affect compilation tests, but do run # twice as many compilation tests as the number of available threads From 2e2191ecefbae5380427067ebc15c82f9c7c39c3 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Tue, 19 Jul 2022 02:21:49 +0100 Subject: [PATCH 14/19] [gha] Fix coverage command --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 27ea236..4f49870 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -67,7 +67,7 @@ jobs: working-directory: ${{github.workspace}}/build run: | echo "Producing coverage reports..." - find . -name catch_tests.cpp.gcno -exec gcov-7 -pb {} + + find . -name catch_tests.cpp.gcno -exec gcov -pb {} + echo "Finding relevant report..." cov_report=$(find . -name "*scope_guard.hpp.gcov" -exec readlink -e {} +) From ab0e755a9761e3aaa08af90964fa92dd5ca51571 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Tue, 19 Jul 2022 02:28:31 +0100 Subject: [PATCH 15/19] [gha] Identify AppleClang job in GH UI --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4f49870..f520c26 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,7 +30,9 @@ jobs: compiler: g++-10 - os: macos-latest compiler: g++-11 - - os: macos-latest # with default compiler (AppleClang) + - os: macos-latest + comp: AppleClang # unused: this is the default compiler and not obvious to specify explicitly, but we still + # want to see the compiler string in the GH UI, so use a different var altogether runs-on: ${{matrix.os}} steps: From 40d0b3e670413ad50ecf3d2ca93c92998523942c Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Tue, 19 Jul 2022 02:31:44 +0100 Subject: [PATCH 16/19] [gha] Increase checkout depth Make Codecov happy --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f520c26..feb90c1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,6 +37,8 @@ jobs: runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v3 + with: + fetch-depth: 2 # Codecov requests >1 - name: Determine number of cpus on Linux if: startsWith(matrix.os, 'ubuntu') From db6d04956127162728a11b0a4a987590ee2045b7 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Tue, 19 Jul 2022 02:41:54 +0100 Subject: [PATCH 17/19] [gha] Drop unecessary env context in cmds --- .github/workflows/test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index feb90c1..6669231 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,18 +53,18 @@ jobs: run: echo "CXX=${{matrix.compiler}}" >> $GITHUB_ENV - name: Configure CMake - run: cmake -Wdev -Werror=dev -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + run: cmake -Wdev -Werror=dev -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${{matrix.extra_build_flags}} - name: Build working-directory: ${{github.workspace}}/build - run: cmake --build . --config ${{env.BUILD_TYPE}} --parallel ${{env.num_cpus}} + run: cmake --build . --config ${BUILD_TYPE} --parallel ${num_cpus} - name: Test working-directory: ${{github.workspace}}/build - run: cmake --build . --config ${{env.BUILD_TYPE}} --target test - ARGS=-j$((${{env.num_cpus}} * 2)) # don't pass --parallel, which would affect compilation tests, but do run - # twice as many compilation tests as the number of available threads + run: cmake --build . --config ${BUILD_TYPE} --target test + ARGS=-j$((${num_cpus} * 2)) # don't pass --parallel, which would affect compilation tests, but do run + # twice as many compilation tests as the number of available threads - name: Codecov if: contains(matrix.extra_build_flags, 'coverage') From 15fc3db8ae60bd5f17e09aa4d124a5909dec891b Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Tue, 19 Jul 2022 02:42:11 +0100 Subject: [PATCH 18/19] [gha] Wrap at 100 chars (cosmetics) --- .github/workflows/test.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6669231..b80888d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,8 +31,9 @@ jobs: - os: macos-latest compiler: g++-11 - os: macos-latest - comp: AppleClang # unused: this is the default compiler and not obvious to specify explicitly, but we still - # want to see the compiler string in the GH UI, so use a different var altogether + comp: AppleClang # unused: this is the default compiler and not obvious to specify + # explicitly, but we still want to see the compiler string in the + # GH UI, so use a different var altogether runs-on: ${{matrix.os}} steps: @@ -63,8 +64,9 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build run: cmake --build . --config ${BUILD_TYPE} --target test - ARGS=-j$((${num_cpus} * 2)) # don't pass --parallel, which would affect compilation tests, but do run - # twice as many compilation tests as the number of available threads + ARGS=-j$((${num_cpus} * 2)) # don't pass --parallel, which would affect compilation tests, + # but do run twice as many compilation tests as the number of + # available threads - name: Codecov if: contains(matrix.extra_build_flags, 'coverage') From 0673f2daac8d56351bf0688022d5ca2570af3428 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Tue, 19 Jul 2022 02:46:08 +0100 Subject: [PATCH 19/19] [gha] Drop Travis --- .travis.yml | 96 ----------------------------------------------------- 1 file changed, 96 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 55e80cb..0000000 --- a/.travis.yml +++ /dev/null @@ -1,96 +0,0 @@ -language: c++ - -git: - depth: 10 # leave margin for ci skips - -env: - global: - - NPROC=$(nproc) - - MAKEFLAGS="-j${NPROC}" - - CATCH_DIR="~/catch" - - CATCH_REMOTE="https://github.com/catchorg/Catch2.git" - - CATCH_VERSION=v2.13.6 - -matrix: - include: - - os: linux - compiler: gcc-4.9 # old gcc - - os: linux - addons: - apt: - sources: - - llvm-toolchain-xenial-8 - - ubuntu-toolchain-r-test - packages: - - clang-8 - - g++-8 - env: MATRIX_EVAL="CC=clang-8 && CXX=clang++-8" - - os: linux - dist: focal - addons: - apt: - sources: # for some reason, travis doesn't like the src alias on focal - - sourceline: 'ppa:ubuntu-toolchain-r/test' - packages: g++-11 - env: MATRIX_EVAL="CC=gcc-11 && CXX=g++-11" - - os: linux - dist: focal - addons: - apt: - sources: # for some reason, travis doesn't like the src alias on focal - - sourceline: 'ppa:ubuntu-toolchain-r/test' - packages: g++-11 - env: - - MATRIX_EVAL="CC=gcc-11 && CXX=g++-11" - - CMAKE_COV="-DENABLE_COVERAGE:BOOL=ON" # coverage build - - os: osx - osx_image: xcode10.3 - compiler: clang - - os: osx - osx_image: xcode10.3 - compiler: gcc - - os: osx - osx_image: xcode12.5 - compiler: clang - - os: osx - osx_image: xcode12.5 - compiler: gcc - -before_install: - - echo ${NPROC} - - eval "${MATRIX_EVAL}" # determine overriding compiler, if set - -install: - - git clone ${CATCH_REMOTE} ${CATCH_DIR} - - pushd ${CATCH_DIR} - - git checkout -q ${CATCH_VERSION} - - mkdir build - - cd build - - cmake -DBUILD_TESTING:BOOL=FALSE .. - - cmake --build . - - sudo make install - - popd # reset current directory - -script: - - export VERBOSE=1 - - mkdir build - - cd build - - cmake -Wdev -Werror=dev -DCMAKE_BUILD_TYPE=Debug ${CMAKE_COV} .. - - cmake --build . - - unset MAKEFLAGS # drop MAKEFLAGS, (which would affect compilation tests) - - make test ARGS=-j$((${NPROC} * 2)) # but run twice as many compilation tests - # as the number of available `nproc` - -after_success: |- - if [ ! -z "${CMAKE_COV}" ]; then - echo "Producing coverage reports..." - find . -name catch_tests.cpp.gcno -exec gcov-7 -pb {} + - - echo "Finding relevant report..." - cov_report=$(find . -name "*scope_guard.hpp.gcov" -exec readlink -e {} +) - - echo "The report is ${cov_report}. Uploading to codecov..." - bash <(curl -s https://codecov.io/bash) -f $cov_report - fi - -after_failure: cat ./Testing/Temporary/LastTest.log