Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# SPDX-FileCopyrightText: 2006-2026, Knut Reinert & Freie Universität Berlin
# SPDX-FileCopyrightText: 2016-2026, Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: CC0-1.0

# Staged CI: cheap checks -> Linux unit tests -> everything else.
# Runs PR code, therefore only `pull_request`: read-only GITHUB_TOKEN, no secrets for fork PRs.
# The only required status check is "CI result" (plus "Documentation", which stays a separate workflow).

name: CI

on:
push:
branches:
- 'main'
pull_request:
workflow_dispatch:

# Replaces the cancel_running_workflows job of the old lint workflow: a new push to a PR cancels all stages.
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name != 'push' }}

permissions:
contents: read

jobs:
# Stage 1
lint:
name: Lint
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/ci_lint.yml
license:
name: License
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/ci_license.yml

# Stage 2
linux:
name: Unit
needs: [lint, license]
uses: ./.github/workflows/ci_linux.yml

# Stage 3
misc:
name: Misc
needs: linux
uses: ./.github/workflows/ci_misc.yml
coverage:
name: Coverage
needs: linux
uses: ./.github/workflows/ci_coverage.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
install:
name: Install
needs: linux
uses: ./.github/workflows/ci_install.yml
macos:
name: macOS
needs: linux
uses: ./.github/workflows/ci_macos.yml
module:
name: Module
needs: linux
uses: ./.github/workflows/ci_module.yml
util:
name: Util
needs: linux
uses: ./.github/workflows/ci_util.yml

# Skipped jobs report "Success" to required checks, and skipped matrix jobs report under their unexpanded names.
# One gate that fails unless every stage succeeded is robust against both.
result:
name: CI result
if: always() && (github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch')
needs: [lint, license, linux, misc, coverage, install, macos, module, util]
runs-on: ubuntu-latest
steps:
- name: Check stage results
env:
RESULTS: ${{ join(needs.*.result, ' ') }}
run: |
for result in ${RESULTS}; do
if [[ ${result} != success ]]; then
echo "::error::Not every CI stage succeeded: ${RESULTS}"
exit 1
fi
done
16 changes: 5 additions & 11 deletions .github/workflows/ci_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,12 @@
name: Coverage

on:
push:
branches:
- 'main'
pull_request:
types:
- unlabeled
workflow_call:
secrets:
CODECOV_TOKEN:
required: false
workflow_dispatch:

concurrency:
group: coverage-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: false

env:
TZ: Europe/Berlin

Expand All @@ -28,7 +22,7 @@ jobs:
build:
runs-on: ubuntu-latest
name: ${{ matrix.compiler }}
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint'
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
Expand Down
71 changes: 33 additions & 38 deletions .github/workflows/ci_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,26 @@
# SPDX-FileCopyrightText: 2016-2026, Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: CC0-1.0

# Builds and tests the documentation. PRs: upload the HTML; docs_preview.yml publishes it from the default branch.
# main: deploy to docs.seqan.de from a separate job, so the server key never shares a job with CMake/Doxygen.
# Stays a separate workflow (not a CI stage) so that the preview appears as soon as this finishes, not after all CI.

name: Documentation

on:
push:
branches:
- 'main'
pull_request_target:
types:
- unlabeled
- closed
pull_request:
workflow_dispatch:

concurrency:
group: documentation-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name != 'push' }}

permissions:
contents: read

env:
TZ: Europe/Berlin

Expand All @@ -29,19 +33,12 @@ jobs:
build:
name: Documentation
runs-on: ubuntu-latest
if: ( github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint' ) && github.event.action != 'closed'
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v7

# pull_request_target does not checkout the merge commit by default
- name: Checkout
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v7
uses: actions/checkout@v7 # locked via actions.lock
with:
ref: "refs/pull/${{ github.event.number }}/merge"
allow-unsafe-pr-checkout: true
persist-credentials: false

- name: Install Doxygen
uses: seqan/actions/setup-doxygen@main
Expand All @@ -57,35 +54,33 @@ jobs:
working-directory: build
run: ctest . -j --output-on-failure --no-tests=error

- name: Deploy Preview
if: github.event_name == 'pull_request_target'
uses: seqan/actions/documentation_deploy_preview@main
- name: Upload documentation
uses: actions/upload-artifact@v7 # locked via actions.lock
with:
deploy_host: ${{ secrets.DEPLOY_HOST }}
deploy_user: ${{ secrets.DEPLOY_USER }}
deploy_ssh_key: ${{ secrets.DEPLOY_SSH_KEY }}
deploy_base_path: ${{ secrets.DEPLOY_PREVIEW_BASE_PATH }}
source_path_user_doc: build/html
token: ${{ secrets.SEQAN_ACTIONS_PAT }}
name: documentation
path: build/html/
retention-days: 7
if-no-files-found: error

- name: Deploy Documentation
if: github.event_name == 'push'
deploy:
name: Deploy Documentation
needs: build
if: github.repository_owner == 'seqan' && github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment: server-deploy # deployment branch: main; holds the server key
steps:
- name: Download documentation
uses: actions/download-artifact@v8 # locked via actions.lock
with:
name: documentation
path: html

# Plain rsync with a pinned host key (no third-party deploy action): the key grants the whole server.
- name: Deploy
uses: seqan/actions/documentation_deploy_production@main
with:
deploy_host: ${{ secrets.DEPLOY_HOST }}
deploy_user: ${{ secrets.DEPLOY_USER }}
deploy_ssh_key: ${{ secrets.DEPLOY_SSH_KEY }}
source_path_user_doc: build/html/
source_path_user_doc: html/
deploy_path_user_doc: ${{ secrets.DEPLOY_PRODUCTION_BASE_PATH }}/main
delete:
name: Delete Preview
runs-on: ubuntu-latest
if: github.repository_owner == 'seqan' && github.event_name == 'pull_request_target' && github.event.action == 'closed'
steps:
- name: Delete Preview
uses: seqan/actions/documentation_delete_preview@main
with:
deploy_host: ${{ secrets.DEPLOY_HOST }}
deploy_user: ${{ secrets.DEPLOY_USER }}
deploy_ssh_key: ${{ secrets.DEPLOY_SSH_KEY }}
deploy_base_path: ${{ secrets.DEPLOY_PREVIEW_BASE_PATH }}
13 changes: 2 additions & 11 deletions .github/workflows/ci_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,9 @@
name: Install

on:
push:
branches:
- 'main'
pull_request:
types:
- unlabeled
workflow_call:
workflow_dispatch:

concurrency:
group: install-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name != 'push' }}

env:
TZ: Europe/Berlin
CPM_USE_LOCAL_PACKAGES: ON
Expand All @@ -30,7 +21,7 @@ jobs:
build:
runs-on: ubuntu-latest
name: gcc-latest
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint'
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch'
container:
image: ghcr.io/seqan/gcc-latest
steps:
Expand Down
13 changes: 2 additions & 11 deletions .github/workflows/ci_license.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,17 @@
name: License

on:
push:
branches:
- 'main'
pull_request:
types:
- unlabeled
workflow_call:
workflow_dispatch:

concurrency:
group: license-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name != 'push' }}

env:
TZ: Europe/Berlin

jobs:
check:
name: REUSE Compliance
runs-on: ubuntu-latest
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint'
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout
uses: actions/checkout@v7
Expand Down
48 changes: 22 additions & 26 deletions .github/workflows/ci_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,42 @@
# SPDX-FileCopyrightText: 2016-2026, Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: CC0-1.0

# Check only. If formatting is needed, this job fails, the CI run ends early (later stages are skipped), and
# lint_autofix.yml pushes the formatting commit, which starts a new CI run.

name: Lint

on:
pull_request_target:
workflow_call:

env:
TZ: Europe/Berlin
permissions:
contents: read

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

jobs:
# Cancel other workflows that are dependent on this workflow by adding jobs that have the same concurrency group.
cancel_running_workflows:
name: Cancel ${{ matrix.workflow}}
strategy:
fail-fast: false
matrix:
workflow: ["linux", "macos", "misc", "coverage", "install", "util", "documentation"]
concurrency:
group: ${{ matrix.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- name: "Cancel ${{ matrix.workflow }}"
run: echo "Cancelling ${{ matrix.workflow }}"
lint:
name: Lint
concurrency:
group: lint-${{ github.event.pull_request.number }}
cancel-in-progress: true
needs: cancel_running_workflows
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Run lint
- name: Checkout
uses: actions/checkout@v7 # locked via actions.lock
with:
fetch-depth: 0
persist-credentials: false

- name: Format
uses: seqan/actions/lint@main
with:
clang_format: 18
token: ${{ secrets.SEQAN_ACTIONS_PAT }}
gpg_key: ${{ secrets.SEQAN_ACTIONS_GPG_KEY }}
gpg_passphrase: ${{ secrets.SEQAN_ACTIONS_GPG_PASSPHRASE }}
base: ${{ github.event.pull_request.base.sha || github.event.before || 'HEAD~1' }}

- name: Check
run: |
if ! git diff --quiet; then
{ echo '### Formatting required'; echo '```diff'; git diff; echo '```'; } >> "${GITHUB_STEP_SUMMARY}"
echo "::error::Formatting required. The bot pushes a fix if the PR allows edits by maintainers."
exit 1
fi
13 changes: 2 additions & 11 deletions .github/workflows/ci_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,9 @@
name: Unit

on:
push:
branches:
- 'main'
pull_request:
types:
- unlabeled
workflow_call:
workflow_dispatch:

concurrency:
group: linux-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name != 'push' }}

env:
TZ: Europe/Berlin

Expand All @@ -28,7 +19,7 @@ jobs:
build:
runs-on: ubuntu-latest
name: ${{ matrix.compiler }}
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint'
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
Expand Down
Loading
Loading