Skip to content

Commit 9d449ca

Browse files
authored
fix: improve reproducibility for apple (#12)
* fix: bump macos to latest * fix: use $HERMES_WS_DIR everywhere * fix: relocate workspace source code to temp folder * fix: hardcode /tmp/hermes in path * fix: use contexts * fix: also use it for other paths * fix: env vars & cp outside workspace * fix: really move to new source directory * fix: additional . * fix: try workaround for tarball * fix: latest is 14, use 15 * fix: don't bump CMake to v4 * fix: remove ls -lR * fix: undo source relocation for npm workflow * fix: remove hdb
1 parent aeddcfe commit 9d449ca

File tree

2 files changed

+70
-86
lines changed

2 files changed

+70
-86
lines changed

.github/workflows/build.yml

Lines changed: 70 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ jobs:
1414
run: |-
1515
sudo apt update && sudo apt install -y libicu-dev
1616
- uses: actions/[email protected]
17-
with:
18-
path: hermes
17+
- name: Copy source to $HERMES_WS_DIR/source
18+
run: |-
19+
mkdir -p $HERMES_WS_DIR
20+
cp -r $GITHUB_WORKSPACE $HERMES_WS_DIR/source
1921
- name: Build Hermes Compiler
2022
run: |-
21-
cmake -S hermes -B $HERMES_WS_DIR/build
22-
# Build the Hermes compiler so that the cross compiler build can
23-
# access it to build the VM
23+
cmake -S $HERMES_WS_DIR/source -B $HERMES_WS_DIR/build
2424
cmake --build $HERMES_WS_DIR/build --target hermesc -j 4
2525
- name: Build Hermes for Android
2626
run: |-
27-
cd hermes/android
27+
cd $HERMES_WS_DIR/source/android
2828
./gradlew githubRelease
2929
- name: Copy artifacts
3030
run: |-
@@ -33,31 +33,35 @@ jobs:
3333
- name: Checksum artifacts
3434
run: |-
3535
cd output
36-
for file in *
37-
do
36+
for file in *; do
3837
sha256sum "$file" > "$file.sha256"
3938
done
4039
- uses: actions/[email protected]
4140
with:
4241
name: android-hermes
4342
path: output
43+
4444
linux:
4545
runs-on: ubuntu-22.04
46+
env:
47+
HERMES_WS_DIR: "/tmp/hermes"
4648
steps:
4749
- name: Install dependencies
4850
run: |-
4951
sudo apt update
5052
sudo apt install -y git openssh-client cmake build-essential \
5153
libreadline-dev libicu-dev zip python3
5254
- uses: actions/[email protected]
53-
with:
54-
path: hermes
55+
- name: Copy source to $HERMES_WS_DIR/source
56+
run: |-
57+
mkdir -p $HERMES_WS_DIR
58+
cp -r $GITHUB_WORKSPACE $HERMES_WS_DIR/source
5559
- name: Build linux CLI
5660
run: |-
57-
cmake -S hermes -B build_hdb -DHERMES_STATIC_LINK=ON -DCMAKE_BUILD_TYPE=Release \
61+
cmake -S $HERMES_WS_DIR/source -B build_hdb -DHERMES_STATIC_LINK=ON -DCMAKE_BUILD_TYPE=Release \
5862
-DCMAKE_CXX_FLAGS=-s -DCMAKE_C_FLAGS=-s \
5963
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--whole-archive -lpthread -Wl,--no-whole-archive"
60-
cmake -S hermes -B build -DHERMES_STATIC_LINK=ON -DCMAKE_BUILD_TYPE=Release \
64+
cmake -S $HERMES_WS_DIR/source -B build -DHERMES_STATIC_LINK=ON -DCMAKE_BUILD_TYPE=Release \
6165
-DCMAKE_CXX_FLAGS=-s -DCMAKE_C_FLAGS=-s \
6266
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--whole-archive -lpthread -Wl,--no-whole-archive" \
6367
-DHERMES_ENABLE_DEBUGGER=False
@@ -76,40 +80,51 @@ jobs:
7680
with:
7781
name: linux-hermes
7882
path: output
83+
7984
macos:
80-
runs-on: macos-14
85+
runs-on: macos-15
86+
env:
87+
TERM: dumb
88+
HERMES_WS_DIR: "/tmp/hermes"
89+
HOMEBREW_NO_AUTO_UPDATE: 1
8190
steps:
8291
- uses: maxim-lobanov/setup-xcode@v1
8392
with:
8493
xcode-version: 16.2
8594
- uses: actions/[email protected]
86-
with:
87-
path: hermes
95+
- name: Copy source to $HERMES_WS_DIR/source
96+
run: |-
97+
mkdir -p $HERMES_WS_DIR
98+
cp -r $GITHUB_WORKSPACE $HERMES_WS_DIR/source
99+
- name: Set up workspace
100+
run: mkdir -p $HERMES_WS_DIR/output
88101
- name: Install dependencies
89-
run: brew install cmake ninja
102+
run: |-
103+
brew install ninja
104+
ninja --version
105+
cmake --version
90106
- name: Build macOS CLI
91107
run: |-
92-
cmake -S hermes -B build -G Ninja ${RELEASE_FLAGS} -DHERMES_ENABLE_DEBUGGER=False
93-
cmake --build ./build --target hermes hvm hbcdump hermesc
94-
cmake -S hermes -B build_hdb -G Ninja ${RELEASE_FLAGS}
95-
cmake --build ./build_hdb --target hdb
108+
cmake -S $HERMES_WS_DIR/source -B $HERMES_WS_DIR/build_macos -G Ninja ${RELEASE_FLAGS} -DHERMES_ENABLE_DEBUGGER=False
109+
cmake --build $HERMES_WS_DIR/build_macos --target hermes hvm hbcdump hermesc
110+
working-directory: ${{ env.HERMES_WS_DIR }}/source
96111
env:
97112
RELEASE_FLAGS: "-DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True -DCMAKE_OSX_ARCHITECTURES=x86_64;arm64 \\ -DBUILD_SHARED_LIBS=OFF -DHERMES_BUILD_SHARED_JSI=OFF"
98113
- name: Create CLI tarball
99114
run: |-
100-
mkdir output staging
101-
cp build/bin/hermes build/bin/hvm build/bin/hbcdump \
102-
build/bin/hermesc build_hdb/bin/hdb staging
103-
tar -C staging -czvf output/${TAR_NAME} .
104-
shasum -a 256 output/${TAR_NAME} > output/${TAR_NAME}.sha256
105-
env:
106-
TAR_NAME: hermes-cli-darwin.tar.gz
115+
mkdir staging
116+
cp $HERMES_WS_DIR/build_macos/bin/{hermes,hvm,hbcdump,hermesc} staging
117+
TARBALL=$HERMES_WS_DIR/output/hermes-cli-darwin.tar.gz
118+
tar -C staging -czvf $TARBALL .
119+
shasum -a 256 $TARBALL > $TARBALL.sha256
120+
working-directory: ${{ env.HERMES_WS_DIR }}/source
107121
- uses: actions/[email protected]
108122
with:
109123
name: macos-hermes
110-
path: output
124+
path: ${{ env.HERMES_WS_DIR }}/output
125+
111126
build-apple-runtime:
112-
runs-on: macos-14
127+
runs-on: macos-15
113128
env:
114129
TERM: dumb
115130
HERMES_WS_DIR: "/tmp/hermes"
@@ -119,81 +134,54 @@ jobs:
119134
with:
120135
xcode-version: 16.2
121136
- uses: actions/[email protected]
122-
- name: Cache setup
123-
uses: actions/cache@v4
124-
with:
125-
key: v4-repo-${{ github.sha }}
126-
path: |-
127-
build_iphoneos
128-
build_catalyst
129-
build_iphonesimulator
130-
destroot
137+
- name: Copy source to $HERMES_WS_DIR/source
138+
run: |-
139+
mkdir -p $HERMES_WS_DIR
140+
cp -r $GITHUB_WORKSPACE $HERMES_WS_DIR/source
131141
- name: Set up workspace
132-
run: mkdir -p /tmp/hermes/output
142+
run: mkdir -p $HERMES_WS_DIR/output
133143
- name: Install dependencies
134144
run: |-
135-
brew install cmake ninja
145+
brew install ninja
136146
sudo gem install cocoapods
147+
ninja --version
148+
cmake --version
137149
- name: Build the iOS frameworks
138150
run: "./utils/build-ios-framework.sh"
151+
working-directory: ${{ env.HERMES_WS_DIR }}/source
139152
- name: Build the Mac frameworks
140153
run: "./utils/build-mac-framework.sh"
141-
package-apple-runtime:
142-
runs-on: macos-14
143-
needs:
144-
- build-apple-runtime
145-
env:
146-
TERM: dumb
147-
HERMES_WS_DIR: "/tmp/hermes"
148-
HOMEBREW_NO_AUTO_UPDATE: 1
149-
steps:
150-
- uses: maxim-lobanov/setup-xcode@v1
151-
with:
152-
xcode-version: 16.2
153-
- uses: actions/[email protected]
154-
- name: Cache setup
155-
uses: actions/cache@v4
156-
with:
157-
key: v4-repo-${{ github.sha }}
158-
path: |-
159-
build_iphoneos
160-
build_catalyst
161-
build_iphonesimulator
162-
destroot
163-
- name: Set up workspace
164-
run: mkdir -p /tmp/hermes/output
165-
- name: Install dependencies
166-
run: |-
167-
brew install cmake ninja
168-
sudo gem install cocoapods
154+
working-directory: ${{ env.HERMES_WS_DIR }}/source
169155
- name: Package the framework
170156
run: |-
171157
. ./utils/build-apple-framework.sh
172158
mkdir -p /tmp/cocoapods-package-root/destroot
173159
cp -R ./destroot /tmp/cocoapods-package-root
174160
cp hermes-engine.podspec LICENSE /tmp/cocoapods-package-root
175-
tar -C /tmp/cocoapods-package-root/ -czvf /tmp/hermes/output/hermes-runtime-darwin-v$(get_release_version).tar.gz .
161+
tar -C /tmp/cocoapods-package-root/ -czvf $HERMES_WS_DIR/output/hermes-runtime-darwin-v$(get_release_version).tar.gz .
162+
working-directory: ${{ env.HERMES_WS_DIR }}/source
176163
- name: Checksum artifacts
177164
run: |-
178-
cd /tmp/hermes/output
179-
for file in *
180-
do
165+
for file in *; do
181166
shasum -a 256 "$file" > "$file.sha256"
182167
done
168+
working-directory: ${{ env.HERMES_WS_DIR }}/output
183169
- uses: actions/[email protected]
184170
with:
185171
name: apple-runtime
186-
path: /tmp/hermes/output/
172+
path: ${{ env.HERMES_WS_DIR }}/output/
173+
187174
npm:
188175
runs-on: ubuntu-22.04
189176
needs:
190-
- android
191-
- linux
192-
- package-apple-runtime
193-
- macos
177+
- android
178+
- linux
179+
- build-apple-runtime
180+
- macos
194181
env:
195182
YARN: yarnpkg
196183
TERM: dumb
184+
HERMES_WS_DIR: "/tmp/hermes"
197185
DEBIAN_FRONTEND: noninteractive
198186
steps:
199187
- uses: actions/[email protected]
@@ -202,12 +190,11 @@ jobs:
202190
node --version
203191
yarn --version
204192
- name: Install dependencies and set up
205-
run: mkdir -p /tmp/hermes/output
193+
run: mkdir -p $HERMES_WS_DIR/output
206194
- uses: actions/[email protected]
207195
- uses: actions/[email protected]
208196
- name: Build NPM
209197
run: |-
210-
ls -lR
211198
cd npm
212199
cp ../macos-hermes/* .
213200
cp ../android-hermes/* .
@@ -219,15 +206,14 @@ jobs:
219206
- name: Copy artifacts
220207
run: |-
221208
cd npm
222-
cp *.tgz /tmp/hermes/output
209+
cp *.tgz $HERMES_WS_DIR/output
223210
- name: Checksum artifacts
224211
run: |-
225-
cd /tmp/hermes/output
226-
for file in *
227-
do
212+
cd $HERMES_WS_DIR/output
213+
for file in *; do
228214
sha256sum "$file" > "$file.sha256"
229215
done
230216
- uses: actions/[email protected]
231217
with:
232218
name: npm-hermes
233-
path: /tmp/hermes/output
219+
path: ${{ env.HERMES_WS_DIR }}/output

npm/hermes-engine-cli/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
"files": [
1212
"README.md",
1313
"linux64-bin/hbcdump",
14-
"linux64-bin/hdb",
1514
"linux64-bin/hermes",
1615
"linux64-bin/hermesc",
1716
"osx-bin/hbcdump",
18-
"osx-bin/hdb",
1917
"osx-bin/hermes",
2018
"osx-bin/hermesc"
2119
]

0 commit comments

Comments
 (0)