CI: add native workflows for arm64 with self-hosted runner

This commit is contained in:
Jesse Chan 2021-10-18 20:09:38 -07:00
parent 08907d09d5
commit feba410685
4 changed files with 173 additions and 0 deletions

44
.github/workflows/arm64-alpine.yml vendored Normal file
View File

@ -0,0 +1,44 @@
name: Build Node binaries for Alpine (arm64)
on:
workflow_dispatch:
jobs:
alpine:
runs-on: linux-arm64
strategy:
fail-fast: false
matrix:
target-node: [10, 12, 14, 16]
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build
uses: docker/build-push-action@v2
with:
build-args: |
PKG_FETCH_OPTION_n=node${{ matrix.target-node }}
PKG_FETCH_OPTION_p=alpine
context: .
file: ./Dockerfile.alpine
outputs: type=tar,dest=../out.tar
- name: Extract binaries from Docker image
run: |
tar xvf ../out.tar root/pkg-fetch/dist
- name: Check if binary is compiled
id: check_file
run: |
(test -f root/pkg-fetch/dist/*.sha256sum && echo ::set-output name=EXISTS::true) || echo ::set-output name=EXISTS::false
- uses: actions/upload-artifact@v2
if: steps.check_file.outputs.EXISTS == 'true'
with:
name: node${{ matrix.target-node }}-alpine-arm64
path: root/pkg-fetch/dist/*

43
.github/workflows/arm64-linux.yml vendored Normal file
View File

@ -0,0 +1,43 @@
name: Build Node binaries for Linux (arm64)
on:
workflow_dispatch:
jobs:
linux:
runs-on: linux-arm64
strategy:
fail-fast: false
matrix:
target-node: [10, 12, 14, 16]
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build
uses: docker/build-push-action@v2
with:
build-args: |
PKG_FETCH_OPTION_n=node${{ matrix.target-node }}
context: .
file: ./Dockerfile.linux
outputs: type=tar,dest=../out.tar
- name: Extract binaries from Docker image
run: |
tar xvf ../out.tar root/pkg-fetch/dist
- name: Check if binary is compiled
id: check_file
run: |
(test -f root/pkg-fetch/dist/*.sha256sum && echo ::set-output name=EXISTS::true) || echo ::set-output name=EXISTS::false
- uses: actions/upload-artifact@v2
if: steps.check_file.outputs.EXISTS == 'true'
with:
name: node${{ matrix.target-node }}-linux-arm64
path: root/pkg-fetch/dist/*

51
.github/workflows/arm64-linuxstatic.yml vendored Normal file
View File

@ -0,0 +1,51 @@
name: Build Node binaries for Linux static (arm64)
on:
workflow_dispatch:
jobs:
linuxstatic:
runs-on: linux-arm64
strategy:
fail-fast: false
matrix:
target-node: [10, 12, 14, 16]
target-arch: [arm64, armv7]
include:
- target-arch: arm64
docker-platform: linux/arm64
- target-arch: armv7
docker-platform: linux/arm/v7
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build
uses: docker/build-push-action@v2
with:
build-args: |
PKG_FETCH_OPTION_n=node${{ matrix.target-node }}
PKG_FETCH_OPTION_p=linuxstatic
context: .
file: ./Dockerfile.alpine
platforms: ${{ matrix.docker-platform }}
outputs: type=tar,dest=../out.tar
- name: Extract binaries from Docker image
run: |
tar xvf ../out.tar root/pkg-fetch/dist
- name: Check if binary is compiled
id: check_file
run: |
(test -f root/pkg-fetch/dist/*.sha256sum && echo ::set-output name=EXISTS::true) || echo ::set-output name=EXISTS::false
- uses: actions/upload-artifact@v2
if: steps.check_file.outputs.EXISTS == 'true'
with:
name: node${{ matrix.target-node }}-linuxstatic-${{ matrix.target-arch }}
path: root/pkg-fetch/dist/*

35
.github/workflows/arm64-macos.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: Build Node binaries for macOS (arm64)
on:
workflow_dispatch:
jobs:
macos-arm64:
runs-on: macos-arm64
defaults:
run:
shell: arch -arch arm64e bash -l -eo pipefail {0}
strategy:
fail-fast: false
matrix:
target-node: [14, 16]
steps:
- uses: actions/checkout@v2
- run: yarn install
- run: yarn start --node-range node${{ matrix.target-node }} --output dist
- name: Check if binary is compiled
id: check_file
run: |
(test -f dist/*.sha256sum && echo ::set-output name=EXISTS::true) || echo ::set-output name=EXISTS::false
- uses: actions/upload-artifact@v2
if: steps.check_file.outputs.EXISTS == 'true'
with:
name: node${{ matrix.target-node }}-macos-arm64
path: dist/*