-
Notifications
You must be signed in to change notification settings - Fork 5
ci: switch to ubuntu-latest & revised matrixes
#32
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
Closed
danielbrunt57
wants to merge
7
commits into
alandtse:main
from
danielbrunt57:CI-appears-to-be-blocked-waiting-for-GitHub-hosted-runners
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9bf9a86
Refactor pull-test.yml using `ubuntu-latest` & revised matrixes
danielbrunt57 619f862
Remove invalid build: key so the job parses.
danielbrunt57 365ec81
Upgrade codecov-action from v1 to v5
danielbrunt57 ec6eb0b
Add legacy checks for branch protection in workflow
danielbrunt57 ef25a08
Update markdown link checker action in workflow
danielbrunt57 8a57fee
Remove '--exclude-mail' from pull-test.yml
danielbrunt57 ce29ca3
Update comment for build (3.9) job
danielbrunt57 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
Some comments aren't visible on the classic Files Changed page.
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 |
|---|---|---|
| @@ -1,41 +1,130 @@ | ||
| # Runs tests via tox | ||
| # Runs on pull requests to main | ||
| name: Test on pull request | ||
| # Runs on pull requests to main/master | ||
| # Full Python matrix runs on push to main/master | ||
| name: Test | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - master | ||
| push: | ||
| branches: | ||
| - main | ||
| - master | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-20.04 | ||
| pr: | ||
| # Pull requests: fast feedback on latest Python only | ||
| name: PR (Python 3.12) | ||
| if: github.event_name == 'pull_request' | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| max-parallel: 3 | ||
| max-parallel: 1 | ||
| matrix: | ||
| python-version: | ||
| - "3.12" | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: "Set up Python ${{ matrix.python-version }}" | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "${{ matrix.python-version }}" | ||
|
|
||
| - name: Install build meta-dependencies | ||
| run: | | ||
| pip install tox poetry tox-gh-actions | ||
|
|
||
| - name: Test with tox | ||
| run: | | ||
| tox | ||
|
|
||
| # - name: Coveralls Python | ||
| # uses: AndreMiras/coveralls-python-action@v20201129 | ||
| # with: | ||
| # #github-token: #${{ secrets.GITHUB_TOKEN }} | ||
| # github-token: ${{ secrets.COVERALLS_REPO_TOKEN }} | ||
|
|
||
| - uses: codecov/codecov-action@v5 | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| verbose: true # optional (default = false) | ||
|
|
||
| main: | ||
| # Pushes to main/master: full Python matrix | ||
| name: Main/Master (Python matrix) | ||
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| max-parallel: 1 | ||
| matrix: | ||
| python-version: | ||
| - "3.10" | ||
| - "3.11" | ||
| - "3.12" | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v2 | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: "Set up Python ${{ matrix.python-version }}" | ||
| uses: actions/setup-python@v2 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "${{ matrix.python-version }}" | ||
|
|
||
| - name: Install build meta-dependencies | ||
| run: | | ||
| pip install tox poetry tox-gh-actions | ||
|
|
||
| - name: Test with tox | ||
| run: | | ||
| tox | ||
|
|
||
| # - name: Coveralls Python | ||
| # uses: AndreMiras/coveralls-python-action@v20201129 | ||
| # with: | ||
| # #github-token: #${{ secrets.GITHUB_TOKEN }} | ||
| # github-token: ${{ secrets.COVERALLS_REPO_TOKEN }} | ||
| - uses: codecov/codecov-action@v1 | ||
|
|
||
| - uses: codecov/codecov-action@v5 | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| verbose: true # optional (default = false) | ||
|
|
||
| # Legacy required check for branch protection. | ||
| # NOTE: This does NOT run Python 3.9 tests; it exists only because branch protection | ||
| # requires a status check named "build (3.9)". Remove once branch protection is updated. | ||
| build_39: | ||
| name: build (3.9) | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'pull_request' | ||
| steps: | ||
| - name: Compatibility status | ||
| run: | | ||
| echo "Legacy required check for branch protection." | ||
|
|
||
| # Legacy required checks for branch protection | ||
| markdown_link_check: | ||
| name: markdown-link-check | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'pull_request' | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Check markdown links | ||
| uses: lycheeverse/lychee-action@v2 | ||
| with: | ||
| args: > | ||
| --verbose | ||
| --no-progress | ||
| --accept 200,206,429 | ||
| --timeout 20 | ||
| --max-concurrency 8 | ||
| "**/*.md" | ||
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.
🧩 Analysis chain
🌐 Web query:
Codecov v5 action authentication token requirements github actions💡 Result:
codecov/codecov-action@v5can authenticate uploads with a Codecov upload token provided either aswith: token: ...orenv: CODECOV_TOKEN: .... (github.com)use_oidc: true; any provided token is ignored, and your workflow/job must grantpermissions: id-token: write. (github.com)Citations:
🌐 Web query:
GitHub Actions secrets forked pull requests external contributors💡 Result:
pull_requestfrom forks run with no access to repository secrets, and the providedGITHUB_TOKENis read-only. [1].github/workflows/changes) and click “Approve workflows to run.” Runs awaiting approval for >30 days are deleted. [3]pull_request_targetvery carefully.pull_request_targetruns in the context of the base repo and can access secrets, but it’s risky if you run untrusted fork code (e.g., by checking out the fork and executing it). Also, enterprise policies notepull_request_targetruns regardless of fork-approval settings. [4]GITHUB_TOKENand no secrets. [5]Sources:
[1] https://github.blog/security/supply-chain-security/four-tips-to-keep-your-github-actions-workflows-secure/
[2] https://docs.github.com/en/enterprise-cloud%40latest/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository
[3] https://docs.github.com/en/actions/how-tos/managing-workflow-runs-and-deployments/managing-workflow-runs/approving-workflow-runs-from-public-forks
[4] https://docs.github.com/github-ae%40latest/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise
[5] https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/
🌐 Web query:
Codecov tokenless upload OIDC github actions💡 Result:
Tokenless vs OIDC (GitHub Actions + Codecov)
1) “Tokenless upload” (no
CODECOV_TOKEN)Codecov will accept uploads without a token only when either:
forkname:main). [2]2) OIDC (no Codecov upload token, but still authenticated)
With the official Codecov GitHub Action, you can authenticate uploads using GitHub OIDC by setting
use_oidc: trueand grantingid-token: write. Any token you pass will be ignored. [1]Note: Codecov Action v4 does not support tokenless uploading (it’s a breaking change in v4). [1]
Sources: [1] [2]
Guard Codecov upload for private repos or when secrets are unavailable.
Forked PRs don't receive repository secrets, so
${{ secrets.CODECOV_TOKEN }}is empty for external contributors. This matters only if your repo is private (token always required) or if Codecov requires tokens for protected branches in your org settings. Public repos with fork branches don't require a token. To avoid failures across all scenarios, add a conditional guard:🔧 Suggested guard
Alternatively, use OIDC (
use_oidc: true) if your Codecov account supports it.🤖 Prompt for AI Agents