Skip to content
Merged
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
35 changes: 33 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,29 @@ concurrency:
permissions: {}

jobs:
changes:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: filter
with:
filters: |
code:
- '.github/workflows/ci.yaml'
- 'src/**'
- 'tests/**'
- 'pyproject.toml'
- 'uv.lock'
- '.test_durations'

pre-commit:
runs-on: ubuntu-latest
permissions:
Expand All @@ -29,6 +52,8 @@ jobs:
SKIP: uv-lock

tests:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -53,10 +78,16 @@ jobs:

ci:
if: always()
needs: [pre-commit, tests]
needs: [changes, pre-commit, tests]
runs-on: ubuntu-latest
steps:
# tests is skipped when no code paths changed, which must still pass the
# branch ruleset's required `ci` check.
- name: Check required jobs
run: |
test "${{ needs.changes.result }}" = success
test "${{ needs.pre-commit.result }}" = success
test "${{ needs.tests.result }}" = success
case "${{ needs.tests.result }}" in
success | skipped) ;;
*) exit 1 ;;
esac
Loading