-
-
Notifications
You must be signed in to change notification settings - Fork 22
197 lines (191 loc) · 6.26 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
cache:
name: CI cache
runs-on: ubuntu-latest
outputs:
pnpm-cache: ${{ steps.vars.outputs.pnpm-cache }}
key: ${{ steps.vars.outputs.key }}
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
- uses: actions/setup-node@v3
with:
node-version: "18.x"
- id: vars
run: |
echo "pnpm-cache=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
echo "key=${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}" >> $GITHUB_OUTPUT
- name: Cache NPM and Cypress 📦
uses: actions/cache@v3
id: cache
with:
path: |
${{ steps.vars.outputs.pnpm-cache }}
~/.cache/Cypress
key: ${{ steps.vars.outputs.key }}
restore-keys: |
${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
${{ runner.os }}-pnpm-
- run: pnpm install --frozen-lockfile --prefer-offline
env:
HUSKY: '0' # By default do not run HUSKY install
lint:
name: lint
runs-on: ubuntu-latest
needs: cache
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
- uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: Cache NPM and Cypress 📦
uses: actions/cache@v3
id: cache
with:
path: |
${{ needs.cache.outputs.pnpm-cache }}
~/.cache/Cypress
key: ${{ needs.cache.outputs.key }}
restore-keys: |
${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
${{ runner.os }}-pnpm-
- run: pnpm install --frozen-lockfile --prefer-offline
env:
HUSKY: '0' # By default do not run HUSKY install
- run: pnpm lint:ci
- run: pnpm format:ci
test:
name: test
runs-on: ubuntu-latest
needs: cache
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
- uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: Cache NPM and Cypress 📦
uses: actions/cache@v3
id: cache
with:
path: |
${{ needs.cache.outputs.pnpm-cache }}
~/.cache/Cypress
key: ${{ needs.cache.outputs.key }}
restore-keys: |
${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
${{ runner.os }}-pnpm-
- run: pnpm install --frozen-lockfile --prefer-offline
env:
HUSKY: '0' # By default do not run HUSKY install
- run: pnpm --filter cypress-plugin-visual-regression-diff -r build
- name: Test e2e
run: pnpm test:e2e:ci
- name: Test component-testing
run: pnpm test:ct:ci
- uses: actions/upload-artifact@v3
with:
name: test
path: |
examples/next/**/*.png
examples/next/**/*.jpg
examples/next/**/*.jpeg
test-integration-coverage:
name: test-integration-coverage
runs-on: ubuntu-latest
needs: cache
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
- uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: Cache NPM and Cypress 📦
uses: actions/cache@v3
id: cache
with:
path: |
${{ needs.cache.outputs.pnpm-cache }}
~/.cache/Cypress
key: ${{ needs.cache.outputs.key }}
restore-keys: |
${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
${{ runner.os }}-pnpm-
- run: pnpm install --frozen-lockfile --prefer-offline
env:
HUSKY: '0' # By default do not run HUSKY install
- name: Test integration (with coverage) and upload to CodeClimate
if: ${{ github.ref == 'refs/heads/main' }}
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
debug: true
coverageCommand: pnpm test:integration:ci
coverageLocations: |
${{github.workspace}}/packages/*/coverage/lcov.info:lcov
- name: Test integration (with coverage)
if: ${{ github.ref != 'refs/heads/main' }}
run: pnpm test:integration:ci
prepare-release:
name: detect changes, bump package versions, generate changelog and commit it to main branch
runs-on: ubuntu-latest
needs: [cache, lint, test, test-integration-coverage]
if: ${{ github.actor != 'dependabot[bot]' && github.ref == 'refs/heads/main' && github.event_name == 'push' }}
permissions:
contents: write
pull-requests: write
outputs:
releases_created: ${{ steps.release.outputs.releases_created }}
steps:
- uses: google-github-actions/[email protected]
id: release
with:
command: manifest
default-branch: main
monorepo-tags: true
build-and-release:
name: build and release
runs-on: ubuntu-latest
needs: [cache, prepare-release]
if: needs.prepare-release.outputs.releases_created
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
- uses: actions/setup-node@v3
with:
node-version: "18.x"
registry-url: 'https://registry.npmjs.org'
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Cache NPM and Cypress 📦
uses: actions/cache@v3
id: cache
with:
path: |
${{ needs.cache.outputs.pnpm-cache }}
~/.cache/Cypress
key: ${{ needs.cache.outputs.key }}
restore-keys: |
${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
${{ runner.os }}-pnpm-
- run: pnpm install --frozen-lockfile --prefer-offline
env:
HUSKY: '0' # By default do not run HUSKY install
- name: Build packages to get cross-references working 🔧
run: pnpm build
- name: Release package
run: pnpm publish -r
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}