-
Notifications
You must be signed in to change notification settings - Fork 721
75 lines (71 loc) Β· 2.56 KB
/
test-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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# This is a basic workflow to help you get started with Actions
name: test-coverage
on:
push:
branches: [main, release, test-code-coverage]
pull_request:
branches: [main, release]
workflow_dispatch:
jobs:
jest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Run install
run: npm i -g lerna@^6 && npm run bootstrap
- name: Run Jest test
run: npm run test:coverage
- name: Archive Jest coverage
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: jest
path: test/coverage/coverage-final.json
cypress:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Run install
run: |
npm i -g lerna@^6
npm run bootstrap
- name: Build storybook
run: |
npm run pre-story
TEST_ENV=test npm run build-storybook
- name: Serve storybook
run: nohup npx http-server -p 6006 storybook-static &
- name: Run Cypress test
run: npx wait-on http://127.0.0.1:6006 && ./node_modules/.bin/cypress run
- name: Archive Cypress coverage
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: cypress
path: cypress/coverage/coverage-final.json
coverage:
runs-on: ubuntu-latest
needs: [jest, cypress]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Download Jest coverage
uses: actions/download-artifact@v4
with:
# upload jest and cypress coverage to output dir
path: output
- name: Code coverage merge
run: |
tree output
npx istanbul-merge --out output/coverage-final.json output/jest/coverage-final.json output/cypress/coverage-final.json
tree output
- name: Run codecov
run: npx codecov --token=${{ secrets.CODECOV_TOKEN }} --file=output/coverage-final.json