Skip to content

Commit 58d7881

Browse files
authored
ci: Gate manual release workflows on wait-for-checks (#1913)
Here it is - finally, an attempt to adopt `wait-for-checks` action. I started by consolidating all the checks into a single workflow. I think that makes sense: the boundaries between them weren't very well defined, and there's no real need to distinguish them. Now `wait-for-checks` is in place, with `Check*` as the only regex specifying the checks to wait for. Let me know what you think @janbuchar.
1 parent b13af58 commit 58d7881

11 files changed

Lines changed: 163 additions & 162 deletions

.github/workflows/_check_code.yaml

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

.github/workflows/_check_docs.yaml

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

.github/workflows/_check_package.yaml

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

.github/workflows/_checks.yaml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Checks
2+
3+
on:
4+
# Runs when manually triggered from the GitHub UI.
5+
workflow_dispatch:
6+
inputs:
7+
run_tests:
8+
description: Whether to run the unit test suite.
9+
required: false
10+
type: boolean
11+
default: true
12+
13+
# Runs when invoked by another workflow.
14+
workflow_call:
15+
inputs:
16+
run_tests:
17+
description: Whether to run the unit test suite.
18+
required: false
19+
type: boolean
20+
default: true
21+
22+
permissions:
23+
contents: read
24+
25+
jobs:
26+
actions_lint_check:
27+
name: Actions lint check
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v6
32+
- name: Run actionlint
33+
uses: rhysd/actionlint@v1.7.12
34+
35+
spell_check:
36+
name: Spell check
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v6
41+
- name: Check spelling with typos
42+
uses: crate-ci/typos@v1
43+
44+
lint_check:
45+
name: Lint check
46+
uses: apify/workflows/.github/workflows/python_lint_check.yaml@main
47+
with:
48+
python_versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
49+
50+
type_check:
51+
name: Type check
52+
uses: apify/workflows/.github/workflows/python_type_check.yaml@main
53+
with:
54+
python_versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
55+
56+
unit_tests:
57+
name: Unit tests
58+
if: inputs.run_tests
59+
uses: apify/workflows/.github/workflows/python_unit_tests.yaml@main
60+
secrets: inherit
61+
with:
62+
python_versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
63+
operating_systems: '["ubuntu-latest", "windows-latest", "macos-latest"]'
64+
python_version_for_codecov: "3.14"
65+
operating_system_for_codecov: ubuntu-latest
66+
tests_concurrency: "8"
67+
68+
package_check:
69+
name: Package check
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Checkout repository
73+
uses: actions/checkout@v6
74+
75+
- name: Set up uv package manager
76+
uses: astral-sh/setup-uv@v8.1.0
77+
with:
78+
python-version: "3.14"
79+
80+
- name: Build sdist and wheel
81+
run: uv run poe build
82+
83+
- name: Verify built package
84+
uses: apify/actions/python-package-check@v1.1.0
85+
with:
86+
package_name: crawlee
87+
dist_dir: dist
88+
python_version: "3.14"
89+
extras: all
90+
smoke_code: |
91+
from crawlee.crawlers import (
92+
HttpCrawler, BeautifulSoupCrawler, ParselCrawler,
93+
PlaywrightCrawler, AdaptivePlaywrightCrawler,
94+
)
95+
from crawlee.storages import Dataset, KeyValueStore, RequestQueue
96+
from crawlee.http_clients import HttpxHttpClient, ImpitHttpClient
97+
from crawlee import Request
98+
HttpCrawler()
99+
BeautifulSoupCrawler()
100+
ParselCrawler()
101+
102+
doc_check:
103+
name: Doc check
104+
uses: apify/workflows/.github/workflows/python_docs_check.yaml@main

.github/workflows/_tests.yaml

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

.github/workflows/manual_release_beta.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,22 @@ permissions:
1616
contents: read
1717

1818
jobs:
19+
wait_for_checks:
20+
# Gate the release on the `Checks` workflow already succeeding on this commit (run by `on_master.yaml`).
21+
name: Wait for required checks
22+
runs-on: ubuntu-latest
23+
permissions:
24+
checks: read
25+
steps:
26+
- name: Wait for checks
27+
uses: apify/actions/wait-for-checks@v1.2.0
28+
with:
29+
ref: ${{ github.sha }}
30+
check-regexp: '^Checks'
31+
1932
release_prepare:
2033
name: Release prepare
34+
needs: [wait_for_checks]
2135
runs-on: ubuntu-latest
2236
outputs:
2337
version_number: ${{ steps.release_prepare.outputs.version_number }}

.github/workflows/manual_release_docs.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,19 @@ jobs:
2323
contents: write
2424
pages: write
2525
id-token: write
26+
checks: read
2627
runs-on: ubuntu-latest
2728

2829
steps:
30+
# Gate manual dispatches on the `Checks` workflow already succeeding on this commit (run by `on_master.yaml`);
31+
# skipped when called from another workflow. TODO: pin to a tag after apify/workflows#238 is merged.
32+
- name: Wait for checks
33+
if: github.event_name == 'workflow_dispatch'
34+
uses: apify/workflows/wait-for-checks@wait-for-checks-action
35+
with:
36+
ref: ${{ github.sha }}
37+
check-regexp: '^Checks'
38+
2939
- name: Checkout repository
3040
uses: actions/checkout@v6
3141
with:

.github/workflows/manual_release_stable.yaml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,22 @@ permissions:
2929
contents: read
3030

3131
jobs:
32-
code_checks:
33-
name: Code checks
34-
uses: ./.github/workflows/_check_code.yaml
32+
wait_for_checks:
33+
# Gate the release on the `Checks` workflow already succeeding on this commit (run by `on_master.yaml`).
34+
name: Wait for required checks
35+
runs-on: ubuntu-latest
36+
permissions:
37+
checks: read
38+
steps:
39+
- name: Wait for checks
40+
uses: apify/actions/wait-for-checks@v1.2.0
41+
with:
42+
ref: ${{ github.sha }}
43+
check-regexp: '^Checks'
3544

3645
release_prepare:
3746
name: Release prepare
38-
needs: [code_checks]
47+
needs: [wait_for_checks]
3948
runs-on: ubuntu-latest
4049
outputs:
4150
version_number: ${{ steps.release_prepare.outputs.version_number }}

.github/workflows/manual_version_docs.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,18 @@ jobs:
3636
runs-on: ubuntu-latest
3737
permissions:
3838
contents: write
39+
checks: read
3940

4041
steps:
42+
# Gate manual dispatches on the `Checks` workflow already succeeding on this commit (run by `on_master.yaml`);
43+
# skipped when called from another workflow.
44+
- name: Wait for checks
45+
if: github.event_name == 'workflow_dispatch'
46+
uses: apify/actions/wait-for-checks@v1.2.0
47+
with:
48+
ref: ${{ github.sha }}
49+
check-regexp: '^Checks'
50+
4151
- name: Checkout repository
4252
uses: actions/checkout@v6
4353
with:

.github/workflows/on_master.yaml

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,26 @@ permissions:
1111
contents: read
1212

1313
jobs:
14-
doc_checks:
15-
name: Doc checks
16-
uses: ./.github/workflows/_check_docs.yaml
14+
checks:
15+
name: Checks
16+
uses: ./.github/workflows/_checks.yaml
17+
with:
18+
# Skip the test suite for docs-only commits — they don't change runtime behavior.
19+
run_tests: ${{ !startsWith(github.event.head_commit.message, 'docs') }}
20+
secrets: inherit
1721

1822
doc_release:
1923
# Skip this for non-"docs" commits.
2024
if: startsWith(github.event.head_commit.message, 'docs')
2125
name: Doc release
22-
needs: [doc_checks]
26+
needs: [checks]
2327
permissions:
2428
contents: write
2529
pages: write
2630
id-token: write
2731
uses: ./.github/workflows/manual_release_docs.yaml
2832
secrets: inherit
2933

30-
code_checks:
31-
name: Code checks
32-
uses: ./.github/workflows/_check_code.yaml
33-
34-
tests:
35-
# Skip this for "docs" commits.
36-
if: "!startsWith(github.event.head_commit.message, 'docs')"
37-
name: Tests
38-
uses: ./.github/workflows/_tests.yaml
39-
secrets: inherit
40-
4134
# The beta release is dispatched as a separate workflow run (instead of calling `manual_release_beta.yaml` via `uses:`)
4235
# because PyPI's Trusted Publishing does not currently support reusable workflows.
4336
# See: https://docs.pypi.org/trusted-publishers/troubleshooting/#reusable-workflows-on-github
@@ -50,7 +43,7 @@ jobs:
5043
startsWith(github.event.head_commit.message, 'refactor') ||
5144
startsWith(github.event.head_commit.message, 'style')
5245
name: Beta release
53-
needs: [code_checks, tests]
46+
needs: [checks]
5447
runs-on: ubuntu-latest
5548
permissions:
5649
actions: write # Required by execute-workflow.

0 commit comments

Comments
 (0)