-
Notifications
You must be signed in to change notification settings - Fork 3
48 lines (39 loc) · 1.09 KB
/
main.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
name: Test
on:
push:
branches:
- '*'
- '!main'
pull_request:
branches:
- '*'
- '!main'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node 18
uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Get yarn version
run: echo "yarn_version=$(yarn -v)" >> $GITHUB_ENV
- name: Get yarn(v1) cache directory path
if: startsWith(env.yarn_version, '1')
run: echo "cache_dir=$(yarn cache dir)" >> $GITHUB_ENV
- name: Get yarn(v2) cache directory path
if: startsWith(env.yarn_version, '2')
run: echo "cache_dir=$(yarn config get cacheFolder)"
- name: Cache Node.js modules
id: yarn-cache
uses: actions/cache@v4
with:
path: ${{ env.cache_dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn --frozen-lockfile
- run: yarn build
- run: yarn test