CI: don't run duplicate tests on PRs

Use skip-duplicate-actions to avoid re-running
tests if code hasn't changed. (Also avoids running
tests twice on push that opens a PR.)
This commit is contained in:
medmunds
2021-01-25 14:13:50 -08:00
committed by Mike Edmunds
parent 614eb9e5ce
commit a522fb9f60

View File

@@ -3,6 +3,7 @@ name: test
on: on:
push: push:
pull_request: pull_request:
workflow_dispatch:
schedule: schedule:
# Weekly build (on branch main) every Thursday at 12:00 UTC. # Weekly build (on branch main) every Thursday at 12:00 UTC.
# (Used to monitor compatibility with ESP APIs and other dependencies.) # (Used to monitor compatibility with ESP APIs and other dependencies.)
@@ -10,9 +11,27 @@ on:
jobs: jobs:
skip_duplicate_runs:
# Avoid running the tests twice on the same code
# (particularly live integration tests that eat up ESP test quota)
runs-on: ubuntu-18.04
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
# uses: fkirc/skip-duplicate-actions@v3.3.0
uses: fkirc/skip-duplicate-actions@ea548f2a2a08c55dcb111418ca62181f7887e297
with:
concurrent_skipping: "same_content"
skip_after_successful_duplicate: "true"
cancel_others: "true"
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
test: test:
name: ${{ matrix.config.tox }} ${{ matrix.config.options }} name: ${{ matrix.config.tox }} ${{ matrix.config.options }}
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
needs: skip_duplicate_runs
if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }}
timeout-minutes: 15 timeout-minutes: 15
strategy: strategy:
fail-fast: false fail-fast: false