Only run the full test suite if required files are touched. This prevents the whole workflow from running for meta/readme changes

Same for CodeQL and python files

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
pull/4852/head
Adam Warner 2 years ago
parent 8f7f92cd23
commit 0676f38978
No known key found for this signature in database
GPG Key ID: 872950F3ECF2B173

@ -13,7 +13,28 @@ on:
- cron: '32 11 * * 6'
jobs:
# JOB to run change detection
changes:
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
python: ${{ steps.filter.outputs.python }}
steps:
-
name: Checkout Repo
uses: actions/checkout@v3.0.2
-
name: Check which files have been touched
uses: dorny/paths-filter@v2.10.2
id: filter
with:
filters: |
python:
- 'test/*.py'
analyze:
needs: changes
if: ${{ needs.changes.outputs.python == 'true' }}
name: Analyze
runs-on: ubuntu-latest

@ -17,10 +17,10 @@ jobs:
steps:
-
name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v3.0.2
-
name: Check which files have been touched
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v2.10.2
id: filter
with:
filters: |
@ -31,6 +31,7 @@ jobs:
- 'test/**'
- 'gravity.sh'
- 'pihole'
- '.github/workflows/test.yml'
smoke-tests:
if: github.event.pull_request.draft == false
@ -62,7 +63,7 @@ jobs:
distro-test:
needs: [ smoke-tests, changes ]
if: ${{ github.event.pull_request.draft == false && needs.changes.outputs.requires-distro-test == 'true' }}
if: ${{ github.event.pull_request.draft == false }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
@ -73,15 +74,23 @@ jobs:
steps:
-
name: Checkout repository
if: ${{ needs.changes.outputs.requires-distro-test == 'true' }}
uses: actions/checkout@v3.0.2
-
name: Set up Python 3.8
if: ${{ needs.changes.outputs.requires-distro-test == 'true' }}
uses: actions/setup-python@v4.1.0
with:
python-version: 3.8
-
name: Install dependencies
if: ${{ needs.changes.outputs.requires-distro-test == 'true' }}
run: pip install -r test/requirements.txt
-
name: Test with tox
if: ${{ needs.changes.outputs.requires-distro-test == 'true' }}
run: tox -c test/tox.${DISTRO}.ini
-
name: Passed with nothing to do
if: ${{ needs.changes.outputs.requires-distro-test == 'false' }}
run: echo "Nothing to test!"

Loading…
Cancel
Save