-
Notifications
You must be signed in to change notification settings - Fork 4
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
How to handle base-file #29
Comments
@Floppy012 I have two actions: // .github/workflows/coverage-store.yml
name: Coverage Store
on:
push:
branches:
- develop
permissions:
actions: write
contents: read
packages: read
jobs:
coverage_store:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: yarn install
- run: yarn test-ci --coverage
- name: Upload coverage for current branch
uses: actions/upload-artifact@v3
with:
name: coverage-reports-artifact
path: ./coverage/clover.xml and // .github/workflows/coverage-report.yml
name: Coverage Report
on:
pull_request:
branches-ignore:
- 'dependabot/npm_and_yarn/**'
permissions:
actions: read
contents: read
packages: read
pull-requests: write
jobs:
coverage_report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: yarn install
- run: yarn test-ci --coverage
- name: Download coverage for DEVELOP branch
uses: dawidd6/action-download-artifact@v2
continue-on-error: true
with:
branch: develop
name: coverage-reports-artifact
path: ./coverage/base/
search_artifacts: true
workflow: .github/workflows/coverage-store.yml
- name: Coverage Report as Comment (Clover)
uses: lucassabreu/comment-coverage-clover@v0.9.1
with:
base-file: ./coverage/base/clover.xml
chart-size: 90
dir-prefix: ${{ github.workspace }}
file: ./coverage/clover.xml
show-percentage-change-on-table: true
table-coverage-change: 0.1 I hope this is helpful, as I've also had to figure this thing out 😄 |
This comment was marked as outdated.
This comment was marked as outdated.
yours is better... less ifs makes it more clear |
Wow! Thanks for the quick replies. I managed to combine both examples into a solution that works for me. However I seem to have ran into a bug. My clover file only contains a single
Probably caused by this line:
My clover file looks like this: <?xml version="1.0" encoding="utf-8"?>
<coverage generated="1679408725" clover="4.3.1">
<project timestamp="1679408725">
<metrics complexity="0" elements="637" coveredelements="495" conditionals="0" coveredconditionals="0" statements="637" coveredstatements="495" coveredmethods="0" methods="0" classes="117" loc="4706" ncloc="637" files="117" packages="1" />
<package name="Default">
<metrics complexity="0" elements="637" coveredelements="495" conditionals="0" coveredconditionals="0" statements="637" coveredstatements="495" coveredmethods="0" methods="0" classes="117" loc="4706" ncloc="637" files="117" />
<!-- files redacted -->
</package>
</project>
<testproject timestamp="1679408725">
<metrics complexity="0" elements="0" coveredelements="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" coveredmethods="0" methods="0" classes="0" loc="0" ncloc="0" files="0" packages="0" />
</testproject>
</coverage> (I removed the files cause I'm not allowed to share that information) |
@Floppy012 can you update and retry to see if the problem is fixed? |
@lucassabreu Works perfectly now. Thanks for your fast work 😄 |
I just started using GitHub Actions and so far I love it. And I would like to use this action. But it's not really clear to me how to handle the
base-file
.In my case the
base-file
should be the coverage report from themain
branch. But how do I access that from an action running in a PR?The only option I see would be to use a cache for that. With the only downside being that the cache will be deleted when it's not being accessed for 7 days in a row.
Or is there a better way to handle this?
The text was updated successfully, but these errors were encountered: