-
Notifications
You must be signed in to change notification settings - Fork 2.7k
93 lines (81 loc) · 2.71 KB
/
ci.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
90
91
92
93
name: CI
env:
NODE_OPTIONS: --max-old-space-size=6144
on:
push:
branches:
- master
paths-ignore:
- 'examples/**'
- 'docs/**'
- '**/*.md'
pull_request:
types:
- 'opened'
- 'synchronize'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
os: [ubuntu-latest, windows-latest]
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install pnpm
if: ${{ matrix.node-version != '14.x' }}
uses: pnpm/[email protected]
- name: Get pnpm version (node 14)
if: ${{ matrix.node-version == '14.x' }}
uses: actions/github-script@v7
id: pnpm-version
with:
result-encoding: string
script: |
const packageJson = require('./package.json')
const pnpmVersion = packageJson.packageManager.split('@')[1]
console.log(`Use pnpm ${pnpmVersion}`)
return pnpmVersion
- name: Install pnpm (node 14)
if: ${{ matrix.node-version == '14.x' }}
run: |
npm install -g @pnpm/exe@${{ steps.pnpm-version.outputs.result }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org/'
cache: 'pnpm'
# We use week in the turbo cache key to keep the cache from infinitely growing
- name: Get cache expires mark (non-windows)
if: runner.os != 'Windows'
run: echo "EXPIRES_WEEK_MARK=$(date +%U)" >> $GITHUB_OUTPUT
- name: Get cache expires mark (windows)
if: runner.os == 'Windows'
run: echo "EXPIRES_WEEK_MARK=$(date +%U)" >> $env:GITHUB_OUTPUT
- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ github.job }}-${{ runner.os }}-node${{ matrix.node-version }}-${{ github.ref_name }}-${{ env.EXPIRES_WEEK_MARK }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ runner.os }}-node${{ matrix.node-version }}-
turbo-${{ github.job }}-${{ runner.os }}-node${{ matrix.node-version }}-${{ github.ref_name }}-${{ env.EXPIRES_WEEK_MARK }}-
- name: Install dependencies
run: pnpm i
- run: pnpm build
- run: pnpm run setup
- run: pnpm tsc:check
- run: pnpm test
- run: pnpm check:packageFiles
env:
CI: true
NODE_ENV: test