Skip to content

Commit 9d511c5

Browse files
authored
Only run install and dependency tests on merge (#505)
## Problem Making changes in this repository sometimes feels slow because of the amount of tests triggered on every push. Many tests, especially checking the dependency matrix, are unlikely to fail unless dependencies have changed so we can run them less often when certain specific conditions are met. ## Solution - Instead of testing install and the dependency matrix on every push on a PR in progress, refactor github workflows to only run these (`testing-install.yaml`, and `testing-dependency.yaml`) when pushing to a branch where work is being integrated (e.g. `main` or `release-candidate/*`). - Add an additional PR workflow that only triggers when `pyproject.toml` or `poetry.lock` are modified. When dependencies are changed, we do need to run the entire dependency testing matrix. ## Type of Change - [x] Infrastructure change (CI configs, etc)
1 parent 79ec79b commit 9d511c5

File tree

6 files changed

+77
-34
lines changed

6 files changed

+77
-34
lines changed

.github/workflows/pr.yaml renamed to .github/workflows/on-merge.yaml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,10 @@
1-
name: Pull Request
1+
name: Testing (main)
22

33
on:
4-
pull_request:
5-
paths-ignore:
6-
- 'docs/**'
7-
- '*.md'
8-
- '*.rst'
9-
- '*.txt'
10-
- '*.html'
11-
- '*.css'
12-
- '*.js'
13-
- '*.png'
14-
- '*.jpg'
15-
- '*.jpeg'
16-
- '*.gif'
17-
- '*.svg'
18-
- '*.example'
194
push:
205
branches:
216
- main
7+
- release-candidate/*
228
paths-ignore:
239
- 'docs/**'
2410
- '*.md'
@@ -35,13 +21,15 @@ on:
3521
- '*.example'
3622
workflow_dispatch: {}
3723

24+
permissions: {}
25+
3826
concurrency:
3927
group: 'ci-${{ github.workflow }}-${{ github.ref }}'
4028
cancel-in-progress: true
4129

4230
jobs:
4331
linting:
44-
uses: './.github/workflows/lint.yaml'
32+
uses: './.github/workflows/testing-lint.yaml'
4533

4634
unit-tests:
4735
uses: './.github/workflows/testing-unit.yaml'
@@ -57,7 +45,7 @@ jobs:
5745
secrets: inherit
5846
needs: unit-tests
5947

60-
testing-install:
48+
install-tests:
6149
uses: './.github/workflows/testing-install.yaml'
6250
secrets: inherit
6351

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Testing (PR - Dependency Change)
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'pyproject.toml'
7+
- 'poetry.lock'
8+
workflow_dispatch: {}
9+
10+
permissions: {}
11+
12+
concurrency:
13+
group: 'ci-${{ github.workflow }}-${{ github.ref }}'
14+
cancel-in-progress: true
15+
16+
jobs:
17+
dependency-tests:
18+
uses: './.github/workflows/testing-dependency.yaml'
19+
secrets: inherit

.github/workflows/on-pr.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Testing (PR)
2+
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- 'docs/**'
7+
- '*.md'
8+
- '*.rst'
9+
- '*.txt'
10+
- '*.html'
11+
- '*.css'
12+
- '*.js'
13+
- '*.png'
14+
- '*.jpg'
15+
- '*.jpeg'
16+
- '*.gif'
17+
- '*.svg'
18+
- '*.example'
19+
workflow_dispatch: {}
20+
21+
permissions: {}
22+
23+
concurrency:
24+
group: 'ci-${{ github.workflow }}-${{ github.ref }}'
25+
cancel-in-progress: true
26+
27+
jobs:
28+
linting:
29+
uses: './.github/workflows/testing-lint.yaml'
30+
31+
unit-tests:
32+
uses: './.github/workflows/testing-unit.yaml'
33+
secrets: inherit
34+
35+
integration-tests:
36+
uses: './.github/workflows/testing-integration.yaml'
37+
secrets: inherit
38+
needs: unit-tests

.github/workflows/alpha-release.yaml renamed to .github/workflows/release-dev.yaml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,11 @@ on:
2323
type: string
2424
default: 'rc1'
2525

26+
permissions:
27+
contents: write
2628
jobs:
27-
# unit-tests:
28-
# uses: './.github/workflows/testing-unit.yaml'
29-
# secrets: inherit
30-
# integration-tests:
31-
# uses: './.github/workflows/testing-integration.yaml'
32-
# secrets: inherit
33-
# dependency-tests:
34-
# uses: './.github/workflows/testing-dependency.yaml'
35-
# secrets: inherit
36-
3729
pypi:
3830
uses: './.github/workflows/publish-to-pypi.yaml'
39-
# needs:
40-
# - unit-tests
41-
# - integration-tests
42-
# - dependency-tests
4331
with:
4432
isPrerelease: true
4533
ref: ${{ inputs.ref }}

.github/workflows/release.yaml renamed to .github/workflows/release-prod.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ on:
1818
- 'minor' # new features, backwards compatible
1919
- 'major' # breaking changes
2020

21+
permissions:
22+
contents: write
23+
2124
jobs:
2225
unit-tests:
2326
uses: './.github/workflows/testing-unit.yaml'
@@ -28,13 +31,18 @@ jobs:
2831
dependency-tests:
2932
uses: './.github/workflows/testing-dependency.yaml'
3033
secrets: inherit
34+
needs: unit-tests
35+
install-tests:
36+
uses: './.github/workflows/testing-install.yaml'
37+
secrets: inherit
3138

3239
pypi:
3340
uses: './.github/workflows/publish-to-pypi.yaml'
34-
needs:
41+
needs:
3542
- unit-tests
3643
- integration-tests
3744
- dependency-tests
45+
- install-tests
3846
with:
3947
isPrerelease: false
4048
ref: ${{ inputs.ref }}
@@ -48,5 +56,5 @@ jobs:
4856
docs-publish:
4957
uses: './.github/workflows/build-and-publish-docs.yaml'
5058
secrets: inherit
51-
needs:
59+
needs:
5260
- pypi

.github/workflows/lint.yaml renamed to .github/workflows/testing-lint.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: "Lint"
22
on:
33
workflow_call: {}
44

5+
permissions: {}
6+
57
jobs:
68
lint:
79
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)