From d39bffaf6b6fe233a522058cff299389d9a4bb82 Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Wed, 5 Jun 2024 12:26:00 +0200 Subject: [PATCH] [INFRA] Use containers for CI --- .codecov.yml | 4 ++ .github/workflows/ci_coverage.yml | 85 ++++++++++---------------- .github/workflows/ci_documentation.yml | 13 +--- .github/workflows/ci_iwyu.yml | 3 +- .github/workflows/ci_linux.yml | 75 ++++++----------------- .github/workflows/ci_macos.yml | 15 +++-- .github/workflows/ci_misc.yml | 38 +++++------- .github/workflows/ci_sanitizer.yml | 29 +++------ .github/workflows/ci_util.yml | 28 +++------ .github/workflows/scripts/gcov.sh | 12 ---- include/hibf/platform.hpp | 14 ++--- test/unit/CMakeLists.txt | 2 +- 12 files changed, 111 insertions(+), 207 deletions(-) delete mode 100755 .github/workflows/scripts/gcov.sh diff --git a/.codecov.yml b/.codecov.yml index f581ad3a..93928283 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -20,3 +20,7 @@ coverage: if_ci_failed: success # per default, codecov would fail if any CI fails informational: true # the codecov/patch status is never "fail" only_pulls: true # only post codecov/patch status on PRs + +parsers: + cobertura: + partials_as_hits: true diff --git a/.github/workflows/ci_coverage.yml b/.github/workflows/ci_coverage.yml index 77a2e703..f8a803ae 100644 --- a/.github/workflows/ci_coverage.yml +++ b/.github/workflows/ci_coverage.yml @@ -26,90 +26,69 @@ defaults: jobs: build: - name: ${{ matrix.name }} - runs-on: ubuntu-22.04 - timeout-minutes: 120 - if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint' + runs-on: ubuntu-latest + name: ${{ matrix.compiler }} + # if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint' strategy: - fail-fast: true + fail-fast: false matrix: - include: - - name: "gcc13" - compiler: "gcc-13" - build: coverage - build_type: Coverage - + compiler: ["gcc-14"] + container: + image: ghcr.io/seqan/${{ matrix.compiler }} + volumes: + - /home/runner:/home/runner steps: - # How many commits do we need to fetch to also fetch the branch point? - - name: Get fetch depth - id: fetch_depth - run: echo "depth=$(( ${{ github.event.pull_request.commits }} + 2 ))" >> $GITHUB_OUTPUT - - name: Checkout uses: actions/checkout@v4 with: - fetch-depth: ${{ steps.fetch_depth.outputs.depth }} - submodules: false - - - name: Setup toolchain - uses: seqan/actions/setup-toolchain@main - with: - compiler: ${{ matrix.compiler }} - ccache_size: 525M + fetch-depth: 0 - - name: Install CMake - uses: seqan/actions/setup-cmake@main + - name: Load ccache + uses: actions/cache@v4 with: - cmake: 3.18.6 - - - name: Install gcovr - run: | - sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/${CC/gcc/gcov} 100 - pip install gcovr==6.0 + path: /home/runner/.ccache + save-always: true + key: ccache-${{ runner.os }}-${{ github.workflow }}-${{ matrix.compiler }}-${{ github.ref }} - name: Configure tests run: | mkdir build cd build - cmake ../test/${{ matrix.build }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ - -DHIBF_VERBOSE_TESTS=OFF - make -j2 gtest_main + cmake ../test/coverage -DCMAKE_BUILD_TYPE=Coverage + make -j gtest_main - name: Build tests - env: - CCACHE_IGNOREOPTIONS: "-fprofile-abs-path" + working-directory: build run: | ccache -z - cd build - make -k -j2 + make -k -j ccache -sv - name: Run tests + working-directory: build run: | - cd build - ctest . -j2 --output-on-failure + ctest . -j --output-on-failure - name: Generate coverage report run: | - gcovr --gcov-executable ${{ github.workspace }}/.github/workflows/scripts/gcov.sh \ - --root ${{ github.workspace }}/test/coverage \ - ${{ github.workspace }}/build \ - --filter ${{ github.workspace }}/include \ - --filter ${{ github.workspace }}/test/include \ - --filter ${{ github.workspace }}/src \ - --exclude ${{ github.workspace }}/include/hibf/contrib \ - --exclude ${{ github.workspace }}/test/include/hibf/test/iterator_test_template.hpp \ + gcovr --root ${GITHUB_WORKSPACE}/test/coverage \ + ${GITHUB_WORKSPACE}/build \ + --filter ${GITHUB_WORKSPACE}/include \ + --filter ${GITHUB_WORKSPACE}/test/include \ + --filter ${GITHUB_WORKSPACE}/src \ + --exclude ${GITHUB_WORKSPACE}/include/hibf/contrib \ + --exclude ${GITHUB_WORKSPACE}/test/include/hibf/test/iterator_test_template.hpp \ --exclude-lines-by-pattern '^\s*$' \ --exclude-lines-by-pattern '^\s*};$' \ --exclude-unreachable-branches \ --exclude-throw-branches \ --exclude-noncode-lines \ - -j 2 \ - --xml \ - --output ${{ github.workspace }}/build/coverage_report.xml + -j \ + --cobertura \ + --output ${GITHUB_WORKSPACE}/build/coverage_report.xml - name: Submit coverage build uses: codecov/codecov-action@v3.1.5 with: - files: ${{ github.workspace }}/build/coverage_report.xml + files: build/coverage_report.xml fail_ci_if_error: false diff --git a/.github/workflows/ci_documentation.yml b/.github/workflows/ci_documentation.yml index 12e891f3..4d30c336 100644 --- a/.github/workflows/ci_documentation.yml +++ b/.github/workflows/ci_documentation.yml @@ -33,14 +33,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 1 - submodules: false - - - name: Install CMake - uses: seqan/actions/setup-cmake@main - with: - cmake: 3.18.6 - name: Install Doxygen uses: seqan/actions/setup-doxygen@main @@ -55,6 +47,5 @@ jobs: make -j2 download-cppreference-doxygen-web-tag - name: Run tests - run: | - cd build - ctest . -j2 --output-on-failure + working-directory: build + run: ctest . -j2 --output-on-failure diff --git a/.github/workflows/ci_iwyu.yml b/.github/workflows/ci_iwyu.yml index f93501a9..9cfb61ca 100644 --- a/.github/workflows/ci_iwyu.yml +++ b/.github/workflows/ci_iwyu.yml @@ -62,8 +62,7 @@ jobs: mkdir build cd build cmake ../hibf/test/iwyu -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_CXX_FLAGS="-stdlib=libc++" \ - -DHIBF_VERBOSE_TESTS=OFF + -DCMAKE_CXX_FLAGS="-stdlib=libc++" - name: Run Test run: | diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index 6ef4ca01..8641b4be 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -26,77 +26,42 @@ defaults: jobs: build: - name: ${{ matrix.name }} - runs-on: ubuntu-22.04 - timeout-minutes: 120 + runs-on: ubuntu-latest + name: ${{ matrix.compiler }} if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint' strategy: - fail-fast: true + fail-fast: false matrix: - include: - - name: "clang17" - compiler: "clang-17" - build: unit - build_type: Release - cxx_flags: "-stdlib=libc++" - - - name: "gcc13" - compiler: "gcc-13" - build: unit - build_type: Release - - - name: "gcc12" - compiler: "gcc-12" - build: unit - build_type: Release - - - name: "gcc11" - compiler: "gcc-11" - build: unit - build_type: Release - - - name: "IntelLLVM" - compiler: "intel" - build: unit - build_type: Release - + compiler: ["clang-18", "clang-17", "gcc-14", "gcc-13", "gcc-12", "gcc-11", "intel"] + container: + image: ghcr.io/seqan/${{ matrix.compiler }} + volumes: + - /home/runner:/home/runner steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 1 - submodules: false - - - name: Setup toolchain - uses: seqan/actions/setup-toolchain@main - with: - compiler: ${{ matrix.compiler }} - ccache_size: 75M - - name: Install CMake - if: contains(matrix.compiler, 'intel') == false - uses: seqan/actions/setup-cmake@main + - name: Load ccache + uses: actions/cache@v4 with: - cmake: 3.18.6 + path: /home/runner/.ccache + save-always: true + key: ccache-${{ runner.os }}-${{ github.workflow }}-${{ matrix.compiler }}-${{ github.ref }} - name: Configure tests run: | - mkdir build - cd build - cmake ../test/${{ matrix.build }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ - -DHIBF_VERBOSE_TESTS=OFF \ - -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}" - make -j2 gtest_main + mkdir build && cd build + cmake ../test/unit -DCMAKE_BUILD_TYPE=Release + make -j gtest_main - name: Build tests + working-directory: build run: | ccache -z - cd build - make -k -j2 + make -k -j ccache -sv - name: Run tests - run: | - cd build - ctest . -j2 --output-on-failure + working-directory: build + run: ctest . -j --output-on-failure diff --git a/.github/workflows/ci_macos.yml b/.github/workflows/ci_macos.yml index ba7e675f..f4e1d65c 100644 --- a/.github/workflows/ci_macos.yml +++ b/.github/workflows/ci_macos.yml @@ -34,6 +34,11 @@ jobs: fail-fast: true matrix: include: + - name: "clang18" + compiler: "clang-18" + build: unit + build_type: Release + - name: "clang17" compiler: "clang-17" build: unit @@ -76,18 +81,16 @@ jobs: run: | mkdir build cd build - cmake ../test/${{ matrix.build }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ - -DHIBF_VERBOSE_TESTS=OFF + cmake ../test/${{ matrix.build }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} make -j3 gtest_main - name: Build tests + working-directory: build run: | ccache -z - cd build make -k -j3 ccache -sv - name: Run tests - run: | - cd build - ctest . -j3 --output-on-failure + working-directory: build + run: ctest . -j3 --output-on-failure diff --git a/.github/workflows/ci_misc.yml b/.github/workflows/ci_misc.yml index f0986a99..f71d7dc1 100644 --- a/.github/workflows/ci_misc.yml +++ b/.github/workflows/ci_misc.yml @@ -27,7 +27,7 @@ defaults: jobs: build: name: ${{ matrix.name }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest timeout-minutes: 120 if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint' strategy: @@ -90,32 +90,27 @@ jobs: build: tutorial build_type: Debug use_include_dependencies: "OFF" + container: + image: ghcr.io/seqan/${{ matrix.compiler }} + volumes: + - /home/runner:/home/runner steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 1 - submodules: false - - - name: Setup toolchain - uses: seqan/actions/setup-toolchain@main - with: - compiler: ${{ matrix.compiler }} - ccache_size: 75M - - name: Install CMake - uses: seqan/actions/setup-cmake@main + - name: Load ccache + uses: actions/cache@v4 with: - cmake: ${{ contains(matrix.build, 'tutorial') && '3.21.7' || '3.18.6' }} + path: /home/runner/.ccache + save-always: true + key: ccache-${{ runner.os }}-${{ github.workflow }}-${{ matrix.compiler }}-${{ github.ref }} - name: Configure tests run: | - mkdir build - cd build + mkdir build && cd build cmake ../test/${{ matrix.build }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ - -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}" \ - -DHIBF_VERBOSE_TESTS=OFF \ + -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}" -DHIBF_USE_INCLUDE_DEPENDENCIES="${{ matrix.use_include_dependencies }}" case "${{ matrix.build }}" in unit) make -j2 gtest_main;; @@ -126,21 +121,20 @@ jobs: - name: Check cyclic includes if: matrix.use_include_dependencies == 'ON' + working-directory: build run: | - cd build make -k -j2 all_dependencies cmake . - name: Build tests if: matrix.use_include_dependencies == 'OFF' + working-directory: build run: | ccache -z - cd build make -k -j2 ccache -sv - name: Run tests if: matrix.use_include_dependencies == 'OFF' - run: | - cd build - ctest . -j2 --output-on-failure + working-directory: build + run: ctest . -j2 --output-on-failure diff --git a/.github/workflows/ci_sanitizer.yml b/.github/workflows/ci_sanitizer.yml index c969b73e..e0505bdc 100644 --- a/.github/workflows/ci_sanitizer.yml +++ b/.github/workflows/ci_sanitizer.yml @@ -65,18 +65,13 @@ jobs: - name: "TSan" os: ubuntu-22.04 compiler: clang-17 - + container: + image: ghcr.io/seqan/${{ matrix.compiler }} + volumes: + - /home/runner:/home/runner steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 1 - submodules: false - - - name: Setup compiler - uses: seqan/actions/setup-compiler@main - with: - compiler: ${{ matrix.compiler }} - name: Configure OS if: contains(matrix.os, 'ubuntu') @@ -86,20 +81,16 @@ jobs: - name: Configure tests run: | - mkdir build - cd build - cmake ../test/all -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ - -DHIBF_VERBOSE_TESTS=OFF \ + mkdir build && cd build + cmake ../test/all -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}" make -j${{ matrix.threads }} gtest_main benchmark_main - name: Build tests - run: | - cd build - make -k -j${{ matrix.threads }} + working-directory: build + run: make -k -j${{ matrix.threads }} - name: Run tests - run: | - cd build - ctest . -j${{ matrix.threads }} --output-on-failure + working-directory: build + run: ctest . -j${{ matrix.threads }} --output-on-failure diff --git a/.github/workflows/ci_util.yml b/.github/workflows/ci_util.yml index a9c90544..ebb3571e 100644 --- a/.github/workflows/ci_util.yml +++ b/.github/workflows/ci_util.yml @@ -27,7 +27,7 @@ defaults: jobs: build: name: ${{ matrix.name }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest timeout-minutes: 120 if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint' strategy: @@ -36,35 +36,25 @@ jobs: include: - name: "gcc13" compiler: "gcc-13" - + - name: "gcc14" + compiler: "gcc-14" + container: + image: ghcr.io/seqan/${{ matrix.compiler }} + volumes: + - /home/runner:/home/runner steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 1 - submodules: false - - - name: Setup toolchain - uses: seqan/actions/setup-toolchain@main - with: - compiler: ${{ matrix.compiler }} - ccache_size: 75M - - - name: Install CMake - uses: seqan/actions/setup-cmake@main - with: - cmake: 3.18.6 - name: Configure util run: | - mkdir build - cd build + mkdir build && cd build cmake ../util -DCMAKE_BUILD_TYPE=Release - name: Build util + working-directory: build run: | ccache -z - cd build make -k -j2 ccache -sv diff --git a/.github/workflows/scripts/gcov.sh b/.github/workflows/scripts/gcov.sh deleted file mode 100755 index 258340d0..00000000 --- a/.github/workflows/scripts/gcov.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -# SPDX-FileCopyrightText: 2006-2023, Knut Reinert & Freie Universität Berlin -# SPDX-FileCopyrightText: 2016-2023, Knut Reinert & MPI für molekulare Genetik -# SPDX-License-Identifier: CC0-1.0 - -set -Eeuo pipefail - -args=${@/--branch-counts/""} -args=${args/--branch-probabilities/""} - -exec gcov $args diff --git a/include/hibf/platform.hpp b/include/hibf/platform.hpp index 0755578f..2eb9c25b 100644 --- a/include/hibf/platform.hpp +++ b/include/hibf/platform.hpp @@ -70,12 +70,12 @@ # error "At least GCC 11 is needed." # endif // (__GNUC__ < 11) -# if (__GNUC__ == 11 && __GNUC_MINOR__ <= 2) -# pragma GCC warning "Be aware that GCC < 11.3 might have bugs that cause compile failure." -# endif // (__GNUC__ == 11 && __GNUC_MINOR__ <= 2) +# if (__GNUC__ == 11 && __GNUC_MINOR__ <= 3) +# pragma warning "Be aware that GCC < 11.4 might have bugs that cause compile failure." +# endif // (__GNUC__ == 11 && __GNUC_MINOR__ <= 3) # if (__GNUC__ == 12 && __GNUC_MINOR__ <= 2) -# pragma GCC warning "Be aware that GCC < 12.3 might have bugs that cause compile failure." +# pragma warning "Be aware that GCC < 12.3 might have bugs that cause compile failure." # endif // (__GNUC__ == 12 && __GNUC_MINOR__ <= 2) # if HIBF_DOXYGEN_ONLY(1) 0 @@ -84,10 +84,10 @@ # endif // HIBF_DOXYGEN_ONLY(1)0 # ifndef HIBF_DISABLE_NEWER_COMPILER_DIAGNOSTIC -# if (__GNUC__ > 13) +# if (__GNUC__ > 14) # pragma message \ - "Your compiler is newer than the latest supported compiler version (gcc-13). It might be that compiling fails. You can disable this warning by setting -DHIBF_DISABLE_NEWER_COMPILER_DIAGNOSTIC." -# endif // (__GNUC__ > 13) + "Your compiler is newer than the latest supported compiler version (gcc-14). It might be that compiling fails. You can disable this warning by setting -DHIBF_DISABLE_NEWER_COMPILER_DIAGNOSTIC." +# endif // (__GNUC__ > 14) # endif // HIBF_DISABLE_NEWER_COMPILER_DIAGNOSTIC #endif diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index f441644b..6ec535cf 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -12,7 +12,7 @@ include (diagnostics/list_missing_unit_tests) include (diagnostics/list_unused_unit_tests) include (include_dependencies/add_include_dependencies) -option (HIBF_VERBOSE_TESTS "Run each test case individually" ON) +option (HIBF_VERBOSE_TESTS "Run each test case individually" OFF) option (HIBF_USE_INCLUDE_DEPENDENCIES "Build tests in an hierarchical order (by an include graph, i.e. tests with less dependencies are build first)" OFF)