Skip to content

Commit

Permalink
[ci] Add coverage comment
Browse files Browse the repository at this point in the history
  • Loading branch information
anjos committed Nov 6, 2024
1 parent 04c80bf commit 60c96eb
Showing 1 changed file with 37 additions and 5 deletions.
42 changes: 37 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ name: build
on:
- push
- pull_request
env:
PYTEST_ADDOPTS: --color=yes
permissions:
contents: read
jobs:
Expand All @@ -23,7 +21,7 @@ jobs:
- name: Setup pixi
uses: prefix-dev/[email protected]
with:
pixi-version: v0.34.0
pixi-version: v0.35.0
cache: true
auth-host: prefix.dev
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
Expand All @@ -47,12 +45,46 @@ jobs:
- name: Set up Python ${{ matrix.python-version }} & Pixi
uses: prefix-dev/[email protected]
with:
pixi-version: v0.34.0
pixi-version: v0.35.0
cache: true
auth-host: prefix.dev
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
- name: Run tests
run: pixi run -e test${{ matrix.python-version }} test-ci
env:
COVERAGE_FILE: .coverage.${{ matrix.python-version }}
- name: Store coverage file
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-version }}
path: .coverage.${{ matrix.python-version }}
include-hidden-files: true
coverage:
name: Coverage
runs-on: ubuntu-latest
needs: test
permissions:
pull-requests: write
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
id: download
with:
pattern: coverage-*
merge-multiple: true
- name: Coverage comment
id: coverage_comment
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MERGE_COVERAGE_FILES: true
- name: Store Pull Request comment to be posted
uses: actions/upload-artifact@v4
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
with:
name: python-coverage-comment-action
path: python-coverage-comment-action.txt
build:
name: Build distribution
runs-on: ubuntu-latest
Expand All @@ -66,7 +98,7 @@ jobs:
- name: Setup pixi
uses: prefix-dev/[email protected]
with:
pixi-version: v0.34.0
pixi-version: v0.35.0
cache: true
auth-host: prefix.dev
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
Expand Down

0 comments on commit 60c96eb

Please sign in to comment.