-
Notifications
You must be signed in to change notification settings - Fork 56
71 lines (58 loc) · 2.47 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
name: Continuous Integration
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
jobs:
tests-and-coverage:
name: Run tests & report coverage
runs-on: ubuntu-latest
env:
NODE_VERSION: 20.9.0
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Cache npm dependencies
uses: actions/cache@v4
id: cache-node_modules
with:
path: "node_modules"
key: ${{ runner.os }}-npm-${{ hashFiles('/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-${{ hashFiles('/package-lock.json') }}
${{ runner.os }}-npm-
# since npm ci installs only dependencies in package-lock.json, it may be that the package-lock.json pushed
# has been generated on non-linux, making the installed node_modules lack packages needed by the linux runner
- name: Ensure lefthook-linux-x64 & @rollup/rollup-linux-x64-gnu are installed
if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: npm i --legacy-peer-deps lefthook-linux-x64 @rollup/rollup-linux-x64-gnu
- name: Install npm dependencies
if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: npm ci --legacy-peer-deps
# since playwright installs binaries of browsers with 'npx playwright install' triggered from the 'prepare' script,
# it won't happen when no 'npm install' is run, which is the case for when the '...-npm-...' cache is restored
# for that reason, there is a need to run this command here
- name: Run 'npm run prepare' manually if the cache was used instead of npm install
if: steps.cache-node_modules.outputs.cache-hit == 'true'
run: npm run prepare
- name: Install playwright dependency libraries
run: npx playwright install-deps
- name: Build plugin bundles
run: npm run build
- name: Build E2E pages & demos
run: npm run build:pages
- name: Run tests
run: npm test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
files: ./coverage/e2e/coverage-final.json,./coverage/unit/coverage-final.json,./coverage/integration/coverage-final.json
token: ${{ secrets.CODECOV_TOKEN }}