From 68f767b96d9af5c6555cbe5faf4730c259835aba Mon Sep 17 00:00:00 2001 From: LongYinan Date: Wed, 27 Oct 2021 15:09:40 +0800 Subject: [PATCH] ci: fix arm build --- .github/workflows/linux-aarch64.yaml | 21 +++++++++------------ .github/workflows/linux-armv7.yaml | 21 +++++++++------------ cli/src/new/ci-template.ts | 2 ++ 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/.github/workflows/linux-aarch64.yaml b/.github/workflows/linux-aarch64.yaml index 57953426..b9c3709e 100644 --- a/.github/workflows/linux-aarch64.yaml +++ b/.github/workflows/linux-aarch64.yaml @@ -2,7 +2,7 @@ name: Linux-aarch64 env: DEBUG: 'napi:*' - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: 'aarch64-linux-gnu-gcc-9' + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: 'aarch64-linux-gnu-gcc' on: push: @@ -13,7 +13,7 @@ on: jobs: build: name: stable - aarch64-unknown-linux-gnu - node@14 - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset @@ -60,7 +60,9 @@ jobs: key: npm-cache-linux-aarch64-gnu-node@14-${{ hashFiles('yarn.lock') }} - name: Install cross compile toolchain - run: sudo apt-get install gcc-9-aarch64-linux-gnu g++-9-aarch64-linux-gnu -y + run: | + sudo apt-get update + sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -y - name: Install dependencies run: yarn install --frozen-lockfile --ignore-platform --registry https://registry.npmjs.org --network-timeout 300000 @@ -72,13 +74,8 @@ jobs: run: yarn build:test:aarch64 - name: Setup and run tests - uses: docker://multiarch/ubuntu-core:arm64-focal + uses: addnab/docker-run-action@v3 with: - args: > - sh -c " - apt-get update && \ - apt-get install -y ca-certificates gnupg2 curl && \ - curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ - apt-get install -y nodejs && \ - npm test - " + image: ghcr.io/napi-rs/napi-rs/nodejs:aarch64-14 + options: -v ${{ github.workspace }}:/build -w /build + run: yarn test diff --git a/.github/workflows/linux-armv7.yaml b/.github/workflows/linux-armv7.yaml index 06eb10ad..42c12b5b 100644 --- a/.github/workflows/linux-armv7.yaml +++ b/.github/workflows/linux-armv7.yaml @@ -2,7 +2,7 @@ name: Linux-armv7 env: DEBUG: 'napi:*' - CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: 'arm-linux-gnueabihf-gcc-9' + CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: 'arm-linux-gnueabihf-gcc' on: push: @@ -13,7 +13,7 @@ on: jobs: build: name: stable - armv7-unknown-linux-gnu - node@14 - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset @@ -60,7 +60,9 @@ jobs: key: npm-cache-linux-armv7-gnu-node@14-${{ hashFiles('yarn.lock') }} - name: Install cross compile toolchain - run: sudo apt-get install gcc-9-arm-linux-gnueabihf -y + run: | + sudo apt-get update + sudo apt-get install gcc-arm-linux-gnueabihf -y - name: Install dependencies run: yarn install --frozen-lockfile --ignore-platform --registry https://registry.npmjs.org --network-timeout 300000 @@ -72,13 +74,8 @@ jobs: run: yarn build:test:armv7 - name: Setup and run tests - uses: docker://multiarch/ubuntu-core:armhf-focal + uses: addnab/docker-run-action@v3 with: - args: > - sh -c " - apt-get update && \ - apt-get install -y ca-certificates gnupg2 curl && \ - curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ - apt-get install -y nodejs && \ - npm test - " + image: ghcr.io/napi-rs/napi-rs/nodejs:armhf-14 + options: -v ${{ github.workspace }}:/build -w /build + run: yarn test diff --git a/cli/src/new/ci-template.ts b/cli/src/new/ci-template.ts index 173fd45a..852a736a 100644 --- a/cli/src/new/ci-template.ts +++ b/cli/src/new/ci-template.ts @@ -63,6 +63,7 @@ jobs: - host: ubuntu-latest target: 'aarch64-unknown-linux-gnu' setup: | + sudo apt-get update sudo apt-get install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu -y build: | yarn build --target=aarch64-unknown-linux-gnu @@ -70,6 +71,7 @@ jobs: - host: ubuntu-latest target: 'armv7-unknown-linux-gnueabihf' setup: | + sudo apt-get update sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y build: | yarn build --target=armv7-unknown-linux-gnueabihf