-
Notifications
You must be signed in to change notification settings - Fork 2
168 lines (135 loc) · 4.09 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: CI
on:
push:
branches: [ master, beta ]
pull_request:
branches: [ master, beta ]
workflow_dispatch:
inputs:
os:
description: 'Operating System'
required: true
default: 'ubuntu-latest'
jobs:
sanity:
name: Standard Testing
runs-on: ${{ github.event.inputs.os || 'ubuntu-latest' }}
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 test
- name: Build package for E2E
run: npm run build:e2e
- uses: bahmutov/npm-install@v1
with:
useLockFile: false
working-directory: e2e
- name: Record fixtures
run: npm run build
working-directory: e2e
- name: Assert no Git changes
run: git diff --exit-code e2e/__fixtures__
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: artifacts-os-${{ matrix.os }}
path: artifacts/
compatibility:
name: Compatibility Testing
needs: sanity
if: github.event_name != 'workflow_dispatch'
strategy:
matrix:
jest:
- '27.x.x'
- '28.x.x'
runs-on: ${{ github.event.inputs.os || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- uses: bahmutov/npm-install@v1
with:
useLockFile: false
- name: Build package for E2E
run: npm run build:e2e
- uses: actions/setup-node@v3
with:
node-version-file: 'e2e/.nvmrc'
- name: Update fixtures
run: npm run update-fixtures
env:
JEST_VERSION: ${{ matrix.jest }}
- name: Assert no Git changes
run: git diff --exit-code e2e/__fixtures__
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: artifacts-jest-${{ matrix.jest }}
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
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm -g install "lcov-result-merger@4.x.x" "lcov-badge2@1.1.1"
- 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'
publish:
name: Publish
needs: [sanity, compatibility]
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- uses: bahmutov/npm-install@v1
with:
useLockFile: false
- name: Semantic release
run: npx --no-install semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}