Skip to content

Commit

Permalink
CI: Run tests in a single CI job (Ubuntu + Python 3.9) for draft PRs (#…
Browse files Browse the repository at this point in the history
…906)

This PR improves the "Tests" workflow to save CI resources:

- For draft PRs: only run tests on Ubuntu + Python 3.9 (~10 minutes)
- When draft PRs are ready for review, run all CI jobs (9 jobs, 10-30 minutes)
- If converting PRs back to draft mode, pushes still only trigger one job (~10 minutes)
- After merged into master, all 9 jobs will run.

* Update MAINTENANCE.md

Co-authored-by: Wei Ji <[email protected]>
  • Loading branch information
seisman and weiji14 authored Feb 16, 2021
1 parent 65b099a commit 6fec148
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
branches: [ master ]
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
paths-ignore:
- 'doc/**'
- '*.md'
Expand All @@ -29,6 +30,22 @@ jobs:
matrix:
python-version: [3.7, 3.8, 3.9]
os: [ubuntu-latest, macOS-latest, windows-latest]
# Is it a draft Pull Request (true or false)?
isDraft:
- ${{ github.event.pull_request.draft }}
# Only run one job (Ubuntu + Python 3.9) for draft PRs
exclude:
- os: macOS-latest
isDraft: true
- os: windows-latest
isDraft: true
- os: ubuntu-latest
python-version: 3.7
isDraft: true
- os: ubuntu-latest
python-version: 3.8
isDraft: true

# environmental variables used in coverage
env:
OS: ${{ matrix.os }}
Expand Down
2 changes: 2 additions & 0 deletions MAINTENANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ It is also scheduled to run daily on the *master* branch.

This is ran on every commit to the *master* and Pull Request branches.
It is also scheduled to run daily on the *master* branch.
In draft Pull Requests, only one job (Ubuntu + Python latest)
is triggered to save on Continuous Integration resources.

On the *master* branch, the workflow also handles the documentation deployment:

Expand Down

0 comments on commit 6fec148

Please sign in to comment.