Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/python_docs_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ name: Docs check

on:
workflow_call:
secrets:
APIFY_SIGNING_TOKEN:
description: Token for signing Apify packages.
required: false
inputs:
python_version:
description: Python version to use for building docs.
required: false
type: string
default: "3.14" # The newest Python version.
default: "3.14"
node_version:
description: Node.js version to use for building docs.
required: false
type: string
default: "20"
Expand Down
40 changes: 25 additions & 15 deletions .github/workflows/python_integration_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,27 @@ on:
description: Apify API token for a secondary test user, used in multi-user scenarios (e.g. sharing restricted storage).
required: false
CODECOV_TOKEN:
required: false
description: Token for uploading coverage reports to Codecov.
required: false
inputs:
python-versions:
python_versions:
description: List of Python versions to be used (stringified JSON array).
required: true
type: string
operating-systems:
description: List of operating systems to be used.
operating_systems:
description: List of operating systems to be used (stringified JSON array).
required: true
type: string
python-version-for-codecov:
description: Python version to be used for codecov upload.
required: true
python_version_for_codecov:
description: Python version to use for codecov upload. Leave empty to skip codecov.
required: false
type: string
operating-system-for-codecov:
description: Operating system to be used for codecov upload.
required: true
default: ""
operating_system_for_codecov:
description: Operating system to use for codecov upload. Leave empty to skip codecov.
required: false
type: string
default: ""
install_command:
description: Command to install Python dependencies.
required: false
Expand All @@ -39,6 +41,11 @@ on:
required: false
type: string
default: uv run poe integration-tests-cov
tests_concurrency:
description: Number of parallel test processes. Uses pytest-xdist numprocesses value.
required: false
type: string
default: auto

# Concurrency control to ensure only one instance of this workflow runs at a time.
# This avoids exceeding API usage limits on the test user account.
Expand All @@ -59,13 +66,14 @@ jobs:

strategy:
matrix:
os: ${{ fromJSON(inputs.operating-systems) }}
python-version: ${{ fromJSON(inputs.python-versions) }}
os: ${{ fromJSON(inputs.operating_systems) }}
python-version: ${{ fromJSON(inputs.python_versions) }}
max-parallel: 1 # No parallel tests to avoid exceeding API limits.

runs-on: ${{ matrix.os }}

env:
TESTS_CONCURRENCY: ${{ inputs.tests_concurrency }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

steps:
Expand All @@ -91,13 +99,15 @@ jobs:
APIFY_TEST_USER_API_TOKEN: ${{ secrets.APIFY_TEST_USER_PYTHON_SDK_API_TOKEN }}
APIFY_TEST_USER_2_API_TOKEN: ${{ secrets.APIFY_TEST_USER_2_API_TOKEN }}

# Upload coverage only for the ubuntu-latest and latest Python, and only when the Codecov token
# Upload coverage only for the specified OS and Python version, and only when the Codecov token
# is available (e.g. not for fork PRs).
- name: Upload integration test coverage
if: >-
${{
matrix.os == inputs.operating-system-for-codecov &&
matrix.python-version == inputs.python-version-for-codecov &&
inputs.operating_system_for_codecov != '' &&
inputs.python_version_for_codecov != '' &&
matrix.os == inputs.operating_system_for_codecov &&
matrix.python-version == inputs.python_version_for_codecov &&
env.CODECOV_TOKEN != ''
}}
uses: codecov/codecov-action@v5
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python_lint_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Lint check
on:
workflow_call:
inputs:
python-versions:
python_versions:
description: List of Python versions to be used (stringified JSON array).
required: true
type: string
Expand All @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ${{ fromJSON(inputs.python-versions)}}
python-version: ${{ fromJSON(inputs.python_versions) }}

steps:
- name: Checkout repository
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python_type_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Type check
on:
workflow_call:
inputs:
python-versions:
python_versions:
description: List of Python versions to be used (stringified JSON array).
required: true
type: string
Expand All @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ${{ fromJSON(inputs.python-versions)}}
python-version: ${{ fromJSON(inputs.python_versions) }}

steps:
- name: Checkout repository
Expand Down
50 changes: 30 additions & 20 deletions .github/workflows/python_unit_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,31 @@ name: Unit tests
on:
workflow_call:
secrets:
httpbin_url:
APIFY_HTTPBIN_TOKEN:
description: Token for Apify httpbin service. If provided, uses httpbin.apify.actor, otherwise falls back to httpbin.org.
required: false
description: URL that sets the HTTPBIN_URL environment variable.
CODECOV_TOKEN:
required: false
description: Token for uploading coverage reports to Codecov.
required: false
inputs:
python-versions:
python_versions:
description: List of Python versions to be used (stringified JSON array).
required: true
type: string
operating-systems:
description: List of operating systems to be used.
operating_systems:
description: List of operating systems to be used (stringified JSON array).
required: true
type: string
python-version-for-codecov:
description: Python version to be used for codecov upload.
required: true
python_version_for_codecov:
description: Python version to use for codecov upload. Leave empty to skip codecov.
required: false
type: string
operating-system-for-codecov:
description: Operating system to be used for codecov upload.
required: true
default: ""
operating_system_for_codecov:
description: Operating system to use for codecov upload. Leave empty to skip codecov.
required: false
type: string
default: ""
install_command:
description: Command to install Python dependencies.
required: false
Expand All @@ -36,18 +38,24 @@ on:
required: false
type: string
default: uv run poe unit-tests-cov
tests_concurrency:
description: Number of parallel test processes. Uses pytest-xdist numprocesses value.
required: false
type: string
default: auto

jobs:
unit_tests:
name: Unit tests
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(inputs.operating-systems) }}
python-version: ${{ fromJSON(inputs.python-versions) }}
os: ${{ fromJSON(inputs.operating_systems) }}
python-version: ${{ fromJSON(inputs.python_versions) }}
runs-on: ${{ matrix.os }}
env:
HTTPBIN_URL: ${{ secrets.httpbin_url || 'https://httpbin.org' }}
HTTPBIN_URL: ${{ secrets.APIFY_HTTPBIN_TOKEN && format('https://httpbin.apify.actor?token={0}', secrets.APIFY_HTTPBIN_TOKEN) || 'https://httpbin.org' }}
TESTS_CONCURRENCY: ${{ inputs.tests_concurrency }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

steps:
Expand Down Expand Up @@ -77,14 +85,16 @@ jobs:
- name: Run unit tests
run: ${{ inputs.run_tests_command }}

# Upload coverage only for the ubuntu-latest and latest Python, and only when the Codecov token
# is available (e.g. not for fork PRs).
# Upload coverage only for the specified OS and Python version,
# and only when the Codecov token is available (e.g. not for fork PRs).
- name: Upload unit test coverage
if: >-
${{
matrix.os == inputs.operating-system-for-codecov &&
matrix.python-version == inputs.python-version-for-codecov &&
env.CODECOV_TOKEN != ''
env.CODECOV_TOKEN != '' &&
inputs.operating_system_for_codecov != '' &&
inputs.python_version_for_codecov != '' &&
matrix.os == inputs.operating_system_for_codecov &&
matrix.python-version == inputs.python_version_for_codecov
}}
uses: codecov/codecov-action@v5
with:
Expand Down
Loading