Skip to content

Commit

Permalink
Merge pull request #201 from eseiler/package_test
Browse files Browse the repository at this point in the history
[INFRA] Use containers for CI
  • Loading branch information
eseiler authored Jun 5, 2024
2 parents 2e1101d + f040ff0 commit 59e4565
Show file tree
Hide file tree
Showing 18 changed files with 170 additions and 315 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ AlignTrailingComments:
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Never
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: false
Expand Down
4 changes: 4 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
84 changes: 31 additions & 53 deletions .github/workflows/ci_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,90 +26,68 @@ 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: "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
fetch-depth: 0

- name: Setup toolchain
uses: seqan/actions/setup-toolchain@main
- name: Load ccache
uses: actions/cache@v4
with:
compiler: ${{ matrix.compiler }}
ccache_size: 525M

- name: Install CMake
uses: seqan/actions/setup-cmake@main
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
run: |
cd build
ctest . -j2 --output-on-failure
working-directory: build
run: 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/[email protected]
with:
files: ${{ github.workspace }}/build/coverage_report.xml
files: build/coverage_report.xml
fail_ci_if_error: false
18 changes: 4 additions & 14 deletions .github/workflows/ci_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,11 @@ defaults:
jobs:
build:
name: Documentation
runs-on: ubuntu-22.04
timeout-minutes: 120
runs-on: ubuntu-latest
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint'
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
Expand All @@ -52,9 +43,8 @@ jobs:
mkdir build
cd build
cmake ../test/documentation
make -j2 download-cppreference-doxygen-web-tag
make -j download-cppreference-doxygen-web-tag
- name: Run tests
run: |
cd build
ctest . -j2 --output-on-failure
working-directory: build
run: ctest . -j --output-on-failure
57 changes: 22 additions & 35 deletions .github/workflows/ci_iwyu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,77 +23,64 @@ defaults:
jobs:
build:
name: IWYU
runs-on: ubuntu-22.04
timeout-minutes: 120
runs-on: ubuntu-latest
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch'
container:
image: ghcr.io/seqan/clang-18
volumes:
- /home/runner:/home/runner
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: false
path: hibf
token: ${{ secrets.SEQAN_ACTIONS_PAT }}

- name: Setup toolchain
uses: seqan/actions/setup-toolchain@main
with:
compiler: clang-17
ccache_size: 75M

- name: Build IWYU
run: |
mkdir iwyu
cd iwyu
git clone https://github.com/include-what-you-use/include-what-you-use.git --branch 0.21
mkdir build
cd build
mkdir iwyu && cd iwyu
git clone https://github.com/include-what-you-use/include-what-you-use.git --branch 0.22
mkdir build && cd build
cmake ../include-what-you-use -G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_PREFIX_PATH=/usr/lib/llvm-17 \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache
make -j2
sudo make install
-DCMAKE_PREFIX_PATH=/usr/lib/llvm-18
make -j
make install
- name: Configure Test
run: |
mkdir build
cd build
cmake ../hibf/test/iwyu -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="-stdlib=libc++" \
-DHIBF_VERBOSE_TESTS=OFF
mkdir build && cd build
cmake ../hibf/test/iwyu -DCMAKE_BUILD_TYPE=Release
- name: Run Test
working-directory: build
run: |
ccache -z
cd build
make -j2 2> out.txt
make -j 2> out.txt
ccache -sv
- name: Apply changes
working-directory: build
run: |
fix_includes.py --nosafe_headers \
--comments \
--noreorder \
--ignore_re ".*/include/hibf/contrib/.*" < build/out.txt
--ignore_re ".*/include/hibf/contrib/.*" < out.txt
- name: Add changes
id: changed_files
working-directory: hibf
run: |
cd hibf
git add .
CPP_LIST=$(git diff --name-only HEAD | { grep -E "(\.cpp|\.hpp)$" || test $? = 1; } | xargs)
echo "cpp_list=$CPP_LIST" >> $GITHUB_OUTPUT
- name: Run clang-format
if: ${{ steps.changed_files.outputs.cpp_list }}
working-directory: hibf
run: |
sudo apt-get remove --yes libllvm15*
install clang-format-15
cd hibf
clang-format-15 --style=file -i ${{ steps.changed_files.outputs.cpp_list }}
clang-format-18 --style=file -i ${{ steps.changed_files.outputs.cpp_list }}
git add .
- name: Import GPG key
Expand All @@ -104,14 +91,14 @@ jobs:
passphrase: ${{ secrets.SEQAN_ACTIONS_GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
workdir: ${{ github.workspace }}/hibf
workdir: hibf

- name: Open PR
if: ${{ steps.changed_files.outputs.cpp_list }}
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.SEQAN_ACTIONS_PAT }}
path: ${{ github.workspace }}/hibf
path: hibf
commit-message: "[MISC] IWYU"
committer: "seqan-actions[bot] <[email protected]>"
author: "seqan-actions[bot] <[email protected]>"
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci_license.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ env:
jobs:
check:
name: REUSE Compliance
runs-on: ubuntu-22.04
timeout-minutes: 120
runs-on: ubuntu-latest
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint'
steps:
- name: Checkout
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/ci_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
concurrency:
group: linux-${{ github.event.pull_request.number }}
cancel-in-progress: true
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: "Cancel Linux"
run: echo "Cancelling Linux"
Expand All @@ -30,7 +30,7 @@ jobs:
concurrency:
group: macos-${{ github.event.pull_request.number }}
cancel-in-progress: true
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: "Cancel macOS"
run: echo "Cancelling macOS"
Expand All @@ -39,7 +39,7 @@ jobs:
concurrency:
group: misc-${{ github.event.pull_request.number }}
cancel-in-progress: true
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: "Cancel Misc"
run: echo "Cancelling Misc"
Expand All @@ -48,7 +48,7 @@ jobs:
concurrency:
group: coverage-${{ github.event.pull_request.number }}
cancel-in-progress: true
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: "Cancel Coverage"
run: echo "Cancelling Coverage"
Expand All @@ -57,7 +57,7 @@ jobs:
concurrency:
group: documentation-${{ github.event.pull_request.number }}
cancel-in-progress: true
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: "Cancel Documentation"
run: echo "Cancelling Documentation"
Expand All @@ -66,7 +66,7 @@ jobs:
concurrency:
group: util-${{ github.event.pull_request.number }}
cancel-in-progress: true
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: "Cancel Util"
run: echo "Cancelling Util"
Expand All @@ -76,7 +76,7 @@ jobs:
group: lint-${{ github.event.pull_request.number }}
cancel-in-progress: true
needs: [cancel_linux, cancel_macos, cancel_misc, cancel_coverage, cancel_documentation, cancel_util]
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Run lint
Expand Down
Loading

0 comments on commit 59e4565

Please sign in to comment.