-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (72 loc) · 2.14 KB
/
test.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
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Test Package
on:
pull_request:
jobs:
run-tests:
if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
- run: npm install
- run: npm run test
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
test-results/junit.xml
base_branch_coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
- run: npm install
- run: npm run test
- name: Upload code coverage for master
if: always()
uses: actions/upload-artifact@v3
with:
name: ref-lcov.info
path: ./test-results/coverage/lcov.info
checks:
runs-on: ubuntu-latest
needs: base_branch_coverage
if: always()
steps:
- uses: actions/checkout@v3
- name: Download base coverage
uses: actions/download-artifact@v3
with:
name: ref-lcov.info
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
- run: npm install
- run: npm run test
continue-on-error: true
- name: Generate code coverage
if: always()
id: code-coverage
uses: barecheck/code-coverage-action@v1
with:
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
lcov-file: "./test-results/coverage/lcov.info"
base-lcov-file: "./lcov.info"
send-summary-comment: true
show-annotations: "warning"