-
Notifications
You must be signed in to change notification settings - Fork 2
140 lines (110 loc) · 3.4 KB
/
ci.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
compatibility:
name: Compatibility Testing
strategy:
matrix:
jest:
- '27.x.x'
- '28.x.x'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Setup Jest
run: npm run setup-fixture
env:
JEST_VERSION: ${{ matrix.jest }}
- uses: bahmutov/npm-install@v1
with:
useLockFile: false
- name: Build library
run: npm run build --workspace=jest-metadata
- name: Instrument library
run: npm run instrument --workspace=jest-metadata
- name: Build fixtures
run: npm run build --workspace=@jest-metadata/recorder
- name: Assert no Git changes
run: git diff --exit-code packages/fixtures
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: artifacts-jest-${{ matrix.jest }}
path: artifacts/
sanity:
name: Platform Testing
strategy:
matrix:
os:
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- uses: bahmutov/npm-install@v1
with:
useLockFile: false
- name: Lint
run: npm run lint:ci
- name: Unit and Integration
run: npm run test --workspace=jest-metadata
- name: Build library
run: npm run build --workspace=jest-metadata
- name: Instrument library
run: npm run instrument --workspace=jest-metadata
- name: Build fixtures
run: npm run build --workspace=@jest-metadata/recorder
- name: Assert no Git changes
run: git diff --exit-code packages/fixtures
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: artifacts-os-${{ matrix.os }}
path: artifacts/
coverage:
name: Coverage Report
needs: [sanity, compatibility]
runs-on: ubuntu-latest
steps:
- name: Checkout (default)
if: github.event_name != 'pull_request'
uses: actions/checkout@v3
- name: Checkout (pull request)
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- uses: actions/setup-node@v3
- name: Install dependencies
run: npm -g install "[email protected]" "lcov-badge2"
- name: Merge coverage reports
run: lcov-result-merger 'artifacts/**/lcov.info' 'artifacts/lcov.info'
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: coverage
path: artifacts/lcov.info
- name: Generate coverage badge
run: lcov-badge2 -o docs/images/coverage.svg artifacts/lcov.info
- name: Commit and Push
uses: EndBug/add-and-commit@v9
with:
add: docs/images/coverage.svg
message: 'chore: update coverage badge'