-
Notifications
You must be signed in to change notification settings - Fork 6k
feat(ci): armv7 cross builds #3892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -234,23 +234,32 @@ jobs: | |
# It is not feasible to cross-compile with CentOS. | ||
|
||
# Cross-compile notes: To compile native dependencies for arm64, | ||
# we install the aarch64 cross toolchain and then set it as the default | ||
# we install the aarch64/armv7l cross toolchain and then set it as the default | ||
# compiler/linker/etc. with the AR/CC/CXX/LINK environment variables. | ||
# qemu-user-static on ubuntu-16.04 currently doesn't run Node correctly, | ||
# so we just build with "native"/x86_64 node, then download arm64 node | ||
# and then put it in our release. We can't smoke test the arm64 build this way, | ||
# so we just build with "native"/x86_64 node, then download arm64/armv7l node | ||
# and then put it in our release. We can't smoke test the cross build this way, | ||
# but this means we don't need to maintain a self-hosted runner! | ||
package-linux-arm64: | ||
name: Linux ARM64 cross-compile build | ||
package-linux-cross: | ||
name: Linux cross-compile builds | ||
needs: build | ||
runs-on: ubuntu-16.04 | ||
timeout-minutes: 15 | ||
strategy: | ||
matrix: | ||
include: | ||
- prefix: aarch64-linux-gnu | ||
arch: arm64 | ||
- prefix: arm-linux-gnueabihf | ||
arch: armv7l | ||
|
||
env: | ||
AR: aarch64-linux-gnu-ar | ||
CC: aarch64-linux-gnu-gcc | ||
CXX: aarch64-linux-gnu-g++ | ||
LINK: aarch64-linux-gnu-g++ | ||
NPM_CONFIG_ARCH: arm64 | ||
AR: ${{ format('{0}-ar', matrix.prefix) }} | ||
CC: ${{ format('{0}-gcc', matrix.prefix) }} | ||
CXX: ${{ format('{0}-g++', matrix.prefix) }} | ||
LINK: ${{ format('{0}-g++', matrix.prefix) }} | ||
NPM_CONFIG_ARCH: ${{ matrix.arch }} | ||
NODE_VERSION: v14.17.4 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to install the "latest" node? The rest of the build scripts seem to bundle the latest Node 14.x, which would help us avoid security problems. I don't have strong feelings about pinning specific versions or using the "latest" minor/patch release, but I do think we should be consistent with the versions we're using between the native vs cross-compiled builds There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, there's no stable URL I can point to for latest node, which is why I resolved to this :( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apparently, they publish a JSON file, so we can write a script to extract the latest version using jq or whatever: https://nodejs.org/dist/index.json it seems... unfortunate, that there doesn't seem to be an easier way to do this anyway, shouldn't let this hold up this PR, this LGTM |
||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
@@ -266,7 +275,9 @@ jobs: | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
|
||
- name: Install cross-compiler | ||
run: sudo apt install g++-aarch64-linux-gnu | ||
run: sudo apt install $PACKAGE | ||
env: | ||
PACKAGE: ${{ format('g++-{0}', matrix.prefix) }} | ||
|
||
- name: Download npm package | ||
uses: actions/download-artifact@v2 | ||
|
@@ -279,14 +290,14 @@ jobs: | |
- name: Build standalone release | ||
run: yarn release:standalone | ||
|
||
- name: Replace node with arm64 equivalent | ||
- name: Replace node with cross-compile equivalent | ||
run: | | ||
wget https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-arm64.tar.xz | ||
tar -xf node-v14.17.0-linux-arm64.tar.xz node-v14.17.0-linux-arm64/bin/node --strip-components=2 | ||
wget https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}.tar.xz | ||
tar -xf node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}.tar.xz node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}/bin/node --strip-components=2 | ||
mv ./node ./release-standalone/lib/node | ||
|
||
- name: Build packages with nfpm | ||
run: yarn package arm64 | ||
run: yarn package ${NPM_CONFIG_ARCH} | ||
|
||
- name: Upload release artifacts | ||
uses: actions/upload-artifact@v2 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a minor style thing, I wonder if this would be more (or less) readable as:
what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^that looks a little easier to read IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! Didn't know I could do it this way :o
TIL