Skip tests on documentation-only changes (#3727)

Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
GuySten 2026-01-15 07:24:07 +02:00 committed by GitHub
parent 7861adf53b
commit 179048b801
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,4 +1,4 @@
name: CI
name: Tests and Coverage
on:
# allows us to run workflows manually
@ -21,7 +21,25 @@ env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
filter-changes:
runs-on: ubuntu-latest
outputs:
source_changed: ${{ steps.filter.outputs.source_changed }}
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Examine changed files
id: filter
uses: dorny/paths-filter@668c092af3649c4b664c54e4b704aa46782f6f7c # latest master commit, not released yet
with:
filters: |
source_changed:
- '!docs/**'
- '!**/*.md'
predicate-quantifier: 'every'
main:
needs: filter-changes
if: ${{ needs.filter-changes.outputs.source_changed == 'true' }}
runs-on: ubuntu-22.04
strategy:
matrix:
@ -205,12 +223,33 @@ jobs:
flag-name: C++ and Python
path-to-lcov: coverage.lcov
finish:
needs: main
coverage:
needs: [filter-changes, main]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
if: ${{ needs.filter-changes.outputs.source_changed == 'true' }}
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
ci-pass:
needs: [filter-changes, main, coverage]
name: Check CI status
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Check CI status
run: |
if [[ "${{ needs.filter-changes.outputs.source_changed }}" == "false" ]]; then
echo "Documentation-only change - CI skipped successfully"
exit 0
fi
if [[ "${{ needs.main.result }}" == "success" && "${{ needs.coverage.result }}" == "success" ]]; then
echo "CI passed"
exit 0
fi
echo "CI failed"
exit 1