forked from yext/search-ui-react
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (58 loc) · 2.23 KB
/
coverage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# 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 }}%