Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: only only skip tests if no code changes at all #7061

Merged
merged 5 commits into from
Feb 22, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- synchronize
- ready_for_review
paths:
# Keep the list in sync with the paths defined in the `tests_skipper.yml` workflow
- "haystack/**/*.py"
- "haystack/templates/predefined/*"
- "test/**/*.py"
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/tests_skipper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,40 @@ on:
- synchronize
- ready_for_review
paths-ignore:
# we skip the tests unless the code changes. The problem is that GitHub will run the check anyway if any other
# file outside the code changed (e.g. the release notes). Hence, we need a second filter down below.
# keep the list in sync with the paths defined in the `tests.yml` workflow
- "haystack/**/*.py"
- "haystack/templates/predefined/*"
- "test/**/*.py"
- "test/test_requirements.txt"

jobs:
check_if_changed:
name: Check if changed
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
code_changes: ${{ steps.changes.outputs.code_changes }}
steps:
- uses: actions/checkout@v4
- name: Check for changed code
id: changes
uses: dorny/paths-filter@ebc4d7e9ebcb0b1eb21480bb8f43113e996ac77a
with:
# keep the list in sync with the paths defined in the `tests.yml` workflow
filters: |
code_changes:
- haystack/**/*.py
- "haystack/templates/predefined/*"
- test/**/*.py
- test/test_requirements.txt

catch-all:
# Don't run this check if the PR contains both code and non-code changes (e.g. release notes)
needs: check_if_changed
if: needs.check_if_changed.outputs.code_changes == 'false'
name: Catch-all check
runs-on: ubuntu-latest
steps:
Expand Down