Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.

Commit 6934283

Browse files
authored
fix(ci): correctly build arm64v8 and armv7l/arm32v7 binaries using QEMU machine emulation - close #1051 (#1090)
* test: build armv7l and arm64v8 binaries using QEMU emulation #1051 * fix: use a 3-opts matrix for qemu emul buils, fix typo * chore: remove leftover -qemu ci jobs * fix: ci linux qemu cross-build: prevent unexpected crossbuilds * feat: ci: disable fail-fast * test: ci: specify electron-builder opts right in workflow file * test: use arm64 ubuntu container on Actions * test * test2 * test2 * test2 * test2 * test3 * test4 * refactor: move arm64 builds to separate job * fix typo * fix: docker image name cannot be set with matrix otps * fix missing rsync binary in arm64 node image * fix missing rsync binary in arm64 node image * fix missing rsync binary in arm64 node image * perf: speed up arm64 qemu builds * remove broken arm32v7 pipeline * fix npm permissions errors on arm64 * do not restore incorrect caches * rename linux-arm64 artifact to prevent conflicts * test: re-enable qemu arm7 platform support * fix ci job name typo * cleanup workflow file * disable broken apple silicon builds
1 parent 076a788 commit 6934283

File tree

2 files changed

+106
-68
lines changed

2 files changed

+106
-68
lines changed

.github/workflows/build-binaries.yaml

Lines changed: 103 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ on: [push, pull_request, create]
55
jobs:
66
build-linux:
77
runs-on: ubuntu-latest
8-
strategy:
9-
matrix:
10-
node-version: [14.x]
118
steps:
12-
- uses: actions/checkout@v1
9+
- uses: actions/checkout@v2
1310
- name: Cache node modules
1411
uses: actions/cache@v2
1512
env:
@@ -18,10 +15,6 @@ jobs:
1815
# npm cache files are stored in `~/.npm` on Linux/macOS
1916
path: ~/.npm
2017
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
21-
restore-keys: |
22-
${{ runner.os }}-build-${{ env.cache-name }}-
23-
${{ runner.os }}-build-
24-
${{ runner.os }}-
2518
- name: Cache Electron binaries
2619
uses: actions/cache@v2
2720
env:
@@ -31,24 +24,22 @@ jobs:
3124
# https://github.com/electron/get#how-it-works
3225
path: ~/.cache/electron
3326
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
34-
restore-keys: |
35-
${{ runner.os }}-build-${{ env.cache-name }}-
36-
${{ runner.os }}-build-
37-
${{ runner.os }}-
38-
- name: Install system dependencies
27+
- name: Install system dependencies for x64->x32 cross-build
3928
run: |
4029
sudo apt update
4130
sudo apt install libc6-dev-i386 gcc-multilib g++-multilib
42-
- name: Use Node.js ${{ matrix.node-version }}
31+
- name: Setup Node.js
4332
uses: actions/setup-node@v1
4433
with:
45-
node-version: ${{ matrix.node-version }}
46-
- name: set up env
47-
run: |
48-
npm install
49-
- name: npm build
50-
run: |
51-
npm run build-linux
34+
node-version: 14
35+
- name: Setup npm
36+
run: sudo npm i -g npm@7
37+
- name: Install build deps
38+
run: npm install
39+
- name: Run prebuild script
40+
run: npm run prebuild-linux
41+
- name: Build for x64 / ia32
42+
run: ./node_modules/.bin/electron-builder build -l --x64 --ia32
5243
env:
5344
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5445
- uses: actions/upload-artifact@v2
@@ -57,11 +48,86 @@ jobs:
5748
path: dist/*.AppImage
5849
if-no-files-found: error
5950

51+
build-linux-arm32:
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v2
55+
- name: Setup QEMU
56+
uses: docker/setup-qemu-action@v1
57+
with:
58+
platforms: arm
59+
- name: Cache node modules
60+
uses: actions/cache@v2
61+
env:
62+
cache-name: cache-node-modules
63+
with:
64+
# npm cache files are stored in `~/.npm` on Linux/macOS
65+
path: ~/.npm
66+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
67+
- name: Cache Electron binaries
68+
uses: actions/cache@v2
69+
env:
70+
cache-name: cache-electron-bins
71+
with:
72+
# cache location is described here:
73+
# https://github.com/electron/get#how-it-works
74+
path: ~/.cache/electron
75+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
76+
- name: Run prebuild outside of QEMU emulator
77+
run: sudo npm i -g npm@7 && npm install && rsync -a --info=progress2 src/ prebuild-src --exclude node_modules && node prebuild-minify.js && rm -rf node_modules
78+
- name: Build for arm32v7 (aka armv7l)
79+
uses: docker://arm32v7/node:14-buster
80+
with:
81+
args: bash -c "npm i -g npm@7 && npm install && ./node_modules/.bin/electron-builder build -l --armv7l"
82+
env:
83+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
- uses: actions/upload-artifact@v2
85+
with:
86+
name: Linux-arm32-AppImage
87+
path: dist/*.AppImage
88+
if-no-files-found: error
89+
90+
build-linux-arm64:
91+
runs-on: ubuntu-latest
92+
steps:
93+
- uses: actions/checkout@v2
94+
- name: Setup QEMU
95+
uses: docker/setup-qemu-action@v1
96+
with:
97+
platforms: arm64
98+
- name: Cache node modules
99+
uses: actions/cache@v2
100+
env:
101+
cache-name: cache-node-modules
102+
with:
103+
# npm cache files are stored in `~/.npm` on Linux/macOS
104+
path: ~/.npm
105+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
106+
- name: Cache Electron binaries
107+
uses: actions/cache@v2
108+
env:
109+
cache-name: cache-electron-bins
110+
with:
111+
# cache location is described here:
112+
# https://github.com/electron/get#how-it-works
113+
path: ~/.cache/electron
114+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
115+
- name: Run prebuild outside of QEMU emulator
116+
run: sudo npm i -g npm@7 && npm install && rsync -a --info=progress2 src/ prebuild-src --exclude node_modules && node prebuild-minify.js && rm -rf node_modules
117+
- name: Build for arm64 (aka arm64v8)
118+
uses: docker://arm64v8/node:14-buster
119+
with:
120+
args: bash -c "npm i -g npm@7 && npm install && ./node_modules/.bin/electron-builder build -l --arm64"
121+
env:
122+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123+
- uses: actions/upload-artifact@v2
124+
with:
125+
name: Linux-arm64-AppImage
126+
path: dist/*.AppImage
127+
if-no-files-found: error
128+
60129
build-windows:
61130
runs-on: windows-latest
62-
strategy:
63-
matrix:
64-
node-version: [14.x]
65131
steps:
66132
- uses: actions/checkout@v1
67133
- name: Get npm cache directory
@@ -72,8 +138,6 @@ jobs:
72138
with:
73139
path: ${{ steps.npm-cache.outputs.dir }}
74140
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
75-
restore-keys: |
76-
${{ runner.os }}-node-
77141
- name: Cache Electron binaries
78142
uses: actions/cache@v2
79143
env:
@@ -83,20 +147,16 @@ jobs:
83147
# https://github.com/electron/get#how-it-works
84148
path: ~/AppData/Local/electron/Cache
85149
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
86-
restore-keys: |
87-
${{ runner.os }}-build-${{ env.cache-name }}-
88-
${{ runner.os }}-build-
89-
${{ runner.os }}-
90-
- name: Use Node.js ${{ matrix.node-version }}
150+
- name: Setup Node.js
91151
uses: actions/setup-node@v1
92152
with:
93-
node-version: ${{ matrix.node-version }}
153+
node-version: 14
154+
- name: Setup npm
155+
run: npm i -g npm@7
94156
- name: npm install
95-
run: |
96-
npm install
157+
run: npm install
97158
- name: npm build
98-
run: |
99-
npm run build-windows
159+
run: npm run build-windows
100160
env:
101161
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102162
- uses: actions/upload-artifact@v2
@@ -107,9 +167,6 @@ jobs:
107167

108168
build-darwin:
109169
runs-on: macos-latest
110-
strategy:
111-
matrix:
112-
node-version: [14.x]
113170
steps:
114171
- uses: actions/checkout@v1
115172
- name: Cache node modules
@@ -120,10 +177,6 @@ jobs:
120177
# npm cache files are stored in `~/.npm` on Linux/macOS
121178
path: ~/.npm
122179
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
123-
restore-keys: |
124-
${{ runner.os }}-build-${{ env.cache-name }}-
125-
${{ runner.os }}-build-
126-
${{ runner.os }}-
127180
- name: Cache Electron binaries
128181
uses: actions/cache@v2
129182
env:
@@ -133,20 +186,16 @@ jobs:
133186
# https://github.com/electron/get#how-it-works
134187
path: ~/Library/Caches/electron
135188
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
136-
restore-keys: |
137-
${{ runner.os }}-build-${{ env.cache-name }}-
138-
${{ runner.os }}-build-
139-
${{ runner.os }}-
140-
- name: Use Node.js ${{ matrix.node-version }}
189+
- name: Setup Node.js
141190
uses: actions/setup-node@v1
142191
with:
143-
node-version: ${{ matrix.node-version }}
144-
- name: set up env
145-
run: |
146-
npm install
192+
node-version: 14
193+
- name: Setup npm
194+
run: sudo npm i -g npm@7
195+
- name: npm install
196+
run: npm install
147197
- name: npm build
148-
run: |
149-
npm run build-darwin
198+
run: npm run build-darwin
150199
env:
151200
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
152201
- uses: actions/upload-artifact@v2

package.json

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"prebuild-linux": "rsync -a --info=progress2 src/ prebuild-src --exclude node_modules && node prebuild-minify.js && cd prebuild-src && npm install",
2121
"prebuild-darwin": "rsync -a src/ prebuild-src --exclude node_modules && node prebuild-minify.js && cd prebuild-src && npm install",
2222
"prebuild-windows": "mkdir prebuild-src && xcopy src\\* prebuild-src\\ /E /C /Q /Y && node prebuild-minify.js && cd prebuild-src && npm install",
23-
"build-linux": "./node_modules/.bin/electron-builder build -l",
23+
"build-linux": "./node_modules/.bin/electron-builder build -l --x64 --ia32 --arm64 --armv7l",
2424
"build-darwin": "./node_modules/.bin/electron-builder build -m",
2525
"build-windows": "node_modules\\.bin\\electron-builder build -w",
2626
"postbuild-linux": "rm -R prebuild-src",
@@ -55,17 +55,7 @@
5555
"npmRebuild": true,
5656
"artifactName": "eDEX-UI-${os}-${arch}.${ext}",
5757
"linux": {
58-
"target": [
59-
{
60-
"target": "AppImage",
61-
"arch": [
62-
"x64",
63-
"ia32",
64-
"arm64",
65-
"armv7l"
66-
]
67-
}
68-
],
58+
"target": ["AppImage"],
6959
"category": "System",
7060
"icon": "media/linuxIcons"
7161
},
@@ -77,8 +67,7 @@
7767
{
7868
"target": "dmg",
7969
"arch": [
80-
"x64",
81-
"arm64"
70+
"x64"
8271
]
8372
}
8473
],

0 commit comments

Comments
 (0)