TEST #10
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
# This workflow will run our tests, generate an lcov code coverage file, | |
# and send that coverage to Coveralls | |
name: Code Coverage | |
on: | |
push: | |
branches-ignore: dev/* | |
pull_request: | |
jobs: | |
combined_coverage: | |
uses: yext/slapshot-reusable-workflows/.github/workflows/coverage.yml@v1 | |
with: | |
test_script: npm run build:css && npm run test | |
secrets: | |
caller_github_token: ${{ secrets.GITHUB_TOKEN }} | |
MAPBOX_API_KEY: ${{ secrets.MAPBOX_API_KEY }} | |
individual_coverage_percentages: | |
if: ${{ github.event_name == 'pull_request' }} | |
runs-on: ubuntu-latest | |
needs: combined_coverage | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download the current coverage | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage | |
path: coverage/ | |
- name: Get Visual Coverage Percentage | |
uses: yext/slapshot-reusable-workflows/get-coverage-percent@v1 | |
with: | |
coverage-file: coverage/visual/lcov.info | |
id: parse-visual-coverage | |
- name: Get Unit Coverage Percentage | |
uses: yext/slapshot-reusable-workflows/get-coverage-percent@v1 | |
with: | |
coverage-file: coverage/unit/lcov.info | |
id: parse-unit-coverage | |
- name: Get Combined Coverage Percentage | |
uses: yext/slapshot-reusable-workflows/get-coverage-percent@v1 | |
with: | |
coverage-file: coverage/lcov.info | |
id: parse-combined-coverage | |
- name: Find Comment | |
uses: peter-evans/find-comment@v2 | |
id: fc | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: Current visual coverage | |
- name: Create/Update Comment | |
uses: peter-evans/create-or-update-comment@v2 | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
issue-number: ${{ github.event.pull_request.number }} | |
edit-mode: replace | |
body: | | |
Current unit coverage is ${{ steps.parse-unit-coverage.outputs.coverage-percent }}% | |
Current visual coverage is ${{ steps.parse-visual-coverage.outputs.coverage-percent }}% | |
Current combined coverage is ${{ steps.parse-combined-coverage.outputs.coverage-percent }}% |