Skip to content

Commit 7c6b63a

Browse files
authored
ci: use shared workflows and refactor them (#272)
- Use shared workflows and refactor them (apify/workflows#129). - Use the same setup we had in Crawlee before the automatic changelog - https://github.com/apify/crawlee-python/tree/c533a39c5e9ee80c3a333dd76cf9a4dd26061c95. - Currently, we are missing something here... Also, the transition to the automatic changelogs should be smoother. - Rm tests from `pre-commit` - Add `asyncio_default_fixture_loop_scope` to pytest options - Install Poetry to setup-python environment.
1 parent 2ec7cb0 commit 7c6b63a

16 files changed

+178
-187
lines changed
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
name: Check async docstrings
1+
name: Async docstrings check
22

33
on:
44
workflow_call:
55

6+
env:
7+
PYTHON_VERSION: 3.12
8+
69
jobs:
7-
check_async_docstrings:
8-
name: Check whether doctrings for async methods are up-to-date
10+
async_docstring_check:
11+
name: Async docstrings check
912
runs-on: ubuntu-latest
1013

1114
steps:
@@ -15,12 +18,12 @@ jobs:
1518
- name: Set up Python
1619
uses: actions/setup-python@v5
1720
with:
18-
python-version: 3.8
21+
python-version: ${{ env.PYTHON_VERSION }}
1922

2023
- name: Install dependencies
2124
run: |
22-
pipx install poetry
25+
pipx install --python ${{ env.PYTHON_VERSION }} poetry
2326
make install-dev
2427
25-
- name: Check async docstrings
28+
- name: Run async docstrings check
2629
run: make check-async-docstrings
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
name: Check package version availability
1+
name: Changelog entry check
22

33
on:
44
workflow_call:
55

6+
env:
7+
PYTHON_VERSION: 3.12
8+
69
jobs:
7-
check_version_availability:
8-
name: Check version availability
10+
check_changelog_entry:
11+
name: Changelog entry check
912
runs-on: ubuntu-latest
1013
if: (!startsWith(github.event.pull_request.title, 'docs:'))
1114

@@ -16,12 +19,12 @@ jobs:
1619
- name: Set up Python
1720
uses: actions/setup-python@v5
1821
with:
19-
python-version: "3.8"
22+
python-version: ${{ env.PYTHON_VERSION }}
2023

2124
- name: Install dependencies
2225
run: |
23-
pipx install poetry
26+
pipx install --python ${{ env.PYTHON_VERSION }} poetry
2427
make install-dev
2528
26-
- name: Check version availability
27-
run: make check-version-availability
29+
- name: Run changelog entry check
30+
run: make check-changelog-entry
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Version conflict check
2+
3+
on:
4+
workflow_call:
5+
6+
env:
7+
PYTHON_VERSION: 3.12
8+
9+
jobs:
10+
check_version_conflict:
11+
name: Version conflict check
12+
runs-on: ubuntu-latest
13+
if: (!startsWith(github.event.pull_request.title, 'docs:'))
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ env.PYTHON_VERSION }}
23+
24+
- name: Install dependencies
25+
run: |
26+
pipx install --python ${{ env.PYTHON_VERSION }} poetry
27+
make install-dev
28+
29+
- name: Run version conflict check
30+
run: make check-version-conflict

.github/workflows/docs.yaml renamed to .github/workflows/build_and_deploy_docs.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- master
77
workflow_dispatch:
88

9+
env:
10+
NODE_VERSION: 20
11+
PYTHON_VERSION: 3.12
12+
913
jobs:
1014
build_and_deploy_docs:
1115
environment:
@@ -22,14 +26,14 @@ jobs:
2226
with:
2327
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
2428

25-
- name: Set up Node.js
29+
- name: Set up Node
2630
uses: actions/setup-node@v4
2731
with:
28-
node-version: 18
32+
node-version: ${{ env.NODE_VERSION }}
2933
cache: npm
3034
cache-dependency-path: website/package-lock.json
3135

32-
- name: Install Node.js dependencies
36+
- name: Install Node dependencies
3337
run: |
3438
npm install
3539
npm update @apify/docs-theme
@@ -48,11 +52,11 @@ jobs:
4852
- name: Set up Python
4953
uses: actions/setup-python@v5
5054
with:
51-
python-version: 3.8
55+
python-version: ${{ env.PYTHON_VERSION }}
5256

53-
- name: Install dependencies
57+
- name: Install Python dependencies
5458
run: |
55-
pipx install poetry
59+
pipx install --python ${{ env.PYTHON_VERSION }} poetry
5660
make install-dev
5761
5862
- name: Build generated API reference

.github/workflows/integration_tests.yaml

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

.github/workflows/lint_and_type_checks.yaml

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

.github/workflows/run_checks.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Run code checks
2+
3+
on:
4+
# Trigger code checks on opening a new pull request.
5+
# Secrets are only made available to the integration tests job, with a manual approval
6+
# step required for PRs from forks. This prevents their potential exposure.
7+
pull_request:
8+
9+
jobs:
10+
lint_check:
11+
name: Lint check
12+
uses: apify/workflows/.github/workflows/python_lint_check.yaml@main
13+
14+
type_check:
15+
name: Type check
16+
uses: apify/workflows/.github/workflows/python_type_check.yaml@main
17+
18+
unit_tests:
19+
name: Unit tests
20+
uses: apify/workflows/.github/workflows/python_unit_tests.yaml@main
21+
22+
async_docstrings:
23+
name: Async dostrings check
24+
uses: ./.github/workflows/_async_docstrings_check.yaml
25+
26+
# TODO: remove this once https://github.com/apify/apify-sdk-python/issues/241 is resolved
27+
changelog_entry_check:
28+
name: Changelog entry check
29+
uses: ./.github/workflows/_changelog_entry_check.yaml
30+
31+
# TODO: remove this once https://github.com/apify/apify-sdk-python/issues/241 is resolved
32+
version_conflict_check:
33+
name: Version conflict check
34+
uses: ./.github/workflows/_version_conflict_check.yaml
35+
36+
docs_check:
37+
name: Docs check
38+
uses: apify/workflows/.github/workflows/python_docs_check.yaml@main
39+
40+
integration_tests:
41+
name: Integration tests
42+
needs: [lint_check, type_check, unit_tests]
43+
uses: apify/workflows/.github/workflows/python_integration_tests.yaml@main
44+
secrets: inherit

0 commit comments

Comments
 (0)