Skip to content

Commit 6fec148

Browse files
seismanweiji14
andauthored
CI: Run tests in a single CI job (Ubuntu + Python 3.9) for draft PRs (#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 <23487320+weiji14@users.noreply.github.com>
1 parent 65b099a commit 6fec148

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

.github/workflows/ci_tests.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
push:
88
branches: [ master ]
99
pull_request:
10+
types: [opened, reopened, synchronize, ready_for_review]
1011
paths-ignore:
1112
- 'doc/**'
1213
- '*.md'
@@ -29,6 +30,22 @@ jobs:
2930
matrix:
3031
python-version: [3.7, 3.8, 3.9]
3132
os: [ubuntu-latest, macOS-latest, windows-latest]
33+
# Is it a draft Pull Request (true or false)?
34+
isDraft:
35+
- ${{ github.event.pull_request.draft }}
36+
# Only run one job (Ubuntu + Python 3.9) for draft PRs
37+
exclude:
38+
- os: macOS-latest
39+
isDraft: true
40+
- os: windows-latest
41+
isDraft: true
42+
- os: ubuntu-latest
43+
python-version: 3.7
44+
isDraft: true
45+
- os: ubuntu-latest
46+
python-version: 3.8
47+
isDraft: true
48+
3249
# environmental variables used in coverage
3350
env:
3451
OS: ${{ matrix.os }}

MAINTENANCE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ It is also scheduled to run daily on the *master* branch.
5858

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

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

0 commit comments

Comments
 (0)