@@ -234,23 +234,32 @@ jobs:
234234 # It is not feasible to cross-compile with CentOS.
235235
236236 # Cross-compile notes: To compile native dependencies for arm64,
237- # we install the aarch64 cross toolchain and then set it as the default
237+ # we install the aarch64/armv7l cross toolchain and then set it as the default
238238 # compiler/linker/etc. with the AR/CC/CXX/LINK environment variables.
239239 # qemu-user-static on ubuntu-16.04 currently doesn't run Node correctly,
240- # so we just build with "native"/x86_64 node, then download arm64 node
241- # and then put it in our release. We can't smoke test the arm64 build this way,
240+ # so we just build with "native"/x86_64 node, then download arm64/armv7l node
241+ # and then put it in our release. We can't smoke test the cross build this way,
242242 # but this means we don't need to maintain a self-hosted runner!
243- package-linux-arm64 :
244- name : Linux ARM64 cross-compile build
243+ package-linux-cross :
244+ name : Linux cross-compile builds
245245 needs : build
246246 runs-on : ubuntu-16.04
247247 timeout-minutes : 15
248+ strategy :
249+ matrix :
250+ include :
251+ - prefix : aarch64-linux-gnu
252+ arch : arm64
253+ - prefix : arm-linux-gnueabihf
254+ arch : armv7l
255+
248256 env :
249- AR : aarch64-linux-gnu-ar
250- CC : aarch64-linux-gnu-gcc
251- CXX : aarch64-linux-gnu-g++
252- LINK : aarch64-linux-gnu-g++
253- NPM_CONFIG_ARCH : arm64
257+ AR : ${{ format('{0}-ar', matrix.prefix) }}
258+ CC : ${{ format('{0}-gcc', matrix.prefix) }}
259+ CXX : ${{ format('{0}-g++', matrix.prefix) }}
260+ LINK : ${{ format('{0}-g++', matrix.prefix) }}
261+ NPM_CONFIG_ARCH : ${{ matrix.arch }}
262+ NODE_VERSION : v14.17.4
254263
255264 steps :
256265 - uses : actions/checkout@v2
@@ -266,7 +275,9 @@ jobs:
266275 echo "$HOME/.local/bin" >> $GITHUB_PATH
267276
268277 - name : Install cross-compiler
269- run : sudo apt install g++-aarch64-linux-gnu
278+ run : sudo apt install $PACKAGE
279+ env :
280+ PACKAGE : ${{ format('g++-{0}', matrix.prefix) }}
270281
271282 - name : Download npm package
272283 uses : actions/download-artifact@v2
@@ -279,14 +290,14 @@ jobs:
279290 - name : Build standalone release
280291 run : yarn release:standalone
281292
282- - name : Replace node with arm64 equivalent
293+ - name : Replace node with cross-compile equivalent
283294 run : |
284- wget https://nodejs.org/dist/v14.17.0 /node-v14.17.0 -linux-arm64 .tar.xz
285- tar -xf node-v14.17.0 -linux-arm64 .tar.xz node-v14.17.0 -linux-arm64 /bin/node --strip-components=2
295+ wget https://nodejs.org/dist/${NODE_VERSION} /node-${NODE_VERSION} -linux-${NPM_CONFIG_ARCH} .tar.xz
296+ tar -xf node-${NODE_VERSION} -linux-${NPM_CONFIG_ARCH} .tar.xz node-${NODE_VERSION} -linux-${NPM_CONFIG_ARCH} /bin/node --strip-components=2
286297 mv ./node ./release-standalone/lib/node
287298
288299 - name : Build packages with nfpm
289- run : yarn package arm64
300+ run : yarn package ${NPM_CONFIG_ARCH}
290301
291302 - name : Upload release artifacts
292303 uses : actions/upload-artifact@v2
0 commit comments