Skip to content

Commit 0cf0521

Browse files
vdusekclaude
andauthored
ci: Improve shared python workflows (#1680)
Workflow improvements: - Update shared workflow input names to snake_case - Add tests_concurrency input for controlling parallel test execution - Use @improve-shared-python-workflows branch for testing Pytest configuration: - Standardize addopts to "-r a --verbose" - Remove --verbose from poe task commands (now in addopts) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 1682ff1 commit 0cf0521

File tree

4 files changed

+37
-16
lines changed

4 files changed

+37
-16
lines changed

.github/workflows/_check_code.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ jobs:
3030
name: Lint check
3131
uses: apify/workflows/.github/workflows/python_lint_check.yaml@main
3232
with:
33-
python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
33+
python_versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
3434

3535
type_check:
3636
name: Type check
3737
uses: apify/workflows/.github/workflows/python_type_check.yaml@main
3838
with:
39-
python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
39+
python_versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'

.github/workflows/_tests.yaml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ jobs:
1111
unit_tests:
1212
name: Unit tests
1313
uses: apify/workflows/.github/workflows/python_unit_tests.yaml@main
14-
secrets:
15-
httpbin_url: ${{ secrets.APIFY_HTTPBIN_TOKEN && format('https://httpbin.apify.actor?token={0}', secrets.APIFY_HTTPBIN_TOKEN) || 'https://httpbin.org' }}
16-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
14+
secrets: inherit
1715
with:
18-
python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
19-
operating-systems: '["ubuntu-latest", "windows-latest", "macos-latest"]'
20-
python-version-for-codecov: "3.14"
21-
operating-system-for-codecov: ubuntu-latest
16+
python_versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
17+
operating_systems: '["ubuntu-latest", "windows-latest", "macos-latest"]'
18+
python_version_for_codecov: "3.14"
19+
operating_system_for_codecov: ubuntu-latest
20+
tests_concurrency: "2"

.github/workflows/on_schedule_tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ concurrency:
1515
env:
1616
NODE_VERSION: 22
1717
PYTHON_VERSION: 3.14
18+
TESTS_CONCURRENCY: 1
1819

1920
jobs:
2021
end_to_end_tests:

pyproject.toml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,10 @@ builtins-ignorelist = ["id"]
217217
known-first-party = ["crawlee"]
218218

219219
[tool.pytest.ini_options]
220-
addopts = "-ra"
220+
addopts = "-r a --verbose"
221221
asyncio_default_fixture_loop_scope = "function"
222222
asyncio_mode = "auto"
223-
timeout = 300
223+
timeout = 1800
224224
markers = [
225225
"run_alone: marks tests that must run in isolation",
226226
]
@@ -277,18 +277,39 @@ shell = "uv run ruff check --fix && uv run ruff format"
277277

278278
[tool.poe.tasks.unit-tests]
279279
shell = """
280-
uv run pytest --numprocesses=1 --verbose -m "run_alone" tests/unit && \
281-
uv run pytest --numprocesses=auto --verbose -m "not run_alone" tests/unit
280+
uv run pytest \
281+
--numprocesses=1 \
282+
-m "run_alone" \
283+
tests/unit && \
284+
uv run pytest \
285+
--numprocesses=${TESTS_CONCURRENCY:-auto} \
286+
-m "not run_alone" \
287+
tests/unit
282288
"""
283289

284290
[tool.poe.tasks.unit-tests-cov]
285291
shell = """
286-
uv run pytest --numprocesses=1 --verbose -m "run_alone" --cov=src/crawlee --cov-report=xml:coverage-unit.xml tests/unit && \
287-
uv run pytest --numprocesses=auto --verbose -m "not run_alone" --cov=src/crawlee --cov-report=xml:coverage-unit.xml --cov-append tests/unit
292+
uv run pytest \
293+
--numprocesses=1 \
294+
-m "run_alone" \
295+
--cov=src/crawlee \
296+
--cov-report=xml:coverage-unit.xml \
297+
tests/unit && \
298+
uv run pytest \
299+
--numprocesses=${TESTS_CONCURRENCY:-auto} \
300+
-m "not run_alone" \
301+
--cov=src/crawlee \
302+
--cov-report=xml:coverage-unit.xml \
303+
--cov-append \
304+
tests/unit
288305
"""
289306

290307
[tool.poe.tasks.e2e-templates-tests]
291-
cmd = "uv run pytest --numprocesses=${E2E_TESTS_CONCURRENCY:-1} --verbose tests/e2e/project_template --timeout=600"
308+
cmd = """
309+
uv run pytest \
310+
--numprocesses=${TESTS_CONCURRENCY:-auto} \
311+
tests/e2e/project_template
312+
"""
292313

293314
[tool.poe.tasks.build-docs]
294315
shell = "./build_api_reference.sh && corepack enable && yarn && yarn build"

0 commit comments

Comments
 (0)