Skip to content

Commit

Permalink
[INFRA] Update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
eseiler committed Dec 6, 2024
1 parent 215da66 commit c874687
Show file tree
Hide file tree
Showing 19 changed files with 262 additions and 667 deletions.
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
106 changes: 46 additions & 60 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: CC0-1.0

name: Sharg API-Stability
name: API-Stability

on:
# Will always run on the default branch
Expand All @@ -16,96 +16,82 @@ concurrency:
cancel-in-progress: true

env:
CMAKE_VERSION: 3.16.9
SHARG_NO_VERSION_CHECK: 1
TZ: Europe/Berlin
ISSUE: 146 # Issue number to use for reporting failures

defaults:
run:
shell: bash -exo pipefail {0}
shell: bash -Eeuxo pipefail {0}

jobs:
build:
name: API-Stability gcc${{ matrix.compiler }}
runs-on: ubuntu-22.04
timeout-minutes: 300
name: API-Stability ${{ matrix.compiler }}
runs-on: ubuntu-latest
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
compiler: [11, 12, 13]

compiler: ["gcc-14", "gcc-13", "gcc-12"]
container:
image: ghcr.io/seqan/${{ matrix.compiler }}
volumes:
- /home/runner:/home/runner
steps:
- name: Checkout Sharg
- name: Checkout
uses: actions/checkout@v4
with:
path: sharg
fetch-depth: 1
submodules: true

- name: Setup toolchain
uses: seqan/actions/setup-toolchain@main
with:
compiler: gcc-${{ matrix.compiler }}
ccache_size: 75M

- name: Install CMake
uses: seqan/actions/setup-cmake@main
with:
cmake: 3.16.9

- name: Configure tests
run: |
mkdir sharg-build
cd sharg-build
cmake ../sharg/test/api_stability -DCMAKE_BUILD_TYPE=Release
mkdir build && cd build
cmake ../test/api_stability -DCMAKE_BUILD_TYPE=Release
- name: Build tests
run: |
cd sharg-build
CMAKE_BUILD_PARALLEL_LEVEL=2 cmake --build . -- -k 2>&1 | tee build.log
- name: Setup Python
if: ${{ failure() }}
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Process Log
if: ${{ failure() }}
run: |
FILE="seqan3/.github/ISSUE_TEMPLATE/cron_comment_template.md"
python3 seqan3/.github/workflows/scripts/process_compiler_error_log.py sharg-build/build.log >> $FILE
working-directory: build
run: make -k 2>&1 | tee build.log

- name: Create comment body
if: ${{ failure() }}
if: always()
id: comment-body
run: |
FILE="sharg/.github/ISSUE_TEMPLATE/cron_comment_template.md"
URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
sed -i "s@{{ build }}@${{ matrix.build }}@" $FILE
sed -i "s@{{ compiler }}@${{ matrix.compiler }}@" $FILE
sed -i "s@{{ url }}@$URL@" $FILE
echo "body<<EOF" >> $GITHUB_OUTPUT
cat $FILE >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
if [[ "${{ job.status }}" == "success" ]]; then
echo "body=Success ${{ matrix.build }} on ${{ matrix.compiler }}" >> $GITHUB_OUTPUT
else
FILE=".github/ISSUE_TEMPLATE/cron_comment_template.md"
python3 .github/workflows/scripts/process_compiler_error_log.py build/build.log >> ${FILE}
URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
sed -i "s@{{ build }}@${{ matrix.build }}@" ${FILE}
sed -i "s@{{ compiler }}@${{ matrix.compiler }}@" ${FILE}
sed -i "s@{{ url }}@$URL@" ${FILE}
echo "body<<EOF" >> $GITHUB_OUTPUT
cat ${FILE} >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
fi
- name: Reopen issue
if: ${{ failure() }}
uses: octokit/[email protected]
with:
route: PATCH /repos/{owner}/{repo}/issues/{issue_number}
owner: ${{ github.repository_owner }}
repo: sharg-parser
issue_number: ${{ env.ISSUE }}
state: "open"
if: failure()
run: gh issue reopen ${{ env.ISSUE }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.SEQAN_ACTIONS_PAT }}
GH_REPO: ${{ github.repository }}

- name: Create comment
if: ${{ failure() }}
- name: Find Comment
if: always()
uses: peter-evans/find-comment@v3
id: find_comment
with:
issue-number: ${{ env.ISSUE }}
body-includes: ${{ matrix.build }} on ${{ matrix.compiler }}

- name: Update comment
if: always()
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.find_comment.outputs.comment-id }}
issue-number: ${{ env.ISSUE }}
body: ${{ steps.comment-body.outputs.body }}
edit-mode: replace
token: ${{ secrets.SEQAN_ACTIONS_PAT }}

45 changes: 14 additions & 31 deletions .github/workflows/ci_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,59 +28,42 @@ defaults:
jobs:
build:
name: "External project ${{ contains(matrix.SHARG_NO_TDL, 'OFF') && 'with TDL' || 'without TDL' }}"
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'
strategy:
fail-fast: false
matrix:
SHARG_NO_TDL: [ON, OFF]

container:
image: ghcr.io/seqan/gcc-14
volumes:
- /home/runner:/home/runner
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: sharg-parser
fetch-depth: 1
submodules: true

- name: Install CMake
uses: seqan/actions/setup-cmake@main
with:
cmake: 3.16.9

- name: Setup toolchain
uses: seqan/actions/setup-toolchain@main
with:
compiler: gcc-13

- name: Install dependencies
if: matrix.SHARG_NO_TDL == 'OFF'
run: |
git clone --depth 1 --single-branch --branch 0.8.0 https://github.com/jbeder/yaml-cpp.git
cd yaml-cpp
mkdir build
cd build
cd yaml-cpp && mkdir build && cd build
cmake ../ -DCMAKE_BUILD_TYPE=Debug \
-DYAML_CPP_BUILD_CONTRIB=OFF \
-DYAML_CPP_BUILD_TOOLS=OFF \
-DYAML_BUILD_SHARED_LIBS=OFF \
-DYAML_CPP_INSTALL=ON \
-DYAML_CPP_BUILD_TESTS=OFF \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
make -j2
sudo make install
-DYAML_CPP_BUILD_TESTS=OFF
make install
- name: Configure tests
run: |
mkdir sharg-build
cd sharg-build
cmake ../sharg-parser/test/external_project -DCMAKE_BUILD_TYPE=Debug \
-DSHARG_NO_TDL=${{ matrix.SHARG_NO_TDL }}
make -j2 sharg_test_prerequisite
mkdir build && cd build
cmake ../test/external_project -DCMAKE_BUILD_TYPE=Debug \
-DSHARG_NO_TDL=${{ matrix.SHARG_NO_TDL }}
make -k sharg_test_prerequisite
- name: Build tests
run: |
cd sharg-build
make -k -j2
working-directory: build
run: make -k
102 changes: 49 additions & 53 deletions .github/workflows/ci_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,15 @@ name: Coverage
on:
push:
branches:
# Push events to branches matching refs/heads/main
- 'main'
# Push events to branches matching refs/heads/release*
- 'release*'
# Trigger after PR was unlabeled
pull_request:
types:
- unlabeled
# Enables a manual trigger, may run on any branch
workflow_dispatch:

# Do not cancel on push events
concurrency:
group: coverage-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: false # PRs will be canceled by the clang-format CI
cancel-in-progress: false

env:
SHARG_NO_VERSION_CHECK: 1
Expand All @@ -33,70 +27,72 @@ 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:
path: sharg
fetch-depth: ${{ steps.fetch_depth.outputs.depth }}
fetch-depth: 0
submodules: true

- name: Setup toolchain
uses: seqan/actions/setup-toolchain@main
with:
compiler: ${{ matrix.compiler }}
ccache_size: 125M

- name: Install CMake
uses: seqan/actions/setup-cmake@main
- name: Load ccache
uses: actions/cache@v4
with:
cmake: 3.16.9
path: /home/runner/.ccache
key: ccache-${{ runner.os }}-${{ github.workflow }}-${{ matrix.compiler }}-${{ github.ref }}-${{ github.run_id }}
restore-keys: |
ccache-${{ runner.os }}-${{ github.workflow }}-${{ matrix.compiler }}-${{ github.ref }}
ccache-${{ runner.os }}-${{ github.workflow }}-${{ matrix.compiler }}
- name: Install gcovr
run: |
sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/${CC/gcc/gcov} 100
pip install gcovr==6.0
- name: Increase ccache size
run: echo "CCACHE_MAXSIZE=300M" >> "${GITHUB_ENV}"

- name: Configure tests
run: |
mkdir sharg-build
cd sharg-build
cmake ../sharg/test/${{ matrix.build }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}" \
-DSHARG_VERBOSE_TESTS=OFF \
-DSHARG_COVERAGE_PARALLEL_LEVEL=2
make -j2 gtest_build yaml-cpp
mkdir build && cd build
cmake ../test/coverage -DCMAKE_BUILD_TYPE=Coverage
make gtest_build yaml-cpp
- name: Build tests
env:
CCACHE_IGNOREOPTIONS: "-fprofile-abs-path"
GCOV: ${{ github.workspace }}/sharg/.github/workflows/scripts/gcov.sh
working-directory: build
run: |
ccache -z
cd sharg-build
make -k -j2
ccache -sv
make -k
ccache -svvx
- name: Run tests
working-directory: build
run: ctest . -j --output-on-failure --no-tests=error

- name: Generate coverage report
run: |
gcovr --root ${GITHUB_WORKSPACE}/test/coverage \
${GITHUB_WORKSPACE}/build \
--filter ${GITHUB_WORKSPACE}/include/sharg \
--filter ${GITHUB_WORKSPACE}/test/include/sharg/test \
--exclude ${GITHUB_WORKSPACE}/include/sharg/contrib \
--exclude ${GITHUB_WORKSPACE}/include/sharg/std \
--exclude-lines-by-pattern '^\s*$' \
--exclude-lines-by-pattern '^\s*};$' \
--exclude-unreachable-branches \
--exclude-throw-branches \
--exclude-noncode-lines \
-j \
--cobertura \
--output ${GITHUB_WORKSPACE}/build/coverage_report.xml
- name: Submit coverage build
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v3.1.5
with:
files: ${{ github.workspace }}/sharg-build/sharg_coverage.xml
root_dir: ${{ github.workspace }}/sharg
files: build/coverage_report.xml
fail_ci_if_error: false
2 changes: 1 addition & 1 deletion .github/workflows/ci_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ concurrency:
cancel-in-progress: ${{ github.event_name != 'push' }}

env:
SEQAN3_NO_VERSION_CHECK: 1
SHARG_NO_VERSION_CHECK: 1
TZ: Europe/Berlin

defaults:
Expand Down
Loading

0 comments on commit c874687

Please sign in to comment.