File tree Expand file tree Collapse file tree 4 files changed +73
-13
lines changed
Expand file tree Collapse file tree 4 files changed +73
-13
lines changed Original file line number Diff line number Diff line change 1+ name : Post coverage comment
2+
3+ on :
4+ workflow_run :
5+ workflows : ["UnitTests"]
6+ types :
7+ - completed
8+ workflow_dispatch :
9+
10+ jobs :
11+ test :
12+ name : Run tests & display coverage
13+ runs-on : ubuntu-latest
14+ if : github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
15+ permissions :
16+ # Gives the action the necessary permissions for publishing new
17+ # comments in pull requests.
18+ pull-requests : write
19+ # Gives the action the necessary permissions for editing existing
20+ # comments (to avoid publishing multiple comments in the same PR)
21+ contents : write
22+ # Gives the action the necessary permissions for looking up the
23+ # workflow that launched this workflow, and download the related
24+ # artifact that contains the comment to be published
25+ actions : read
26+ steps :
27+ # DO NOT run actions/checkout here, for security reasons
28+ # For details, refer to https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
29+ - name : Post comment
30+ uses : py-cov-action/python-coverage-comment-action@v3
31+ with :
32+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
33+ GITHUB_PR_RUN_ID : ${{ github.event.workflow_run.id }}
34+ # Update those if you changed the default values:
35+ # COMMENT_ARTIFACT_NAME: python-coverage-comment-action
36+ # COMMENT_FILENAME: python-coverage-comment-action.txt
Original file line number Diff line number Diff line change 8282
8383 env :
8484 CUDA_VISIBLE_DEVICES : 0
85-
86- unit-tests :
87- runs-on : ubuntu-latest
88- timeout-minutes : 10
89- steps :
90- - uses : actions/checkout@v4
91- - uses : astral-sh/setup-uv@v4
92- - run : uv sync --extra dev
93- - run : uv run pytest --cov-report term --cov-report html --cov=src/libkernelbot unit-tests -v
94- - uses : actions/upload-artifact@v4
95- with :
96- name : coverage
97- path : htmlcov/
Original file line number Diff line number Diff line change 1+ name : UnitTests
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ - dev
8+ pull_request :
9+
10+ jobs :
11+ unit-tests :
12+ runs-on : ubuntu-latest
13+ timeout-minutes : 10
14+ steps :
15+ - uses : actions/checkout@v4
16+ - uses : astral-sh/setup-uv@v4
17+ - run : uv sync --extra dev
18+ - run : uv run pytest --cov-report term --cov-report html --cov-report xml --cov=src/libkernelbot unit-tests -v
19+ - uses : actions/upload-artifact@v4
20+ with :
21+ name : coverage
22+ path : htmlcov/
23+ - name : Coverage comment
24+ id : coverage_comment
25+ uses : py-cov-action/python-coverage-comment-action@v3
26+ with :
27+ GITHUB_TOKEN : ${{ github.token }}
28+
29+ - name : Store Pull Request comment to be posted
30+ uses : actions/upload-artifact@v4
31+ if : steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
32+ with :
33+ # If you use a different name, update COMMENT_ARTIFACT_NAME accordingly
34+ name : python-coverage-comment-action
35+ # If you use a different name, update COMMENT_FILENAME accordingly
36+ path : python-coverage-comment-action.txt
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ where = ["src"]
3838
3939[tool .coverage .run ]
4040omit = [" src/libkernelbot/backend.py" , " src/libkernelbot/run_eval.py" , " src/libkernelbot/launchers/*.py" ]
41+ relative_files = true
4142
4243[tool .coverage .report ]
4344exclude_lines = [
You can’t perform that action at this time.
0 commit comments