Skip to content
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

automated arm/v7 and arm64 builds for alpine and linux built using docker buildx and github actions #1362

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/build-arm-bindings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build ARM bindings

on:
push:
tags:
- "v*"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: will change to every push.


jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
nodeVersion: [10, 11, 12, 13, 14, 15, 16]
platform: ["linux", "alpine"]
arch: [linux/arm/v7, linux/arm64]
include:
- platform: "linux"
variant: "stretch"
- platform: "alpine"
variant: "alpine"

- arch: linux/arm/v7
archShort: armv7
- arch: linux/arm64
archShort: arm64

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Docker Buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
buildx-version: latest
qemu-version: latest
- name: Build and Push
run: |
docker buildx build \
--file BinaryBuilder.Dockerfile \
--load \
--tag sqlite-builder \
--platform ${{ matrix.arch }} \
--no-cache \
--build-arg NODE_VERSION=${{ matrix.nodeVersion }} \
--build-arg VARIANT=${{ matrix.variant }} \
--build-arg AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} \
--build-arg AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \
.
CONTAINER_ID=$(docker create -it sqlite-builder)
docker cp $CONTAINER_ID:/usr/src/build/build/ ./build

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: node${{ matrix.nodeVersion }}-${{ matrix.platform }}-${{ matrix.archShort }}
path: "./build/"
20 changes: 20 additions & 0 deletions BinaryBuilder.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ARG NODE_VERSION=12
ARG VARIANT=stretch
FROM node:$NODE_VERSION-$VARIANT

ARG VARIANT
ARG AWS_ACCESS_KEY_ID=SKIP
ARG AWS_SECRET_ACCESS_KEY=SKIP

RUN if [ "$VARIANT" = "alpine" ] ; then apk add make g++ python ; fi

WORKDIR /usr/src/build

COPY . .
RUN npm install --ignore-scripts
RUN npx node-pre-gyp install --build-from-source
RUN npm run test
RUN npx node-pre-gyp package
RUN if [ "$AWS_ACCESS_KEY_ID" = "SKIP" ] || [ "$AWS_SECRET_ACCESS_KEY" = "SKIP" ] ; then echo "SKIP S3 PUBLISH" ; else npx node-pre-gyp publish ; fi
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I will change this if it eventually gets merged, we have a different mechanism to detect whether to publish or not.


CMD ["sh"]