88 lines (76 loc) · 2.59 KB
/
test.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
name: Test
on:
# Build on pushes branches that have a PR (including drafts)
pull_request:
# Build on commits pushed to branches without a PR if it's in the allowlist
push:
branches: [next]
jobs:
test:
name: Test (${{ matrix.os }} / node ${{ matrix.node }})
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
os: [ubuntu-latest]
node: [14, 16, 18]
experimental: [false]
# include:
# - os: windows-latest
# node: 16
# experimental: true
steps:
- name: Checkout
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
- name: Setup node
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3
with:
node-version: ${{ matrix.node }}
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d # v3
env:
cache-name: cache-node-modules
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-modules-${{ env.cache-name }}-
${{ runner.os }}-modules-
${{ runner.os }}-
- name: Install project dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
env:
# Keep the Cypress binary in ./node_modules/.cypress
CYPRESS_CACHE_FOLDER: './node_modules/.cypress'
CYPRESS_INSTALL_BINARY: '0'
# PUPPETEER_SKIP_DOWNLOAD: 'true'
run: yarn install
- name: Check formatting
run: yarn check:format
- name: Check type system
# If TypeScript project references is set up properly, `tsc --build` should work right after dependencies
# has been installed, no extra build/compile step required
id: typeCheckModules
run: yarn type-check
env:
NODE_OPTIONS: --max_old_space_size=8192
- name: Check for unused/missing dependencies
id: depcheck
run: yarn depcheck
env:
NODE_OPTIONS: --max_old_space_size=8192
# (for puppeteer tests)
- name: Install Chrome
uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- name: Test
id: test
run: |
node -v
npm -v
yarn build:cli # Needed for CLI tests
yarn test
env:
SANITY_CI_CLI_AUTH_TOKEN: ${{ secrets.SANITY_CI_CLI_AUTH_TOKEN }}