Skip to content

Commit e07bbe8

Browse files
ci: Remove check workflow and filter on branch name (#253)
Removes the check workflow and using it to deduplicate PRs and pushes: CI should be run on all PRs and also on `main` branch: pushes to PRs are already picked up by the pull_request filtering: "By default, a workflow only runs when a pull_request event's activity type is opened, synchronize, or reopened.", the definition of `synchronize` can be found in the documentation: "A pull request's head branch was updated. For example, the head branch was updated from the base branch or new commits were pushed to the head branch." E: TC believes someone at some point wanted CI to run on branches that do not have open PRs, because when a PR is opened he gets notified whether it is draft or not. This does require that now a draft PR is opened for CI to run, but does anyone have a use case for running CI against a branch without even a draft PR?
1 parent 78cabc2 commit e07bbe8

File tree

5 files changed

+28
-49
lines changed

5 files changed

+28
-49
lines changed

.github/workflows/_check.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,19 @@ name: CI
22

33
on:
44
push:
5+
branches:
6+
- main
7+
tags:
8+
- '*'
59
pull_request:
610

711
jobs:
8-
check:
9-
uses: ./.github/workflows/_check.yml
10-
1112
lint:
12-
needs: check
13-
if: needs.check.outputs.branch-pr == ''
1413
uses: ./.github/workflows/_tox.yml
1514
with:
1615
tox: pre-commit
1716

1817
test:
19-
needs: check
20-
if: needs.check.outputs.branch-pr == ''
2118
uses: ./.github/workflows/_test.yml
2219
with:
2320
python-version: dev
@@ -26,8 +23,6 @@ jobs:
2623
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2724

2825
docs:
29-
needs: check
30-
if: needs.check.outputs.branch-pr == ''
3126
uses: ./.github/workflows/_docs.yml
3227
permissions:
3328
contents: write
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# 21. Run CI on pull requests and main branch only
2+
3+
Date: 2025-05-06
4+
5+
## Status
6+
7+
Accepted
8+
9+
## Context
10+
11+
CI has been being run on branches that do not have open pull requests, which has: added spurious jobs to the organisation's compute limit; made workflow definitions more complex; made the results page harder to parse; and allowed known working development branches to become stale or forgotten.
12+
13+
Running CI only on branches that have open pull requests will: reduce compute jobs created for code that is known to not be working; simplify workflow definitions; simplify the CI results page; encourage early creation of pull requests, adding visibility to development.
14+
15+
Draft pull requests will still have CI jobs run, ensuring that code quality is maintained while allowing reviewers to ignore changes that are not ready for human review.
16+
17+
## Decision
18+
19+
CI will only be run on all PRs when changes are made, and on the main branch when PRs are merged into it: not on branches that do not have open PRs.
20+
Opening a draft PR will allow CI to be run, with the understanding that the PR may not be ready for review.
21+
22+
## Consequences
23+
24+
The `check` job will be removed and CI will run on all PRs and on the `main` branch.

template/{% if git_platform=="github.com" %}.github{% endif %}/workflows/_check.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

template/{% if git_platform=="github.com" %}.github{% endif %}/workflows/ci.yml.jinja

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,13 @@ on:
55
pull_request:
66

77
jobs:
8-
check:
9-
uses: ./.github/workflows/_check.yml
108

119
lint:
12-
needs: check
13-
if: needs.check.outputs.branch-pr == ''
1410
uses: ./.github/workflows/_tox.yml
1511
with:
1612
tox: pre-commit,type-checking
1713
{% raw %}
1814
test:
19-
needs: check
20-
if: needs.check.outputs.branch-pr == ''
2115
strategy:
2216
matrix:
2317
runs-on: ["ubuntu-latest"] # can add windows-latest, macos-latest
@@ -35,21 +29,15 @@ jobs:
3529
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
3630
{% endraw %}{% if docker %}
3731
container:
38-
needs: check
39-
if: needs.check.outputs.branch-pr == ''
4032
uses: ./.github/workflows/_container.yml
4133
permissions:
4234
contents: read
4335
packages: write
4436
{% endif %}{% if sphinx %}
4537
docs:
46-
needs: check
47-
if: needs.check.outputs.branch-pr == ''
4838
uses: ./.github/workflows/_docs.yml
4939
{% endif %}
5040
dist:
51-
needs: check
52-
if: needs.check.outputs.branch-pr == ''
5341
uses: ./.github/workflows/_dist.yml
5442
{% if pypi %}
5543
pypi:

0 commit comments

Comments
 (0)