Coverage #155
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
name: Coverage | |
on: | |
workflow_run: | |
workflows: ["Test"] | |
types: | |
- completed | |
jobs: | |
upload_coverage: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.workflow_run.head_sha }} | |
- env: | |
GITHUB: ${{ toJson(github) }} | |
run: | | |
env | |
- name: Download coverage | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: test.yml | |
commit: ${{ github.event.workflow_run.head_sha }} | |
run_id: ${{ github.event.workflow_run.id }} | |
run_number: ${{ github.event.workflow_run.run_number }} | |
name: rspec-coverage | |
path: ./coverage | |
- name: Report to codeclimate | |
if: always() | |
shell: bash | |
env: | |
JOB_STATUS: ${{ job.status == 'Success' }} | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
GIT_BRANCH: ${{ github.event.workflow_run.head_branch }} | |
GIT_COMMIT_SHA: ${{ github.event.workflow_run.head_sha }} | |
run: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
EXIT_CODE=$([[ "$JOB_STATUS" == true ]] && echo 0 || echo 1) | |
./cc-test-reporter after-build --exit-code $EXIT_CODE | |
- name: Upload coverage to GitHub pages | |
if: ${{ github.event.workflow_run.head_branch == 'master' }} | |
uses: maxheld83/[email protected] | |
env: | |
BUILD_DIR: ./coverage | |
GH_PAT: ${{ secrets.GH_PAT }} |