-
Notifications
You must be signed in to change notification settings - Fork 1
chore(ci): Align GitHub workflows across Python projects #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
03fad86
chore(ci): Align GitHub workflows across Python projects
vdusek 7314773
Fix run code checks
vdusek abf9563
Separate code_checks and doc_checks
vdusek c312481
fix code checks reference
vdusek 3b98ff7
Update naming
vdusek 81ce890
rm todo to conda
vdusek d638d03
Update
vdusek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: Code checks | ||
|
|
||
| on: | ||
| # Runs when manually triggered from the GitHub UI. | ||
| workflow_dispatch: | ||
|
|
||
| # Runs when invoked by another workflow. | ||
| workflow_call: | ||
|
|
||
| jobs: | ||
| actions_lint_check: | ||
| name: Actions lint check | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
| - name: Run actionlint | ||
| uses: rhysd/actionlint@v1.7.9 | ||
|
|
||
| lint_check: | ||
| name: Lint check | ||
| uses: apify/workflows/.github/workflows/python_lint_check.yaml@main | ||
| with: | ||
| python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]' | ||
|
|
||
| type_check: | ||
| name: Type check | ||
| uses: apify/workflows/.github/workflows/python_type_check.yaml@main | ||
| with: | ||
| python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| name: Tests | ||
|
|
||
| on: | ||
| # Runs when manually triggered from the GitHub UI. | ||
| workflow_dispatch: | ||
|
|
||
| # Runs when invoked by another workflow. | ||
| workflow_call: | ||
|
|
||
| jobs: | ||
| # Create a custom unit tests job, because apify-shared-python doesn't use codecov report. | ||
| unit_tests: | ||
| name: Unit tests | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest] | ||
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | ||
| runs-on: ${{ matrix.os }} | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Set up uv package manager | ||
| uses: astral-sh/setup-uv@v7 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install Python dependencies | ||
| run: make install-dev | ||
|
|
||
| - name: Run unit tests | ||
| run: make unit-tests-cov |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| name: Stable release | ||
|
|
||
| on: | ||
| # Runs when manually triggered from the GitHub UI, with options to specify the type of release. | ||
| workflow_dispatch: | ||
| inputs: | ||
| release_type: | ||
| description: Release type | ||
| required: true | ||
| type: choice | ||
| default: auto | ||
| options: | ||
| - auto | ||
| - custom | ||
| - patch | ||
| - minor | ||
| - major | ||
| custom_version: | ||
| description: The custom version to bump to (only for "custom" type) | ||
| required: false | ||
| type: string | ||
| default: "" | ||
|
|
||
| concurrency: | ||
| group: release | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| code_checks: | ||
| name: Code checks | ||
| uses: ./.github/workflows/_check_code.yaml | ||
|
|
||
| tests: | ||
| name: Tests | ||
| uses: ./.github/workflows/_tests.yaml | ||
|
|
||
| release_prepare: | ||
| name: Release prepare | ||
| needs: [code_checks, tests] | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| version_number: ${{ steps.release_prepare.outputs.version_number }} | ||
| tag_name: ${{ steps.release_prepare.outputs.tag_name }} | ||
| changelog: ${{ steps.release_prepare.outputs.changelog }} | ||
| release_notes: ${{ steps.release_prepare.outputs.release_notes }} | ||
| steps: | ||
| - uses: apify/workflows/git-cliff-release@main | ||
| name: Release prepare | ||
| id: release_prepare | ||
| with: | ||
| release_type: ${{ inputs.release_type }} | ||
| custom_version: ${{ inputs.custom_version }} | ||
| existing_changelog_path: CHANGELOG.md | ||
|
|
||
| changelog_update: | ||
| name: Changelog update | ||
| needs: [release_prepare] | ||
| uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@main | ||
| with: | ||
| version_number: ${{ needs.release_prepare.outputs.version_number }} | ||
| changelog: ${{ needs.release_prepare.outputs.changelog }} | ||
| secrets: inherit | ||
|
|
||
| github_release: | ||
| name: GitHub release | ||
| needs: [release_prepare, changelog_update] | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| steps: | ||
| - name: GitHub release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ needs.release_prepare.outputs.tag_name }} | ||
| name: ${{ needs.release_prepare.outputs.version_number }} | ||
| target_commitish: ${{ needs.changelog_update.outputs.changelog_commitish }} | ||
| body: ${{ needs.release_prepare.outputs.release_notes }} | ||
|
|
||
| pypi_publish: | ||
| name: PyPI publish | ||
| needs: [release_prepare, changelog_update] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| id-token: write # Required for OIDC authentication. | ||
| environment: | ||
| name: pypi | ||
| url: https://pypi.org/project/apify-shared | ||
| steps: | ||
| - name: Prepare distribution | ||
| uses: apify/workflows/prepare-pypi-distribution@main | ||
| with: | ||
| package_name: apify-shared | ||
| is_prerelease: "" | ||
| version_number: ${{ needs.release_prepare.outputs.version_number }} | ||
| ref: ${{ needs.changelog_update.outputs.changelog_commitish }} | ||
|
|
||
| # Publishes the package to PyPI using PyPA official GitHub action with OIDC authentication. | ||
| - name: Publish package to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 |
9 changes: 5 additions & 4 deletions
9
.github/workflows/update_new_issue.yaml → .github/workflows/on_issue.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,26 @@ | ||
| name: Update new issue | ||
| name: CI (issue) | ||
|
|
||
| on: | ||
| # Runs when a new issue is opened. | ||
| issues: | ||
| types: | ||
| - opened | ||
|
|
||
| jobs: | ||
| label_issues: | ||
| name: Label issues | ||
| name: Add labels | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| issues: write | ||
|
|
||
| steps: | ||
| # Add the "t-tooling" label to all new issues | ||
| - uses: actions/github-script@v7 | ||
| - uses: actions/github-script@v8 | ||
| with: | ||
| script: | | ||
| github.rest.issues.addLabels({ | ||
| issue_number: context.issue.number, | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| labels: ["t-tooling"] | ||
| }) | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| name: CI (master) | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| tags-ignore: | ||
| - "**" # Ignore all tags to avoid duplicate executions triggered by tag pushes. | ||
|
|
||
| concurrency: | ||
| group: release | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| code_checks: | ||
| name: Code checks | ||
| uses: ./.github/workflows/_check_code.yaml | ||
|
|
||
| tests: | ||
| # Skip this for "ci" and "docs" commits. | ||
| if: "!startsWith(github.event.head_commit.message, 'ci') && !startsWith(github.event.head_commit.message, 'docs')" | ||
| name: Tests | ||
| uses: ./.github/workflows/_tests.yaml | ||
|
|
||
| release_prepare: | ||
| # Skip this for "ci", "docs" and "test" commits and for forks. | ||
| 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/')" | ||
| name: Release prepare | ||
| needs: [code_checks, tests] | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| version_number: ${{ steps.release_prepare.outputs.version_number }} | ||
| tag_name: ${{ steps.release_prepare.outputs.tag_name }} | ||
| changelog: ${{ steps.release_prepare.outputs.changelog }} | ||
| steps: | ||
| - uses: apify/workflows/git-cliff-release@main | ||
| id: release_prepare | ||
| name: Release prepare | ||
| with: | ||
| release_type: prerelease | ||
| existing_changelog_path: CHANGELOG.md | ||
|
|
||
| changelog_update: | ||
| name: Changelog update | ||
| needs: [release_prepare] | ||
| uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@main | ||
| with: | ||
| version_number: ${{ needs.release_prepare.outputs.version_number }} | ||
| changelog: ${{ needs.release_prepare.outputs.changelog }} | ||
| secrets: inherit | ||
|
|
||
| pypi_publish: | ||
| name: PyPI publish | ||
| needs: [release_prepare, changelog_update] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| id-token: write # Required for OIDC authentication. | ||
| environment: | ||
| name: pypi | ||
| url: https://pypi.org/project/apify-shared | ||
| steps: | ||
| - name: Prepare distribution | ||
| uses: apify/workflows/prepare-pypi-distribution@main | ||
| with: | ||
| package_name: apify-shared | ||
| is_prerelease: "yes" | ||
| version_number: ${{ needs.release_prepare.outputs.version_number }} | ||
| ref: ${{ needs.changelog_update.outputs.changelog_commitish }} | ||
|
|
||
| - name: Publish package to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| name: CI (PR) | ||
|
|
||
| on: | ||
| # Runs whenever a pull request is opened or updated. | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| pr_title_check: | ||
| name: PR title check | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: amannn/action-semantic-pull-request@v6.1.1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| code_checks: | ||
| name: Code checks | ||
| uses: ./.github/workflows/_check_code.yaml | ||
|
|
||
| tests: | ||
| name: Tests | ||
| uses: ./.github/workflows/_tests.yaml |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor nit, but this is more like project management, not CI