Skip to content

Commit 0eb9422

Browse files
authored
ci: Gate manual release workflows on wait-for-checks (#70)
## Summary Ports the CI consolidation and `wait-for-checks` adoption from `crawlee-python` to `apify-shared-python`. See [apify/crawlee-python#1913](apify/crawlee-python#1913) for the original rationale and PR description; the follow-up permission fixes from [#1914](apify/crawlee-python#1914) and [#1915](apify/crawlee-python#1915) are referenced for completeness (this repo has no docs workflows so no extra permission grants are needed). Two commits: 1. **Consolidate check workflows into a single Checks workflow** — merges `_check_code.yaml`, `_check_package.yaml`, and `_tests.yaml` into a single `_checks.yaml`. Every check now carries the shared `Checks /` prefix. `unit_tests` is gated on a `run_tests` input so `on_master.yaml` can keep skipping tests for `ci`/`docs` commits. 2. **Gate manual release workflows on wait-for-checks** — replaces the inline `code_checks` / `tests` jobs in `manual_release_stable.yaml` and `manual_release_beta.yaml` with an `apify/actions/wait-for-checks@v1.2.0` step that verifies the `Checks` workflow already passed on the dispatch commit (it runs via `on_master.yaml` on every push).
1 parent dc15e81 commit 0eb9422

8 files changed

Lines changed: 129 additions & 122 deletions

File tree

.github/workflows/_check_code.yaml

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

.github/workflows/_check_package.yaml

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

.github/workflows/_checks.yaml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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.9
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+
with:
61+
python_versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
62+
operating_systems: '["ubuntu-latest", "windows-latest"]'
63+
tests_concurrency: "1"
64+
# Codecov inputs omitted - apify-shared-python doesn't use codecov.
65+
66+
package_check:
67+
name: Package check
68+
runs-on: ubuntu-latest
69+
steps:
70+
- name: Checkout repository
71+
uses: actions/checkout@v6
72+
73+
- name: Set up uv package manager
74+
uses: astral-sh/setup-uv@v8.1.0
75+
with:
76+
python-version: "3.14"
77+
78+
- name: Build sdist and wheel
79+
run: uv run poe build
80+
81+
- name: Verify built package
82+
uses: apify/actions/python-package-check@v1.1.0
83+
with:
84+
package_name: apify_shared
85+
dist_dir: dist
86+
python_version: "3.14"
87+
smoke_code: |
88+
from apify_shared.consts import WebhookEventType

.github/workflows/_tests.yaml

Lines changed: 0 additions & 18 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_stable.yaml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,22 @@ concurrency:
2626
cancel-in-progress: false
2727

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

3742
release_prepare:
3843
name: Release prepare
39-
needs: [code_checks, tests]
44+
needs: [wait_for_checks]
4045
runs-on: ubuntu-latest
4146
outputs:
4247
version_number: ${{ steps.release_prepare.outputs.version_number }}

.github/workflows/on_master.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ on:
88
- "**" # Ignore all tags to avoid duplicate executions triggered by tag pushes.
99

1010
jobs:
11-
code_checks:
12-
name: Code checks
13-
uses: ./.github/workflows/_check_code.yaml
14-
15-
tests:
16-
# Skip this for "ci" and "docs" commits.
17-
if: "!startsWith(github.event.head_commit.message, 'ci') && !startsWith(github.event.head_commit.message, 'docs')"
18-
name: Tests
19-
uses: ./.github/workflows/_tests.yaml
11+
checks:
12+
name: Checks
13+
uses: ./.github/workflows/_checks.yaml
14+
with:
15+
# Skip the test suite for "ci" and "docs" commits — they don't change runtime behavior.
16+
run_tests: >-
17+
${{
18+
!startsWith(github.event.head_commit.message, 'ci') &&
19+
!startsWith(github.event.head_commit.message, 'docs')
20+
}}
2021
2122
# The beta release is dispatched as a separate workflow run (instead of calling `manual_release_beta.yaml` via `uses:`)
2223
# because PyPI's Trusted Publishing does not currently support reusable workflows.
@@ -25,7 +26,7 @@ jobs:
2526
# Skip this for "ci", "docs" and "test" commits and for forks.
2627
if: "!startsWith(github.event.head_commit.message, 'ci') && !startsWith(github.event.head_commit.message, 'docs') && !startsWith(github.event.head_commit.message, 'test') && startsWith(github.repository, 'apify/')"
2728
name: Beta release
28-
needs: [code_checks, tests]
29+
needs: [checks]
2930
runs-on: ubuntu-latest
3031
permissions:
3132
actions: write # Required by execute-workflow.

.github/workflows/on_pull_request.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ jobs:
1313
env:
1414
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1515

16-
code_checks:
17-
name: Code checks
18-
uses: ./.github/workflows/_check_code.yaml
19-
20-
package_check:
21-
name: Package check
22-
uses: ./.github/workflows/_check_package.yaml
23-
24-
tests:
25-
name: Tests
26-
uses: ./.github/workflows/_tests.yaml
16+
checks:
17+
name: Checks
18+
uses: ./.github/workflows/_checks.yaml

0 commit comments

Comments
 (0)