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

Commit 1ff4e61

Browse files
Merge pull request #314 from google/update-build-architectures
Upgrade runner and package architectures
2 parents f472b25 + b004f2f commit 1ff4e61

File tree

26 files changed

+513
-52
lines changed

26 files changed

+513
-52
lines changed

.github/workflows/build.yml

Lines changed: 89 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
- name: Install packages
6161
run: yarn install --colors=always
6262
- name: Build jar
63-
# unset ANDROID_HOME to prevent bazel from trying to use the Android SDK
63+
# unset ANDROID_HOME to prevent bazel from trying to use the Android SDK
6464
run: unset ANDROID_HOME && ./build-scripts/build_compiler.js
6565
- name: Tests
6666
run: node_modules/.bin/mocha --colors
@@ -81,9 +81,9 @@ jobs:
8181
build-linux:
8282
name: Build Linux Native Image
8383
needs: build-compiler
84-
runs-on: 'ubuntu-24.04'
84+
runs-on: ubuntu-24.04
8585
env:
86-
NODE_VERSION: '18.x'
86+
NODE_VERSION: '20.x'
8787
FORCE_COLOR: '1'
8888
steps:
8989
- name: Setup Java
@@ -106,7 +106,7 @@ jobs:
106106
native-image-job-reports: 'true'
107107
- name: Setup upx
108108
run: |
109-
UPX_VERSION=3.96
109+
UPX_VERSION=5.0.0
110110
curl --fail --show-error --location --remote-name "https://github.com/upx/upx/releases/download/v$UPX_VERSION/upx-$UPX_VERSION-amd64_linux.tar.xz"
111111
tar -xf upx-$UPX_VERSION-amd64_linux.tar.xz
112112
mv ./upx-$UPX_VERSION-amd64_linux/upx /usr/local/bin/upx
@@ -146,13 +146,84 @@ jobs:
146146
name: Linux image
147147
path: packages/google-closure-compiler-linux/compiler
148148

149+
# Build the native image on Linux
150+
# The runner image determines GLIBC compatibility and should not be changed without
151+
# understanding the impact. See https://github.com/google/closure-compiler-npm/issues/280
152+
build-linux-arm64:
153+
name: Build Linux Native Image for arm processors
154+
needs: build-compiler
155+
runs-on: ubuntu-24.04-arm
156+
env:
157+
NODE_VERSION: '20.x'
158+
FORCE_COLOR: '1'
159+
steps:
160+
- name: Setup Java
161+
uses: actions/setup-java@v4
162+
with:
163+
distribution: adopt-hotspot
164+
java-version: 21
165+
java-package: jdk
166+
architecture: x64
167+
- uses: actions/checkout@v4
168+
- name: Use Node.js ${{ env.NODE_VERSION }}
169+
uses: actions/setup-node@v4
170+
with:
171+
node-version: ${{ env.NODE_VERSION }}
172+
- uses: graalvm/setup-graalvm@v1
173+
with:
174+
java-version: 21
175+
distribution: 'graalvm-community'
176+
github-token: ${{ secrets.GITHUB_TOKEN }}
177+
native-image-job-reports: 'true'
178+
- name: Setup upx
179+
run: |
180+
UPX_VERSION=5.0.0
181+
curl --fail --show-error --location --remote-name "https://github.com/upx/upx/releases/download/v$UPX_VERSION/upx-$UPX_VERSION-arm64_linux.tar.xz"
182+
tar -xf upx-$UPX_VERSION-arm64_linux.tar.xz
183+
mv ./upx-$UPX_VERSION-arm64_linux/upx /usr/local/bin/upx
184+
- name: Download compiler jar
185+
uses: actions/download-artifact@v4
186+
with:
187+
name: Compiler.jar
188+
path: packages/google-closure-compiler-java/
189+
- name: Download contrib folder
190+
uses: actions/download-artifact@v4
191+
with:
192+
name: Contrib folder
193+
path: packages/google-closure-compiler/contrib
194+
- name: Get yarn cache directory path
195+
run: echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_ENV
196+
- name: Cache yarn
197+
uses: actions/cache@v4
198+
id: yarn-cache
199+
with:
200+
path: ${{ env.yarn_cache_dir }}
201+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
202+
restore-keys: |
203+
${{ runner.os }}-yarn-
204+
- name: Install packages
205+
run: yarn install --colors=always
206+
- name: Build image
207+
working-directory: packages/google-closure-compiler-linux-arm64
208+
run: |
209+
cp ../google-closure-compiler-java/compiler.jar compiler.jar
210+
yarn run build
211+
upx compiler
212+
- name: Tests
213+
run: yarn workspaces run test --colors
214+
- name: Upload artifacts
215+
uses: actions/upload-artifact@v4
216+
with:
217+
name: Linux arm64 image
218+
path: packages/google-closure-compiler-linux-arm64/compiler
219+
149220
# Build the native image on MacOS
150221
build-macos:
151222
name: Build MacOS Native Image
152223
needs: build-compiler
153224
runs-on: macos-latest
154225
env:
155-
NODE_VERSION: '20.x'
226+
NODE_VERSION: '22.x'
156227
FORCE_COLOR: '1'
157228
steps:
158229
- name: Setup Java
@@ -199,7 +270,7 @@ jobs:
199270
- name: Install packages
200271
run: yarn install --colors=always
201272
- name: Build image
202-
working-directory: packages/google-closure-compiler-osx
273+
working-directory: packages/google-closure-compiler-macos
203274
run: |
204275
cp ../google-closure-compiler-java/compiler.jar compiler.jar
205276
yarn run build
@@ -210,15 +281,15 @@ jobs:
210281
uses: actions/upload-artifact@v4
211282
with:
212283
name: MacOS image
213-
path: packages/google-closure-compiler-osx/compiler
284+
path: packages/google-closure-compiler-macos/compiler
214285

215286
# Build the native image on Windows
216287
build-windows:
217288
name: Build Windows Native Image
218289
needs: build-compiler
219290
runs-on: windows-latest
220291
env:
221-
NODE_VERSION: '20.x'
292+
NODE_VERSION: '22.x'
222293
FORCE_COLOR: '1'
223294
steps:
224295
- name: Setup Java
@@ -284,12 +355,13 @@ jobs:
284355
runs-on: ubuntu-latest
285356
if: ${{ github.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
286357
env:
287-
NODE_VERSION: '20.x'
358+
NODE_VERSION: '22.x'
288359
COMPILER_NIGHTLY: ${{ github.event_name == 'schedule' }}
289360
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_AUTH_TOKEN }}
290361
FORCE_COLOR: '1'
291362
needs:
292363
- build-linux
364+
- build-linux-arm64
293365
- build-macos
294366
- build-windows
295367
steps:
@@ -309,11 +381,16 @@ jobs:
309381
with:
310382
name: Linux image
311383
path: packages/google-closure-compiler-linux/
384+
- name: Download Linux arm64 image
385+
uses: actions/download-artifact@v4
386+
with:
387+
name: Linux arm64 image
388+
path: packages/google-closure-compiler-linux-arm64/
312389
- name: Download MacOS image
313390
uses: actions/download-artifact@v4
314391
with:
315392
name: MacOS image
316-
path: packages/google-closure-compiler-osx/
393+
path: packages/google-closure-compiler-macos/
317394
- name: Download Windows image
318395
uses: actions/download-artifact@v4
319396
with:
@@ -327,7 +404,8 @@ jobs:
327404
- name: Mark binaries executable
328405
run: |
329406
chmod 755 packages/google-closure-compiler-linux/compiler
330-
chmod 755 packages/google-closure-compiler-osx/compiler
407+
chmod 755 packages/google-closure-compiler-linux-arm64/compiler
408+
chmod 755 packages/google-closure-compiler-macos/compiler
331409
chmod 755 packages/google-closure-compiler-windows/compiler.exe
332410
- name: Get yarn cache directory path
333411
run: echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_ENV

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
contents: write
1717
env:
1818
FORCE_COLOR: '1'
19-
NODE_VERSION: '20.x'
19+
NODE_VERSION: '22.x'
2020
steps:
2121
- name: Use Node.js ${{ env.NODE_VERSION }}
2222
uses: actions/setup-node@v4

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ yarn-error.log
66
/packages/google-closure-compiler-java/compiler.jar
77
/packages/google-closure-compiler-linux/compiler.jar
88
/packages/google-closure-compiler-linux/compiler
9-
/packages/google-closure-compiler-osx/compiler.jar
10-
/packages/google-closure-compiler-osx/compiler
9+
/packages/google-closure-compiler-linux-arm64/compiler.jar
10+
/packages/google-closure-compiler-linux-arm64/compiler
11+
/packages/google-closure-compiler-macos/compiler.jar
12+
/packages/google-closure-compiler-macos/compiler
1113
/packages/google-closure-compiler-windows/compiler.*
12-
/packages/google-closure-compiler-js/jscomp.js
1314
/temp
1415
/publish-log.txt
1516
.npmrc

build-scripts/add-os-restrictions.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ const path = require('path');
2828

2929
// Maps of the os marketing name to the platform name used in package.json os restriction fields
3030
const osRestrictions = new Map([
31-
['osx', {os: ['darwin'], cpu: ['x32', 'x64', 'arm64']}],
31+
['macos', {os: ['darwin'], cpu: ['arm64']}],
3232
['linux', {os: ['linux'], cpu: ['x32', 'x64']}],
33+
['linux-arm64', {os: ['linux'], cpu: ['arm64']}],
3334
['windows', {os: ['win32'], cpu: ['x32', 'x64']}]
3435
]);
3536

build-scripts/build_compiler.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,13 @@ async function main() {
7878
compilerJavaBinaryPath,
7979
'./packages/google-closure-compiler-linux/compiler.jar'
8080
),
81+
copy(
82+
compilerJavaBinaryPath,
83+
'./packages/google-closure-compiler-linux/compiler-arm64.jar'
84+
),
8185
copy(
8286
compilerJavaBinaryPath,
83-
'./packages/google-closure-compiler-osx/compiler.jar'
87+
'./packages/google-closure-compiler-macos/compiler.jar'
8488
),
8589
copy(
8690
compilerJavaBinaryPath,

build-scripts/clean.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ rm -rf ./packages/google-closure-compiler/contrib
44
rm ./packages/google-closure-compiler-java/compiler.jar
55
rm ./packages/google-closure-compiler-linux/compiler.jar
66
rm ./packages/google-closure-compiler-linux/compiler
7-
rm ./packages/google-closure-compiler-osx/compiler.jar
8-
rm ./packages/google-closure-compiler-osx/compiler
7+
rm ./packages/google-closure-compiler-linux-arm64/compiler.jar
8+
rm ./packages/google-closure-compiler-linux-arm64/compiler
9+
rm ./packages/google-closure-compiler-macos/compiler.jar
10+
rm ./packages/google-closure-compiler-macos/compiler
911
rm ./packages/google-closure-compiler-windows/compiler.jar
1012
rm ./packages/google-closure-compiler-windows/compiler.exe
1113
cd ./compiler && mvn clean

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"packages": [
77
"packages/google-closure-compiler-java",
88
"packages/google-closure-compiler-linux",
9-
"packages/google-closure-compiler-osx",
9+
"packages/google-closure-compiler-linux-arm64",
10+
"packages/google-closure-compiler-macos",
1011
"packages/google-closure-compiler-windows",
1112
"packages/google-closure-compiler"
1213
],

packages/google-closure-compiler-js/readme.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)