-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e8e69c
commit 014d32b
Showing
2 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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,27 @@ | ||
# This is a follow up job that runs after the CI job has completed. | ||
# It'll post a code coverage comment on pull requests. | ||
name: Post Coverage Comment | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Continuous Integration"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
test: | ||
name: Post Coverage Comment | ||
runs-on: ubuntu-latest | ||
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' | ||
permissions: | ||
pull-requests: write | ||
contents: write | ||
actions: read | ||
steps: | ||
# !!! DO NOT run actions/checkout here, for security reasons !!! | ||
# For details, refer to https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ | ||
- name: Post comment | ||
uses: py-cov-action/python-coverage-comment-action@v3 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }} |
This file contains 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,12 +1,20 @@ | ||
name: Test | ||
name: Continuous Integration | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- "main" | ||
|
||
on: [push, pull_request] | ||
env: | ||
PYTEST_ADDOPTS: "--color=yes" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Rye Python Setup | ||
|
@@ -21,11 +29,21 @@ jobs: | |
make test | ||
- name: Attach Code Coverage | ||
uses: py-cov-action/[email protected] | ||
with: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
|
||
- name: Save Snapshot Report | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: snapshot-report-posting | ||
path: snapshot_report.html | ||
# TODO - fix file system ordering, see latest snapshot report | ||
|
||
- name: Store Pull Request Comment | ||
uses: actions/upload-artifact@v4 | ||
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' | ||
with: | ||
# If you use a different name, update COMMENT_ARTIFACT_NAME accordingly | ||
name: python-coverage-comment-action | ||
# If you use a different name, update COMMENT_FILENAME accordingly | ||
path: python-coverage-comment-action.txt |