80 lines
2.7 KiB
YAML
80 lines
2.7 KiB
YAML
name: '🚦 CI'
|
|
|
|
# Single orchestrator. This is the only workflow that triggers on push/PR.
|
|
# It decides which reusable sub-workflows to run and in what order:
|
|
# changes ─┬─> docker (only if the Dockerfile/requirements changed) ─┬─> test
|
|
# │ └─> docs
|
|
# When the builder image is rebuilt it MUST finish (and push) before test/docs
|
|
# run, so they validate against the fresh image.
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- develop
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- develop
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
# Detect which parts of the repo changed in this push/PR.
|
|
changes:
|
|
runs-on: linux/amd64
|
|
# Runs in the builder image because the host has no Node, which the
|
|
# JS-based checkout/paths-filter actions require.
|
|
container:
|
|
image: gitea.tourolle.paris/dtourolle/kpnpp-builder:latest
|
|
outputs:
|
|
dockerfile: ${{ steps.filter.outputs.dockerfile }}
|
|
code: ${{ steps.filter.outputs.code }}
|
|
docs: ${{ steps.filter.outputs.docs }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Detect changed paths
|
|
id: filter
|
|
uses: dorny/paths-filter@v3
|
|
with:
|
|
filters: |
|
|
dockerfile:
|
|
- 'Dockerfile.builder'
|
|
- 'docs/requirements.txt'
|
|
docs:
|
|
- 'docs/**'
|
|
- 'mkdocs.yml'
|
|
- 'examples/**/*.cpp'
|
|
code:
|
|
- 'src/**'
|
|
- 'include/**'
|
|
- 'tests/**'
|
|
- 'examples/**'
|
|
- 'python/**'
|
|
- 'CMakeLists.txt'
|
|
- '**/*.cpp'
|
|
- '**/*.hpp'
|
|
- '**/*.h'
|
|
|
|
# Rebuild the builder image first, but only when it actually changed.
|
|
# On pull requests we build to validate the Dockerfile but do not push.
|
|
docker:
|
|
needs: changes
|
|
if: ${{ needs.changes.outputs.dockerfile == 'true' }}
|
|
uses: ./.gitea/workflows/docker.yaml
|
|
with:
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
# Runs after docker (if docker ran). A skipped docker job is fine; a failed
|
|
# one blocks this via !failure(). Re-run tests when code OR the image changed.
|
|
test:
|
|
needs: [changes, docker]
|
|
if: ${{ !failure() && !cancelled() && (needs.changes.outputs.code == 'true' || needs.changes.outputs.dockerfile == 'true') }}
|
|
uses: ./.gitea/workflows/test.yaml
|
|
|
|
docs:
|
|
needs: [changes, docker]
|
|
if: ${{ !failure() && !cancelled() && github.ref == 'refs/heads/master' && (needs.changes.outputs.docs == 'true' || needs.changes.outputs.dockerfile == 'true') }}
|
|
uses: ./.gitea/workflows/docs.yaml
|
|
secrets: inherit
|