Skip to content
This repository was archived by the owner on Nov 19, 2025. It is now read-only.

Commit a6d544e

Browse files
authored
Merge pull request #329 from google/upgrade-yarn
Upgrade to yarn 4
2 parents 3da6b1a + 98fbbe2 commit a6d544e

File tree

9 files changed

+4575
-2561
lines changed

9 files changed

+4575
-2561
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,18 @@ jobs:
4747
- name: Fetch submodule tags
4848
working-directory: compiler
4949
run: git fetch --tags https://github.com/google/closure-compiler.git
50-
- name: Get yarn cache directory path
51-
run: echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_ENV
52-
- name: Yarn and maven cache
53-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
54-
with:
55-
path: |
56-
${{ env.yarn_cache_dir }}
57-
~/.m2/repository
58-
key: ${{ runner.os }}-yarn-mvn-java11-${{ hashFiles('**/yarn.lock', '**/pom.xml') }}
50+
- name: Use Node.js ${{ env.NODE_VERSION }}
51+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # 4.4.0
52+
with:
53+
node-version: ${{ env.NODE_VERSION }}
54+
cache: yarn
5955
- name: Install packages
60-
run: yarn install --colors=always
56+
run: YARN_ENABLE_COLORS=true yarn install
6157
- name: Build jar
6258
# unset ANDROID_HOME to prevent bazel from trying to use the Android SDK
6359
run: unset ANDROID_HOME && ./build-scripts/build-compiler.js
6460
- name: Tests
65-
run: yarn test:root --color
61+
run: YARN_ENABLE_COLORS=true yarn test:root
6662
- name: Upload contrib folder
6763
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
6864
with:
@@ -137,6 +133,7 @@ jobs:
137133
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # 4.4.0
138134
with:
139135
node-version: ${{ env.NODE_VERSION }}
136+
cache: yarn
140137
- name: Install GraalVM
141138
uses: graalvm/setup-graalvm@01ed653ac833fe80569f1ef9f25585ba2811baab # 1.3.3
142139
with:
@@ -159,26 +156,16 @@ jobs:
159156
with:
160157
name: Externs folder
161158
path: packages/google-closure-compiler/externs
162-
- name: Get yarn cache directory path
163-
run: echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_ENV
164-
- name: Cache yarn
165-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
166-
id: yarn-cache
167-
with:
168-
path: ${{ env.yarn_cache_dir }}
169-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
170-
restore-keys: |
171-
${{ runner.os }}-yarn-
172159
- name: Install packages
173-
run: yarn install --colors=always
160+
run: YARN_ENABLE_COLORS=true yarn install
174161
- name: Build image
175162
working-directory: packages/google-closure-compiler-linux
176163
run: |
177164
export PATH="$MUSL_HOME/bin:$PATH"
178165
cp ../google-closure-compiler-java/compiler.jar compiler.jar
179166
yarn run build
180167
- name: Tests
181-
run: yarn workspaces run test --color
168+
run: FORCE_COLOR=1 yarn workspaces foreach -A --no-private run test
182169
- name: Upload artifacts
183170
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
184171
with:
@@ -204,6 +191,7 @@ jobs:
204191
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # 4.4.0
205192
with:
206193
node-version: ${{ env.NODE_VERSION }}
194+
cache: yarn
207195
- name: Setup GraalVM
208196
uses: graalvm/setup-graalvm@01ed653ac833fe80569f1ef9f25585ba2811baab # 1.3.3
209197
with:
@@ -226,25 +214,15 @@ jobs:
226214
with:
227215
name: Externs folder
228216
path: packages/google-closure-compiler/externs
229-
- name: Get yarn cache directory path
230-
run: echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_ENV
231-
- name: Cache yarn
232-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
233-
id: yarn-cache
234-
with:
235-
path: ${{ env.yarn_cache_dir }}
236-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
237-
restore-keys: |
238-
${{ runner.os }}-yarn-
239217
- name: Install packages
240-
run: yarn install --colors=always
218+
run: YARN_ENABLE_COLORS=true yarn install
241219
- name: Build image
242220
working-directory: packages/google-closure-compiler-linux-arm64
243221
run: |
244222
cp ../google-closure-compiler-java/compiler.jar compiler.jar
245223
yarn run build
246224
- name: Tests
247-
run: yarn workspaces run test --color
225+
run: FORCE_COLOR=1 yarn workspaces foreach -A --no-private run test
248226
- name: Upload artifacts
249227
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
250228
with:
@@ -268,6 +246,7 @@ jobs:
268246
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # 4.4.0
269247
with:
270248
node-version: ${{ env.NODE_VERSION }}
249+
cache: yarn
271250
- name: Setup GraalVM
272251
uses: graalvm/setup-graalvm@01ed653ac833fe80569f1ef9f25585ba2811baab # 1.3.3
273252
with:
@@ -290,25 +269,15 @@ jobs:
290269
with:
291270
name: Externs folder
292271
path: packages/google-closure-compiler/externs
293-
- name: Get yarn cache directory path
294-
run: echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_ENV
295-
- name: Cache yarn
296-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
297-
id: yarn-cache
298-
with:
299-
path: ${{ env.yarn_cache_dir }}
300-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
301-
restore-keys: |
302-
${{ runner.os }}-yarn-
303272
- name: Install packages
304-
run: yarn install --colors=always
273+
run: YARN_ENABLE_COLORS=true yarn install
305274
- name: Build image
306275
working-directory: packages/google-closure-compiler-macos
307276
run: |
308277
cp ../google-closure-compiler-java/compiler.jar compiler.jar
309278
yarn run build
310279
- name: Tests
311-
run: yarn workspaces run test --color
280+
run: FORCE_COLOR=1 yarn workspaces foreach -A --no-private run test
312281
- name: Upload artifacts
313282
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
314283
with:
@@ -332,6 +301,7 @@ jobs:
332301
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # 4.4.0
333302
with:
334303
node-version: ${{ env.NODE_VERSION }}
304+
cache: yarn
335305
- name: Setup GraalVM
336306
uses: graalvm/setup-graalvm@01ed653ac833fe80569f1ef9f25585ba2811baab # 1.3.3
337307
with:
@@ -354,29 +324,16 @@ jobs:
354324
with:
355325
name: Externs folder
356326
path: packages/google-closure-compiler/externs
357-
- name: Get yarn cache directory path
358-
# See https://stackoverflow.com/a/66737579/1211524
359-
run: echo "yarn_cache_dir=$(yarn cache dir)" >> $env:GITHUB_ENV
360-
- name: Cache yarn
361-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
362-
id: yarn-cache
363-
with:
364-
path: ${{ env.yarn_cache_dir }}
365-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
366-
restore-keys: |
367-
${{ runner.os }}-yarn-
368327
- name: Install packages
369-
run: yarn install --colors=always
328+
run: yarn install
370329
- name: Build image
371330
working-directory: packages/google-closure-compiler-windows
372331
run: |
373332
cp ../google-closure-compiler-java/compiler.jar compiler.jar
374333
yarn run build
375334
- name: Tests
376335
shell: cmd
377-
run: |
378-
echo "Running Tests"
379-
yarn workspaces run test --color
336+
run: yarn workspaces foreach -A --no-private run test
380337
- name: Upload artifacts
381338
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
382339
with:
@@ -407,6 +364,7 @@ jobs:
407364
with:
408365
node-version: ${{ env.NODE_VERSION }}
409366
registry-url: https://registry.npmjs.org/
367+
cache: yarn
410368
- name: Download compiler jar
411369
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # 4.3.0
412370
with:
@@ -448,18 +406,8 @@ jobs:
448406
chmod 755 packages/google-closure-compiler-linux-arm64/compiler
449407
chmod 755 packages/google-closure-compiler-macos/compiler
450408
chmod 755 packages/google-closure-compiler-windows/compiler.exe
451-
- name: Get yarn cache directory path
452-
run: echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_ENV
453-
- name: Cache yarn
454-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
455-
id: yarn-cache
456-
with:
457-
path: ${{ env.yarn_cache_dir }}
458-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
459-
restore-keys: |
460-
${{ runner.os }}-yarn-
461409
- name: Install packages
462-
run: yarn install --colors=always
410+
run: YARN_ENABLE_COLORS=true yarn install
463411
- name: Prepare for publish
464412
run: ./build-scripts/add-os-restrictions.js
465413
- name: Configure yarn

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
restore-keys: |
4242
${{ runner.os }}-yarn-
4343
- name: Install packages
44-
run: yarn install --colors=always
44+
run: YARN_ENABLE_COLORS=true yarn install
4545
- name: Fetch compiler submodule tags
4646
working-directory: compiler
4747
run: git fetch --tags https://github.com/google/closure-compiler.git

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,10 @@ yarn-error.log
1717
/temp
1818
/zlib
1919
.npmrc
20+
.pnp.*
21+
.yarn/*
22+
!.yarn/patches
23+
!.yarn/plugins
24+
!.yarn/releases
25+
!.yarn/sdks
26+
!.yarn/versions

0 commit comments

Comments
 (0)