-
Notifications
You must be signed in to change notification settings - Fork 71
53 lines (43 loc) · 1.33 KB
/
tests.yml
File metadata and controls
53 lines (43 loc) · 1.33 KB
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
name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: ["lts/-0", "lts/-1", "lts/-2", "lts/-3"]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Enable Corepack
run: corepack enable
- name: Detect Yarn version
id: yarn-version
run: |
YARN_VERSION=$(node -p "
try {
const pm = require('./package.json').packageManager ?? '';
const match = pm.match(/^yarn@(\d+)/);
match ? match[1] : '';
} catch { '' }
")
if [ -z "$YARN_VERSION" ]; then
YARN_VERSION=$(yarn --version | cut -d. -f1)
fi
echo "major=$YARN_VERSION" >> "$GITHUB_OUTPUT"
echo "Detected Yarn major version: $YARN_VERSION"
- name: Install dependencies
run: |
if [ "${{ steps.yarn-version.outputs.major }}" = "1" ]; then
yarn install --frozen-lockfile --non-interactive --prefer-offline
else
yarn install --immutable
fi
- name: Lint
run: yarn lint
- name: Test
run: yarn test