-
-
Notifications
You must be signed in to change notification settings - Fork 2
178 lines (152 loc) · 6.79 KB
/
ci-install-benchmark.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# Bench yarn with compression vs without + action/cache
name: 'Install benchmarks'
on: [push, workflow_dispatch]
env:
PRISMA_SKIP_POSTINSTALL_GENERATE: 'true'
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 'true'
HUSKY: '0'
jobs:
install-bench:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
# not needed outside benchmarks
- name: ⚙ To ease benchmarks and detection of YARN_RC_FILENAME
run: corepack enable
- name: ♻ Setup yarn cache (no-compress)
uses: actions/cache@v4
id: yarn-benchmark-cache-no-compress
with:
path: ./.yarn/benchmark-cache/no-compress
key: yarn-benchmark-cache-no-compress-v2-${{ hashFiles('yarn.no-compress.lock') }}
restore-keys: |
yarn-benchmark-cache-no-compress-v2-
- name: ♻ Setup yarn cache (mixed-compress)
uses: actions/cache@v4
id: yarn-benchmark-cache-mixed-compress
with:
path: ./.yarn/benchmark-cache/mixed-compress
key: yarn-benchmark-cache-mixed-compress-v2-${{ hashFiles('yarn.mixed-compress.lock') }}
restore-keys: |
yarn-benchmark-cache-mixed-compress-v2-
# PNPM does not rotate the cache (store) like Yarn. When the lock change new packages will
# be added, older won't be removed and so the action/cache storage will grow over time.
# The cache-rotation.YEAR_MONTH allows to invalidate after a period.
- name: ⚙ Cache rotation keys for pnpm (yarn does not need it as it rotates the cache)
id: cache-rotation
run: echo "YEAR_MONTH=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT
- name: ⚙ Install pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: 8.6.0
- name: ⚙ Expose pnpm config(s) through "$GITHUB_OUTPUT"
id: pnpm-config
run: echo "PNPM_STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
# PNPM store seems OS / Architecture dependent while Yarn cache isn't. If the action runs on Win/Mac/Linux
# you'll have 3 caches
- name: ♻ Setup pnpm cache
uses: actions/cache@v4
id: pnpm-benchmark-store-cache
with:
path: ${{ steps.pnpm-config.outputs.PNPM_STORE_PATH }}
key: ${{ runner.os }}-pnpm-benchmark-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-benchmark-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-
- name: 📥 ♻️ Yarn install [CACHE ON | MIXED COMPRESSION]
run: yarn install --immutable --inline-builds
env:
YARN_RC_FILENAME: .yarnrc.mixed-compress.yml
YARN_ENABLE_GLOBAL_CACHE: 'false'
YARN_ENABLE_MIRROR: 'false'
YARN_CACHE_FOLDER: .yarn/benchmark-cache/mixed-compress
YARN_INSTALL_STATE_PATH: .yarn/install-state-mixed-compress.gz
- name: 🧹 Cleanup workspace
run: |
npx -y rimraf@5.0.5 --glob "**/node_modules" ".yarn/install-state*.gz"
yarn cache clean --mirror
npm cache clean --force
ls -la .yarn/benchmark-cache
- name: 📥 ♻️ Yarn install [CACHE ON | NO COMPRESS]
run: yarn install --immutable --inline-builds
env:
YARN_RC_FILENAME: '.yarnrc.no-compress.yml'
YARN_ENABLE_GLOBAL_CACHE: 'false'
YARN_ENABLE_MIRROR: 'false'
YARN_CACHE_FOLDER: '.yarn/benchmark-cache/no-compress'
YARN_INSTALL_STATE_PATH: .yarn/install-state-no-compress.gz
- name: 🧹 Cleanup workspace
run: |
ls -la .yarn/benchmark-cache
npx -y rimraf@5.0.5 --glob "**/node_modules" ".yarn/install-state*.gz"
yarn cache clean --mirror
npm cache clean --force
ls -la .yarn/benchmark-cache
- name: 📥 Yarn install [CACHE OFF | MIXED COMPRESSION]
run: yarn install --immutable --inline-builds
env:
YARN_RC_FILENAME: '.yarnrc.mixed-compress.yml'
YARN_ENABLE_GLOBAL_CACHE: 'false'
YARN_ENABLE_MIRROR: 'false'
YARN_CACHE_FOLDER: '.yarn/benchmark-cache/no-compress'
YARN_INSTALL_STATE_PATH: .yarn/install-state-no-cache.gz
- name: 🧹 Cleanup workspace
run: |
npx -y rimraf@5.0.5 --glob "**/node_modules" ".yarn/install-state*.gz"
yarn cache clean --mirror
npm cache clean --force
- name: 📥 Yarn install [CACHE OFF | NO COMPRESSION]
run: yarn install --immutable --inline-builds
env:
YARN_RC_FILENAME: '.yarnrc.no-compress.yml'
YARN_ENABLE_GLOBAL_CACHE: 'false'
YARN_ENABLE_MIRROR: 'false'
YARN_CACHE_FOLDER: '.yarn/benchmark-cache/no-cache-no-comp'
YARN_INSTALL_STATE_PATH: .yarn/install-state-no-cache-no-compress.gz
- name: 🧹 Cleanup workspace
run: |
npx -y rimraf@5.0.5 --glob "**/node_modules" ".yarn/install-state*.gz"
yarn cache clean --mirror
npm cache clean --force
- name: 📥 ♻️ PNPM install [CACHE ON]
shell: bash
run: pnpm install --frozen-lockfile --prefer-offline
- name: 🧹 Cleanup workspace
run: |
npx -y rimraf@5.0.5 --glob "**/node_modules" ".yarn/install-state*.gz"
yarn cache clean --mirror
npm cache clean --force
- name: 📥 PNPM install [CACHE OFF]
shell: bash
run: pnpm install --store-dir ./node_modules/.pnpm-global-store --frozen-lockfile --prefer-offline
- name: 🧹 Cleanup workspace
run: |
npx -y rimraf@5.0.5 --glob "**/node_modules" ".yarn/install-state*.gz"
yarn cache clean --mirror
npm cache clean --force
- name: ♻ Setup yarn pnp cache (no-compress)
uses: actions/cache@v4
id: yarn-pnp-benchmark-cache-no-compress
with:
path: ./.yarn/benchmark-cache/pnp-no-compress
key: yarn-pnp-benchmark-cache-no-compress-${{ hashFiles('yarn.pnp.no-compress.lock', '.pnp*') }}
restore-keys: |
yarn-pnp-benchmark-cache-no-compress
- name: 📥 Yarn install P'n'P [CACHE ON | NO COMPRESS]
run: yarn install --immutable --inline-builds
continue-on-error: true
env:
YARN_ENABLE_GLOBAL_CACHE: 'false'
YARN_ENABLE_MIRROR: 'false'
YARN_NODE_LINKER: 'pnp'
YARN_NM_MODE: 'hardlinks-local'
YARN_CACHE_FOLDER: '.yarn/benchmark-pnp-cache/no-compress'
YARN_LOCKFILE_FILENAME: 'yarn.pnp.lock'
YARN_COMPRESSION_LEVEL: '0'
YARN_INSTALL_STATE_PATH: .yarn/install-state-pnp-no-compress.gz