-
Notifications
You must be signed in to change notification settings - Fork 35
85 lines (70 loc) · 2.55 KB
/
validate.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
name: Validate
on: [push, pull_request]
jobs:
skip_check:
name: Check concurrent runs
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- uses: fkirc/skip-duplicate-actions@v5
id: skip_check
with:
concurrent_skipping: same_content_newer
cancel_others: true
# We want to skip only concurrent runs. Subsequent runs/retries should be allowed.
skip_after_successful_duplicate: false
test:
name: Lint & Test
needs: skip_check
if: needs.skip_check.outputs.should_skip != 'true'
runs-on: ubuntu-latest
env:
CI: true
timeout-minutes: 30
steps:
- name: Check out Repo
uses: actions/checkout@v4
- id: pnpm-setup
uses: pnpm/action-setup@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
cache: pnpm
node-version-file: package.json
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Set Puppeteer Cache Directory
id: set-puppeteer-cache
run: echo "PUPPETEER_CACHE_DIR=$HOME/.cache/puppeteer" >> $GITHUB_OUTPUT
- name: Cache Puppeteer
id: puppeteer-cache
uses: actions/cache@v4
with:
path: ${{ steps.set-puppeteer-cache.outputs.PUPPETEER_CACHE_DIR }}
key: puppeteer-${{ runner.os }}-${{ hashFiles('./pnpm-lock.yaml') }}
- name: Cache babel-loader
id: babel-loader-cache
uses: actions/cache@v4
with:
path: 'fixtures/*/node_modules/.cache/babel-loader'
key: babel-loader-${{ runner.os }}-${{ hashFiles('./pnpm-lock.yaml') }}
- name: Install Puppeteer
if: steps.puppeteer-cache.outputs.cache-hit != 'true'
run: pnpm puppeteer browsers install chrome
- name: Set up hosts
# Couldn't get `sudo pnpm setup-test-hosts` to work
run: sudo ${{ steps.pnpm-setup.outputs.bin_dest }}/pnpm setup-test-hosts
- name: Lint
run: pnpm lint
- name: Set Jest Cache Directory
id: set-jest-cache
run: echo "JEST_CACHE_DIR=$(pnpm jest --showConfig | jq '.configs[0].cacheDirectory' | tr -d '"')" >> $GITHUB_OUTPUT
- name: Cache Jest cache
uses: actions/cache@v4
with:
path: ${{ steps.set-jest-cache.outputs.JEST_CACHE_DIR }}
key: jest-${{ runner.os }}-${{ hashFiles('./pnpm-lock.yaml') }}
restore-keys: jest-${{ runner.os }}-
- name: Test
run: pnpm run test && pnpm run test:sku-init