From 8ac10a56f59996696cbba9cada879cece607dfee Mon Sep 17 00:00:00 2001 From: Tamino Bauknecht Date: Tue, 2 Jul 2024 15:19:44 +0200 Subject: [PATCH 1/9] ci: Use alpine v3.20 besides 3.19 for Python 3.12 To reduce the number of workflows, only run some combinations. --- .github/workflows/cpp-build.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cpp-build.yml b/.github/workflows/cpp-build.yml index 10c9e60..d8abbe1 100644 --- a/.github/workflows/cpp-build.yml +++ b/.github/workflows/cpp-build.yml @@ -29,13 +29,24 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - cpp17_compatibility: [ "ON", "OFF" ] - cpp_compiler: [ "g++", "clang++" ] + include: + - cpp_compiler: "g++" + alpine_version: "v3.20" + cpp17_compatibility: "ON" + - cpp_compiler: "clang++" + alpine_version: "v3.19" + cpp17_compatibility: "OFF" + - cpp_compiler: "g++" + alpine_version: "v3.19" + cpp17_compatibility: "OFF" + - cpp_compiler: "clang++" + alpine_version: "v3.20" + cpp17_compatibility: "ON" steps: - uses: actions/checkout@v3 - uses: jirutka/setup-alpine@v1 with: - branch: v3.19 + branch: ${{ matrix.alpine_version }} - name: Install dependencies run: | apk update From 7969f55c5bc7e5ac76c1bc793f074f40468cd12c Mon Sep 17 00:00:00 2001 From: Tamino Bauknecht Date: Tue, 2 Jul 2024 15:54:18 +0200 Subject: [PATCH 2/9] ci: Cache alpine packages --- .github/workflows/cpp-build.yml | 34 +++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cpp-build.yml b/.github/workflows/cpp-build.yml index d8abbe1..34d9ce6 100644 --- a/.github/workflows/cpp-build.yml +++ b/.github/workflows/cpp-build.yml @@ -42,14 +42,32 @@ jobs: - cpp_compiler: "clang++" alpine_version: "v3.20" cpp17_compatibility: "ON" + env: + apk_package_cache: "/var/cache/apk" steps: - uses: actions/checkout@v3 - uses: jirutka/setup-alpine@v1 with: branch: ${{ matrix.alpine_version }} + - name: Setup apk cache + run: | + mkdir -pv ${{ env.apk_package_cache }} + ln -s ${{ env.apk_package_cache }} /etc/apk/cache + shell: alpine.sh --root {0} + - name: Cache alpine packages + id: cache-dependencies + uses: actions/cache@v4 + env: + cache-name: cache-alpine-packages + with: + path: ${{ env.apk_package_cache }} + key: alpine-${{ matrix.alpine_version }}-${{ env.cache-name }} + - if: ${{ steps.cache-dependencies.outputs.cache-hit != 'true' }} + name: Update apk repositories + run: apk update + shell: alpine.sh --root {0} - name: Install dependencies run: | - apk update apk add \ cmake \ ninja-build \ @@ -70,13 +88,13 @@ jobs: shell: alpine.sh --root {0} - name: Prepare run: | - CXX=/usr/bin/${{ matrix.cpp_compiler }} \ - cmake . -B build -G Ninja \ - -DCMAKE_BUILD_TYPE=Debug \ - -DPPPLUGIN_SHARED=ON \ - -DPPPLUGIN_ENABLE_EXAMPLES=ON \ - -DPPPLUGIN_ENABLE_TESTS=ON \ - -DPPPLUGIN_ENABLE_CPP17_COMPATIBILITY=${{ matrix.cpp17_compatibility }} + CXX=/usr/bin/${{ matrix.cpp_compiler }} \ + cmake . -B build -G Ninja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DPPPLUGIN_SHARED=ON \ + -DPPPLUGIN_ENABLE_EXAMPLES=ON \ + -DPPPLUGIN_ENABLE_TESTS=ON \ + -DPPPLUGIN_ENABLE_CPP17_COMPATIBILITY=${{ matrix.cpp17_compatibility }} shell: alpine.sh {0} - name: Build run: | From 20108ad9152277d969889fb72b023d851c7b01d9 Mon Sep 17 00:00:00 2001 From: Tamino Bauknecht Date: Fri, 14 Feb 2025 23:58:04 +0100 Subject: [PATCH 3/9] ci: Cache pip packages --- .github/workflows/cmake-lint.yml | 11 ++++++----- .github/workflows/format.yml | 14 +++++++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cmake-lint.yml b/.github/workflows/cmake-lint.yml index 40b9c44..a126bd7 100644 --- a/.github/workflows/cmake-lint.yml +++ b/.github/workflows/cmake-lint.yml @@ -25,12 +25,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: actions/setup-python@v5 + with: + python-version: '3.13' + cache-dependency-path: '.github/workflows/cmake-lint.yml' + cache: 'pip' - name: Install dependencies - run: | - sudo apt update -y - sudo apt -y --no-install-recommends install \ - python3-pip='22.*' - pip install cmakelint + run: pip install cmakelint - name: Execute cmakelint run: find . \( \( -path './build' -o -path '*/.*' \) -prune \) -o \( -type f -a -iname 'CMakeLists.txt' \) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index f9d2f57..047a0e0 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -30,13 +30,18 @@ jobs: - uses: jirutka/setup-alpine@v1 with: branch: v3.19 - - name: Install dependencies + - uses: actions/setup-python@v5 + with: + python-version: '3.13' + cache-dependency-path: '.github/workflows/format.yml' + cache: 'pip' + - name: Install CMake linting tools + run: pip install cmakelint + - name: Install C++ linting tools run: | apk update apk add \ - clang-extra-tools \ - py3-pip - pip install --break-system-packages cmake-format + clang-extra-tools shell: alpine.sh --root {0} # Check all source and header C++ files; ignore files in hidden directories - name: Execute clang-format @@ -51,4 +56,3 @@ jobs: \( -type f -a -name 'CMakeLists.txt' \) -exec echo "Format checking '{}'..." \; -exec cmake-format --check -- {} + - shell: alpine.sh {0} From b3190d8607f8250d5d8b1989c30a2a236ca3b8d3 Mon Sep 17 00:00:00 2001 From: Tamino Bauknecht Date: Sat, 15 Feb 2025 00:28:46 +0100 Subject: [PATCH 4/9] ci: Use packages parameter of setup-alpine action --- .github/workflows/cmake-lint.yml | 1 + .github/workflows/cpp-build.yml | 47 +++++++++--------------------- .github/workflows/cpp-lint.yml | 30 +++++++++---------- .github/workflows/cpp-unittest.yml | 39 ++++++++++++------------- .github/workflows/format.yml | 25 ++++++++-------- 5 files changed, 58 insertions(+), 84 deletions(-) diff --git a/.github/workflows/cmake-lint.yml b/.github/workflows/cmake-lint.yml index a126bd7..5f1407b 100644 --- a/.github/workflows/cmake-lint.yml +++ b/.github/workflows/cmake-lint.yml @@ -32,6 +32,7 @@ jobs: cache: 'pip' - name: Install dependencies run: pip install cmakelint + - name: Execute cmakelint run: find . \( \( -path './build' -o -path '*/.*' \) -prune \) -o \( -type f -a -iname 'CMakeLists.txt' \) diff --git a/.github/workflows/cpp-build.yml b/.github/workflows/cpp-build.yml index 34d9ce6..f3e0b89 100644 --- a/.github/workflows/cpp-build.yml +++ b/.github/workflows/cpp-build.yml @@ -42,50 +42,29 @@ jobs: - cpp_compiler: "clang++" alpine_version: "v3.20" cpp17_compatibility: "ON" - env: - apk_package_cache: "/var/cache/apk" steps: - uses: actions/checkout@v3 - uses: jirutka/setup-alpine@v1 with: branch: ${{ matrix.alpine_version }} - - name: Setup apk cache - run: | - mkdir -pv ${{ env.apk_package_cache }} - ln -s ${{ env.apk_package_cache }} /etc/apk/cache - shell: alpine.sh --root {0} - - name: Cache alpine packages - id: cache-dependencies - uses: actions/cache@v4 - env: - cache-name: cache-alpine-packages - with: - path: ${{ env.apk_package_cache }} - key: alpine-${{ matrix.alpine_version }}-${{ env.cache-name }} - - if: ${{ steps.cache-dependencies.outputs.cache-hit != 'true' }} - name: Update apk repositories - run: apk update - shell: alpine.sh --root {0} - - name: Install dependencies - run: | - apk add \ - cmake \ - ninja-build \ - g++ \ - clang \ - boost-dev \ - boost-filesystem \ - boost-python3 \ - lua5.2-dev \ - python3-dev \ - fmt-dev \ - gtest-dev - shell: alpine.sh --root {0} + packages: > + cmake + ninja-build + g++ + clang + boost-dev + boost-filesystem + boost-python3 + lua5.2-dev + python3-dev + fmt-dev + gtest-dev - name: Fixup environment run: | ln -s liblua-5.2.so.0 /usr/lib/liblua-5.2.so ln -s /usr/lib/ninja-build/bin/ninja /usr/bin/ninja shell: alpine.sh --root {0} + - name: Prepare run: | CXX=/usr/bin/${{ matrix.cpp_compiler }} \ diff --git a/.github/workflows/cpp-lint.yml b/.github/workflows/cpp-lint.yml index 7e52df3..65a0aaf 100644 --- a/.github/workflows/cpp-lint.yml +++ b/.github/workflows/cpp-lint.yml @@ -33,27 +33,24 @@ jobs: - uses: jirutka/setup-alpine@v1 with: branch: v3.19 - - name: Install dependencies - run: | - apk update - apk add \ - cmake \ - ninja-build \ - g++ \ - boost-dev \ - boost-filesystem \ - boost-python3 \ - lua5.2-dev \ - python3-dev \ - fmt-dev \ - gtest-dev \ - clang-extra-tools - shell: alpine.sh --root {0} + packages: > + cmake + ninja-build + g++ + boost-dev + boost-filesystem + boost-python3 + lua5.2-dev + python3-dev + fmt-dev + gtest-dev + clang-extra-tools - name: Fixup environment run: | ln -s liblua-5.2.so.0 /usr/lib/liblua-5.2.so ln -s /usr/lib/ninja-build/bin/ninja /usr/bin/ninja shell: alpine.sh --root {0} + - name: Generate compile_commands.json run: | cmake . -B build -G Ninja \ @@ -61,6 +58,7 @@ jobs: -DPPPLUGIN_ENABLE_TESTS=ON \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON shell: alpine.sh {0} + # Check all source and header C++ files; # ignore files in the build directory or in hidden directories - name: Execute clang-tidy diff --git a/.github/workflows/cpp-unittest.yml b/.github/workflows/cpp-unittest.yml index 0bff528..b3dd2c7 100644 --- a/.github/workflows/cpp-unittest.yml +++ b/.github/workflows/cpp-unittest.yml @@ -37,22 +37,19 @@ jobs: branch: edge extra-repositories: | http://dl-cdn.alpinelinux.org/alpine/edge/testing - - name: Install dependencies - run: | - apk update - apk add \ - cmake \ - ninja-build \ - g++ \ - boost-dev \ - boost-filesystem \ - boost-python3 \ - lua5.2-dev \ - python3-dev \ - fmt-dev \ - gtest-dev \ - lcov gzip - shell: alpine.sh --root {0} + packages: > + cmake + ninja-build + g++ + boost-dev + boost-filesystem + boost-python3 + lua5.2-dev + python3-dev + fmt-dev + gtest-dev + lcov + gzip - name: Fixup environment run: | ln -s liblua-5.2.so.0 /usr/lib/liblua-5.2.so @@ -60,11 +57,11 @@ jobs: shell: alpine.sh --root {0} - name: Prepare run: | - cmake . -B build -G Ninja \ - -DCMAKE_BUILD_TYPE=Debug \ - -DPPPLUGIN_ENABLE_TESTS=ON \ - -DPPPLUGIN_ENABLE_COVERAGE=ON \ - -DPPPLUGIN_ENABLE_CPP17_COMPATIBILITY=${{ matrix.cpp17_compatibility }} + cmake . -B build -G Ninja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DPPPLUGIN_ENABLE_TESTS=ON \ + -DPPPLUGIN_ENABLE_COVERAGE=ON \ + -DPPPLUGIN_ENABLE_CPP17_COMPATIBILITY=${{ matrix.cpp17_compatibility }} shell: alpine.sh {0} - name: Build run: | diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 047a0e0..d2eeac5 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -30,19 +30,9 @@ jobs: - uses: jirutka/setup-alpine@v1 with: branch: v3.19 - - uses: actions/setup-python@v5 - with: - python-version: '3.13' - cache-dependency-path: '.github/workflows/format.yml' - cache: 'pip' - - name: Install CMake linting tools - run: pip install cmakelint - - name: Install C++ linting tools - run: | - apk update - apk add \ - clang-extra-tools - shell: alpine.sh --root {0} + packages: > + clang-extra-tools + # Check all source and header C++ files; ignore files in hidden directories - name: Execute clang-format run: find . \( -path '*/.*' -prune \) -o @@ -50,6 +40,15 @@ jobs: -exec echo "Format checking '{}'..." \; -exec clang-format --dry-run --Werror --Wno-error=unknown {} + shell: alpine.sh {0} + + - uses: actions/setup-python@v5 + with: + python-version: '3.13' + cache-dependency-path: '.github/workflows/format.yml' + cache: 'pip' + - name: Install CMake formatting tool + run: pip install cmake-format + # Check all cmake files; ignore files in hidden directories - name: Execute cmake-format run: find . \( -path '*/.*' -prune \) -o From 6594c646b13fee07abf06da047b74aaeeb8e8ad2 Mon Sep 17 00:00:00 2001 From: Tamino Bauknecht Date: Sat, 15 Feb 2025 00:40:19 +0100 Subject: [PATCH 5/9] ci: Split cmake and cpp format jobs --- .github/workflows/cmake-format.yml | 41 +++++++++++++++++++ .../workflows/{format.yml => cpp-format.yml} | 22 ++-------- 2 files changed, 44 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/cmake-format.yml rename .github/workflows/{format.yml => cpp-format.yml} (59%) diff --git a/.github/workflows/cmake-format.yml b/.github/workflows/cmake-format.yml new file mode 100644 index 0000000..1e92f53 --- /dev/null +++ b/.github/workflows/cmake-format.yml @@ -0,0 +1,41 @@ +name: "CMake Format" + +on: + # always run on main branch + push: + branches: [ main ] + paths-ignore: + - 'README.md' + - 'CONTRIBUTING.md' + - 'LICENSE' + # run on PR to main branch if relevant files changed + pull_request: + branches: [ main ] + paths: + - '**/CMakeLists.txt' + - '.github/workflows/cmake-format.yml' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + format: + name: "cmake-format" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v5 + with: + python-version: '3.13' + cache-dependency-path: '.github/workflows/cmake-format.yml' + cache: 'pip' + - name: Install CMake formatting tool + run: pip install cmake-format + + # Check all cmake files; ignore files in hidden directories + - name: Execute cmake-format + run: find . \( -path '*/.*' -prune \) -o + \( -type f -a -name 'CMakeLists.txt' \) + -exec echo "Format checking '{}'..." \; + -exec cmake-format --check -- {} + diff --git a/.github/workflows/format.yml b/.github/workflows/cpp-format.yml similarity index 59% rename from .github/workflows/format.yml rename to .github/workflows/cpp-format.yml index d2eeac5..df59907 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/cpp-format.yml @@ -1,4 +1,4 @@ -name: "C++/CMake Format" +name: "C++ Format" on: # always run on main branch @@ -14,8 +14,7 @@ on: paths: - '**/*.cpp' - '**/*.h' - - '**/CMakeLists.txt' - - '.github/workflows/format.yml' + - '.github/workflows/cpp-format.yml' concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -23,7 +22,7 @@ concurrency: jobs: format: - name: "clang-format/cmake-format" + name: "clang-format" runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -40,18 +39,3 @@ jobs: -exec echo "Format checking '{}'..." \; -exec clang-format --dry-run --Werror --Wno-error=unknown {} + shell: alpine.sh {0} - - - uses: actions/setup-python@v5 - with: - python-version: '3.13' - cache-dependency-path: '.github/workflows/format.yml' - cache: 'pip' - - name: Install CMake formatting tool - run: pip install cmake-format - - # Check all cmake files; ignore files in hidden directories - - name: Execute cmake-format - run: find . \( -path '*/.*' -prune \) -o - \( -type f -a -name 'CMakeLists.txt' \) - -exec echo "Format checking '{}'..." \; - -exec cmake-format --check -- {} + From af7d0a5dd5041d37075aff8d29b28250b6552fb6 Mon Sep 17 00:00:00 2001 From: Tamino Bauknecht Date: Sat, 15 Feb 2025 00:53:56 +0100 Subject: [PATCH 6/9] ci: Move cpp-unittest to cpp-build to re-use build artifacts --- .github/workflows/cpp-build.yml | 64 +++++++++++++++++++- .github/workflows/cpp-unittest.yml | 96 ------------------------------ 2 files changed, 62 insertions(+), 98 deletions(-) delete mode 100644 .github/workflows/cpp-unittest.yml diff --git a/.github/workflows/cpp-build.yml b/.github/workflows/cpp-build.yml index f3e0b89..c8623bd 100644 --- a/.github/workflows/cpp-build.yml +++ b/.github/workflows/cpp-build.yml @@ -1,4 +1,4 @@ -name: "C++ Build" +name: "Build|Test" on: # always run on main branch @@ -25,7 +25,7 @@ concurrency: jobs: build: - name: "gcc/clang build" + name: "build" runs-on: ubuntu-latest strategy: matrix: @@ -73,6 +73,7 @@ jobs: -DPPPLUGIN_SHARED=ON \ -DPPPLUGIN_ENABLE_EXAMPLES=ON \ -DPPPLUGIN_ENABLE_TESTS=ON \ + -DPPPLUGIN_ENABLE_COVERAGE=ON \ -DPPPLUGIN_ENABLE_CPP17_COMPATIBILITY=${{ matrix.cpp17_compatibility }} shell: alpine.sh {0} - name: Build @@ -83,3 +84,62 @@ jobs: run: | cmake --install build shell: alpine.sh --root {0} + + - uses: actions/upload-artifact@v4 + with: + name: build_alpine-${{ matrix.alpine_version }}_${{ matrix.cpp_compiler }}_cpp17-${{ matrix.cpp17_compatibility }} + path: build + + unittest: + name: "unittest" + needs: build + runs-on: ubuntu-latest + strategy: + matrix: + cpp17_compatibility: [ "ON", "OFF" ] + steps: + - uses: actions/checkout@v3 + - uses: actions/download-artifact@v4 + with: + pattern: build_alpine-*_g++_cpp17-${{ matrix.cpp17_compatibility }} + path: build + merge-multiple: true + - name: Fix artifact permissions + run: chmod +x build/test/tests + + - uses: jirutka/setup-alpine@v1 + with: + branch: v3.20 + packages: > + g++ + gtest-dev + lcov + gzip + + - name: Execute tests + run: | + lcov --capture --initial \ + --directory . \ + --ignore-errors mismatch \ + --output-file baseline_coverage + build/test/tests || echo $? + lcov --capture \ + --directory . \ + --ignore-errors mismatch \ + --output-file total_coverage + lcov \ + --add-tracefile baseline_coverage \ + --add-tracefile total_coverage \ + --ignore-errors mismatch \ + --output-file measured_coverage + lcov --remove measured_coverage "/usr*" \ + --ignore-errors mismatch \ + --output-file coverage_without_system_files + lcov --remove coverage_without_system_files "*/test/*" \ + --ignore-errors mismatch \ + --output-file coverage_without_system_and_test_files + genhtml \ + --output-directory coverage \ + --legend coverage_without_system_and_test_files + lcov --list coverage_without_system_and_test_files + shell: alpine.sh {0} diff --git a/.github/workflows/cpp-unittest.yml b/.github/workflows/cpp-unittest.yml deleted file mode 100644 index b3dd2c7..0000000 --- a/.github/workflows/cpp-unittest.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: "C++ Unittests" - -on: - # always run on main branch - push: - branches: [ main ] - paths-ignore: - - 'README.md' - - 'CONTRIBUTING.md' - - 'LICENSE' - # run on PR to main branch if relevant files changed - pull_request: - branches: [ main ] - paths: - - 'src/**' - - 'include/**' - - 'test/**' - - 'CMakeLists.txt' - - '.github/workflows/cpp-unittest.yml' - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - - -jobs: - unittest: - name: "unittests" - runs-on: ubuntu-latest - strategy: - matrix: - cpp17_compatibility: [ "ON", "OFF" ] - steps: - - uses: actions/checkout@v3 - - uses: jirutka/setup-alpine@v1 - with: - branch: edge - extra-repositories: | - http://dl-cdn.alpinelinux.org/alpine/edge/testing - packages: > - cmake - ninja-build - g++ - boost-dev - boost-filesystem - boost-python3 - lua5.2-dev - python3-dev - fmt-dev - gtest-dev - lcov - gzip - - name: Fixup environment - run: | - ln -s liblua-5.2.so.0 /usr/lib/liblua-5.2.so - ln -s /usr/lib/ninja-build/bin/ninja /usr/bin/ninja - shell: alpine.sh --root {0} - - name: Prepare - run: | - cmake . -B build -G Ninja \ - -DCMAKE_BUILD_TYPE=Debug \ - -DPPPLUGIN_ENABLE_TESTS=ON \ - -DPPPLUGIN_ENABLE_COVERAGE=ON \ - -DPPPLUGIN_ENABLE_CPP17_COMPATIBILITY=${{ matrix.cpp17_compatibility }} - shell: alpine.sh {0} - - name: Build - run: | - cmake --build build -j - shell: alpine.sh {0} - - name: Execute tests - run: | - lcov --capture --initial \ - --directory . \ - --ignore-errors mismatch \ - --output-file baseline_coverage - build/test/tests || echo $? - lcov --capture \ - --directory . \ - --ignore-errors mismatch \ - --output-file total_coverage - lcov \ - --add-tracefile baseline_coverage \ - --add-tracefile total_coverage \ - --ignore-errors mismatch \ - --output-file measured_coverage - lcov --remove measured_coverage "/usr*" \ - --ignore-errors mismatch \ - --output-file coverage_without_system_files - lcov --remove coverage_without_system_files "*/test/*" \ - --ignore-errors mismatch \ - --output-file coverage_without_system_and_test_files - genhtml \ - --output-directory coverage \ - --legend coverage_without_system_and_test_files - lcov --list coverage_without_system_and_test_files - shell: alpine.sh {0} From 3adfc779d09d4dc9d51393f7955a064e9abe4208 Mon Sep 17 00:00:00 2001 From: Tamino Bauknecht Date: Sat, 15 Feb 2025 01:27:03 +0100 Subject: [PATCH 7/9] ci: Only use coverage with GCC and replace cpp17_compatibility by cpp_version --- .github/workflows/cpp-build.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cpp-build.yml b/.github/workflows/cpp-build.yml index c8623bd..4d612a2 100644 --- a/.github/workflows/cpp-build.yml +++ b/.github/workflows/cpp-build.yml @@ -32,16 +32,16 @@ jobs: include: - cpp_compiler: "g++" alpine_version: "v3.20" - cpp17_compatibility: "ON" + cpp_version: "cpp17" - cpp_compiler: "clang++" alpine_version: "v3.19" - cpp17_compatibility: "OFF" + cpp_version: "cpp17" - cpp_compiler: "g++" alpine_version: "v3.19" - cpp17_compatibility: "OFF" + cpp_version: "cpp20" - cpp_compiler: "clang++" alpine_version: "v3.20" - cpp17_compatibility: "ON" + cpp_version: "cpp20" steps: - uses: actions/checkout@v3 - uses: jirutka/setup-alpine@v1 @@ -73,8 +73,8 @@ jobs: -DPPPLUGIN_SHARED=ON \ -DPPPLUGIN_ENABLE_EXAMPLES=ON \ -DPPPLUGIN_ENABLE_TESTS=ON \ - -DPPPLUGIN_ENABLE_COVERAGE=ON \ - -DPPPLUGIN_ENABLE_CPP17_COMPATIBILITY=${{ matrix.cpp17_compatibility }} + -DPPPLUGIN_ENABLE_COVERAGE=${{ matrix.cpp_compiler == 'g++' && 'ON' || 'OFF' }} \ + -DPPPLUGIN_ENABLE_CPP17_COMPATIBILITY=${{ matrix.cpp_version == 'cpp17' && 'ON' || 'OFF' }} shell: alpine.sh {0} - name: Build run: | @@ -87,7 +87,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: build_alpine-${{ matrix.alpine_version }}_${{ matrix.cpp_compiler }}_cpp17-${{ matrix.cpp17_compatibility }} + name: build_alpine-${{ matrix.alpine_version }}_${{ matrix.cpp_compiler }}_${{ matrix.cpp_version }} path: build unittest: @@ -96,12 +96,12 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - cpp17_compatibility: [ "ON", "OFF" ] + cpp_version: [ "cpp17", "cpp20" ] steps: - uses: actions/checkout@v3 - uses: actions/download-artifact@v4 with: - pattern: build_alpine-*_g++_cpp17-${{ matrix.cpp17_compatibility }} + pattern: build_alpine-*_g++_${{ matrix.cpp_version }} path: build merge-multiple: true - name: Fix artifact permissions From ca3c424528a36cc344a3b7818f7c21c3799f98d8 Mon Sep 17 00:00:00 2001 From: Tamino Bauknecht Date: Sat, 15 Feb 2025 01:27:39 +0100 Subject: [PATCH 8/9] ci: Retain build artifacts for only 5 days --- .github/workflows/cpp-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cpp-build.yml b/.github/workflows/cpp-build.yml index 4d612a2..5543032 100644 --- a/.github/workflows/cpp-build.yml +++ b/.github/workflows/cpp-build.yml @@ -89,6 +89,7 @@ jobs: with: name: build_alpine-${{ matrix.alpine_version }}_${{ matrix.cpp_compiler }}_${{ matrix.cpp_version }} path: build + retention-days: 5 unittest: name: "unittest" From 8e5d2eaaa60e6cdbc1482d1521a76c570600eaa7 Mon Sep 17 00:00:00 2001 From: Tamino Bauknecht Date: Sat, 15 Feb 2025 01:37:29 +0100 Subject: [PATCH 9/9] ci: Ignore source errors for coverage calculation This allows the job to run without the build dependencies. Alternatively, this flag can be removed in favor of installing the dependencies for the header files. --- .github/workflows/cpp-build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cpp-build.yml b/.github/workflows/cpp-build.yml index 5543032..7c5215f 100644 --- a/.github/workflows/cpp-build.yml +++ b/.github/workflows/cpp-build.yml @@ -121,23 +121,23 @@ jobs: run: | lcov --capture --initial \ --directory . \ - --ignore-errors mismatch \ + --ignore-errors mismatch,source \ --output-file baseline_coverage build/test/tests || echo $? lcov --capture \ --directory . \ - --ignore-errors mismatch \ + --ignore-errors mismatch,source \ --output-file total_coverage lcov \ --add-tracefile baseline_coverage \ --add-tracefile total_coverage \ - --ignore-errors mismatch \ + --ignore-errors mismatch,source \ --output-file measured_coverage lcov --remove measured_coverage "/usr*" \ - --ignore-errors mismatch \ + --ignore-errors mismatch,source \ --output-file coverage_without_system_files lcov --remove coverage_without_system_files "*/test/*" \ - --ignore-errors mismatch \ + --ignore-errors mismatch,source \ --output-file coverage_without_system_and_test_files genhtml \ --output-directory coverage \