-
Notifications
You must be signed in to change notification settings - Fork 115
89 lines (73 loc) · 2.64 KB
/
test-and-sync.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
name: Run tests
on:
# Push to master will deploy a dev version, push to stable deploys the latest version (and syncs the master branch)
push:
branches: [ master, stable ]
# PRs will run tests (skip deployment)
pull_request:
branches: [ master, stable ]
# A release via GitHub releases will deploy the latest version
workflow_call:
workflow_dispatch:
jobs:
lint:
name: Lint
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install Dependencies
run: npm ci
- name: Load Cache
uses: actions/cache@v4
with:
path: |
node_modules
key: cache-${{ github.run_id }}
- run: npm run lint
build_and_test:
name: Build & Test
needs: [lint]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
node-version: [ 18, 20, 22 ]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Cache Node Modules
uses: actions/cache@v4
with:
path: |
node_modules
key: cache-${{ github.run_id }}
- name: Install Playwright deps
run : npx playwright install --with-deps
- name: Install Puppeteer deps
run : |
npx puppeteer browsers install chrome
npx puppeteer browsers install firefox@beta
- name: Turbo cache
id: turbo-cache
uses: actions/cache@v4
with:
path: .turbo
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ github.ref_name }}-
- name: Build
run: npm run build
- name: Run Windows or MacOs tests
run: npm test
if: ${{ matrix.os == 'windows-latest' || matrix.os == 'macos-latest' }}
- name: Run Linux tests
run: xvfb-run --auto-servernum -- npm test
if: ${{ matrix.os == 'ubuntu-latest'}}