Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: linux aarch64 musl build
  • Loading branch information
Brooooooklyn committed Jul 22, 2021
1 parent a7ac686 commit 1a9a475
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 56 deletions.
4 changes: 2 additions & 2 deletions .cargo/config.toml
Expand Up @@ -11,5 +11,5 @@ rustflags = [
]

[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-gnu-gcc"
rustflags = ["-C", "target-feature=-crt-static", "-C", "link-arg=-lgcc"]
linker = "aarch64-linux-musl-gcc"
rustflags = ["-C", "target-feature=-crt-static"]
118 changes: 64 additions & 54 deletions .github/workflows/CI.yaml
Expand Up @@ -72,10 +72,12 @@ jobs:
yarn build --target aarch64-linux-android
- host: ubuntu-latest
target: 'aarch64-unknown-linux-musl'
setup: |
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu -y
build: yarn build --target aarch64-unknown-linux-musl
downloadTarget: 'aarch64-unknown-linux-musl'
docker: |
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
docker pull ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
docker tag ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine builder
build: docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/snappy -w /snappy builder sh -c "yarn build -- --target=aarch64-unknown-linux-musl"
- host: windows-latest
target: 'aarch64-pc-windows-msvc'
build: yarn build --target aarch64-pc-windows-msvc
Expand Down Expand Up @@ -189,7 +191,6 @@ jobs:
yarn test
rm -rf node_modules
rm -rf target
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -349,32 +350,52 @@ jobs:
run: ls -R .
shell: bash

- uses: uraimo/run-on-arch-action@v2.1.0
name: Setup and run tests
id: runcmd
- name: Setup and run tests
uses: docker://multiarch/ubuntu-core:arm64-focal
with:
arch: aarch64
distro: ubuntu20.04

dockerRunArgs: |
--volume "${PWD}:/snappy"
-w /snappy
# Not required, but speeds up builds by storing container images in
# a GitHub package registry.
githubToken: ${{ github.token }}

install: |
apt-get update && \
apt-get install -y ca-certificates gnupg2 curl apt-transport-https && \
curl -sL https://deb.nodesource.com/setup_${{ matrix.node }}.x | bash - && \
apt-get install -y nodejs && \
npm install -g yarn
run: |
yarn install --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000
yarn test
ls -la
args: >
sh -c "
apt-get update && \
apt-get install -y ca-certificates gnupg2 curl apt-transport-https && \
curl -sL https://deb.nodesource.com/setup_${{ matrix.node }}.x | bash - && \
apt-get install -y nodejs && \
npm install -g yarn && \
yarn install --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000 && \
yarn test && \
ls -la
"
test-linux-aarch64-musl-binding:
name: Test bindings on aarch64-unknown-linux-musl - node@${{ matrix.node }}
needs:
- build

runs-on: ubuntu-20.04

steps:
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset

- uses: actions/checkout@v2

- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: bindings-aarch64-unknown-linux-musl
path: .

- name: List packages
run: ls -R .
shell: bash

- name: Setup and run tests
uses: docker://multiarch/alpine:aarch64-latest-stable
with:
args: >
sh -c "
apk add nodejs npm && \
npm install -g yarn && \
yarn install --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000 && \
npm test
"
test-linux-arm-gnueabihf-binding:
name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }}
needs:
Expand All @@ -400,32 +421,20 @@ jobs:
run: ls -R .
shell: bash

- uses: uraimo/run-on-arch-action@v2.1.0
name: Setup and run tests
id: runcmd
- name: Setup and run tests
uses: docker://multiarch/ubuntu-core:armhf-focal
with:
arch: armv7
distro: ubuntu20.04

dockerRunArgs: |
--volume "${PWD}:/snappy"
-w /snappy
# Not required, but speeds up builds by storing container images in
# a GitHub package registry.
githubToken: ${{ github.token }}

install: |
apt-get update && \
apt-get install -y ca-certificates gnupg2 curl apt-transport-https && \
curl -sL https://deb.nodesource.com/setup_${{ matrix.node }}.x | bash - && \
apt-get install -y nodejs && \
npm install -g yarn
run: |
yarn install --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000
yarn test
ls -la
args: >
sh -c "
apt-get update && \
apt-get install -y ca-certificates gnupg2 curl apt-transport-https && \
curl -sL https://deb.nodesource.com/setup_${{ matrix.node }}.x | bash - && \
apt-get install -y nodejs && \
npm install -g yarn && \
yarn install --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000 && \
yarn test && \
ls -la
"
publish:
name: Publish
runs-on: ubuntu-20.04
Expand All @@ -435,6 +444,7 @@ jobs:
- test-linux-aarch64-gnu-binding
- test-linux-arm-gnueabihf-binding
- test-macOS-windows-binding
- test-linux-aarch64-musl-binding
- build-freebsd

steps:
Expand Down

0 comments on commit 1a9a475

Please sign in to comment.