Skip to content

Commit 955876d

Browse files
authored
Python coverage action switch from CodeClimate (#20)
1 parent 5a963e4 commit 955876d

File tree

1 file changed

+8
-31
lines changed

1 file changed

+8
-31
lines changed

.github/workflows/coverage.yml

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ on:
3737
required: false
3838
type: string
3939
default: pyproject.toml
40-
secrets:
41-
CC_TEST_REPORTER_ID:
42-
required: true
4340

4441
env:
4542
UV_COMPILE_BYTECODE: 1
@@ -69,33 +66,13 @@ jobs:
6966
- name: Install package
7067
run: uv pip install '.[${{ inputs.extra-dependencies }}]'
7168

72-
- name: Set up env for CodeClimate (push)
73-
run: |
74-
echo "GIT_BRANCH=${GITHUB_REF/refs\/heads\//}" >> $GITHUB_ENV
75-
echo "GIT_COMMIT_SHA=$GITHUB_SHA" >> $GITHUB_ENV
76-
if: github.event_name == 'push'
77-
78-
- name: Set up env for CodeClimate (pull_request)
79-
env:
80-
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
81-
run: |
82-
echo "GIT_BRANCH=$GITHUB_HEAD_REF" >> $GITHUB_ENV
83-
echo "GIT_COMMIT_SHA=$PR_HEAD_SHA" >> $GITHUB_ENV
84-
if: github.event_name == 'pull_request'
85-
86-
- name: Prepare CodeClimate binary
87-
env:
88-
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
89-
run: |
90-
curl -LSs 'https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64' >./cc-test-reporter;
91-
chmod +x ./cc-test-reporter
92-
./cc-test-reporter before-build
93-
9469
- name: Run all tests
95-
run: python -m pytest ${{ inputs.pytest-options }} --cov-report xml --cov=${{ inputs.src-dir }}
70+
run: python -m pytest ${{ inputs.pytest-options }} --cov-report xml --cov-report term-missing --cov=${{ inputs.src-dir }}
9671

97-
- name: Push Coverage to CodeClimate
98-
if: ${{ success() }} # only if tests were successful
99-
env:
100-
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
101-
run: ./cc-test-reporter after-build
72+
- name: Show Coverage Report to PR
73+
uses: orgoro/coverage@v3.2
74+
if: ${{ success() }} && github.event_name == 'pull_request' # only if tests were successful, and a PR
75+
with:
76+
thresholdAll: 0.8 # we want at least 80% coverage for the package, fail if not
77+
coverageFile: coverage.xml # default when using '--cov-report xml' option above
78+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)