Skip to content

Commit

Permalink
Test building arm bindings (#53)
Browse files Browse the repository at this point in the history
* Test building arm bindings

* Fix OS

* Build project inside arm64 image

* Combine arm64 build & copy steps

* Load arm64 image into docker

* Build arm for all docker versions

* Disable engine checks

* Test also for Node 17

* Skip Node v17 for arm

Co-authored-by: Cayman <caymannava@gmail.com>
  • Loading branch information
dapplion and wemeetagain authored Feb 10, 2022
1 parent 35820ec commit 7c669b2
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 5 deletions.
53 changes: 48 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,18 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Setup Node.js ${{matrix.node}}
uses: actions/setup-node@v1
with:
node-version: ${{matrix.node}}

- name: Get SWIG pre-built
uses: actions/download-artifact@v2
with:
name: blst_wrap.cpp
path: prebuild/

- name: Setup Node.js ${{matrix.node}}
uses: actions/setup-node@v1
with:
node-version: ${{matrix.node}}

- name: Install && Build TS + bindings
run: |
yarn config set ignore-engines true
Expand All @@ -91,6 +92,48 @@ jobs:
path: prebuild/*.node
if-no-files-found: error

build-arm:
needs: ["build-swig"]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [10, 11, 12, 13, 14, 15, 16]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Get SWIG pre-built
uses: actions/download-artifact@v2
with:
name: blst_wrap.cpp
path: prebuild/

# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build test arm binding
run: |
docker buildx build --build-arg NODE_VERSION=${{matrix.node}} --platform linux/arm64 -t armbuild:latest --load --progress=plain .
docker create --name armbuild armbuild:latest
docker cp armbuild:/prebuild .
- name: Upload binding.node
uses: actions/upload-artifact@v2
if: github.repository_owner == 'chainsafe' && github.event_name != 'pull_request'
with:
name: binding.node
path: prebuild/*.node
if-no-files-found: error

benchmark:
needs: ["build-swig"]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -121,7 +164,7 @@ jobs:
node_modules/.bin/ts-node benchmark/multithreadOverhead.ts
publish:
needs: ["build-swig", "build"]
needs: ["build-swig", "build", "build-arm"]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
Expand Down
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This is used to build bindings for arm64

ARG NODE_VERSION
FROM node:${NODE_VERSION}

RUN apt install -y python3 g++ make
# && ln -sf python3 /usr/bin/python
COPY . .

RUN yarn config set ignore-engines true
RUN yarn bootstrap
1 change: 1 addition & 0 deletions src/scripts/buildBindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export async function buildBindings(binaryPath: string): Promise<void> {

await exec(nodeJsExec, [nodeGypExec, "rebuild"], {
cwd: BINDINGS_DIR,
timeout: 10 * 60 * 1000,
env: {...process.env, BLST_WRAP_CPP_PREBUILD},
});

Expand Down

0 comments on commit 7c669b2

Please sign in to comment.