Node workflow - build linux arm64 in a container (#520)
Co-authored-by: acalcutt <acalcutt@worcester.edu>
This commit is contained in:
34
.github/workflows/node-ci.yml
vendored
34
.github/workflows/node-ci.yml
vendored
@@ -202,3 +202,37 @@ jobs:
|
||||
if: github.ref != 'refs/heads/main'
|
||||
run: |
|
||||
npm pack --dry-run
|
||||
|
||||
test_linux_arm:
|
||||
runs-on: macos-12-arm
|
||||
name: test (ubuntu-20.04, arm64)
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install dependencies macOS
|
||||
if: runner.os == 'macOS'
|
||||
env:
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
brew install docker docker-compose
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Create the docker build image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/arm64
|
||||
file: platform/node/scripts/Dockerfile_Build
|
||||
tags: build
|
||||
push: false
|
||||
load: true
|
||||
|
||||
- name: Run the docker build image and create node libs
|
||||
run: docker run --rm -v $(pwd):/data build
|
||||
62
.github/workflows/node-release.yml
vendored
62
.github/workflows/node-release.yml
vendored
@@ -37,17 +37,14 @@ jobs:
|
||||
node-version: 18
|
||||
|
||||
- name: npm version
|
||||
id: npmversion
|
||||
run: >-
|
||||
echo "::set-output name=NPM_VERSION::$(
|
||||
npm version ${{ github.event.inputs.version }} --preid pre --no-git-tag-version
|
||||
)"
|
||||
run: |
|
||||
echo "NPM_VERSION=$(npm version ${{ github.event.inputs.version }} --preid pre --no-git-tag-version)" >> $GITHUB_ENV
|
||||
|
||||
- name: Push version to git
|
||||
run: |
|
||||
git config user.name github-actions
|
||||
git config user.email github-actions@github.com
|
||||
git commit -a -m "Update node version to ${{ steps.npmversion.outputs.NPM_VERSION }} (${{ github.event.inputs.version }})"
|
||||
git commit -a -m "Update node version to ${{ env.NPM_VERSION }} (${{ github.event.inputs.version }})"
|
||||
git push
|
||||
|
||||
publish_binaries:
|
||||
@@ -239,4 +236,55 @@ jobs:
|
||||
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
|
||||
npm publish --tag next --access public
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_ORG_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_ORG_TOKEN }}
|
||||
|
||||
publish_binary_linux_arm64:
|
||||
runs-on: macos-12-arm
|
||||
needs: bump_version
|
||||
name: publish_binary (ubuntu-20.04, arm64)
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install dependencies macOS
|
||||
if: runner.os == 'macOS'
|
||||
env:
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
brew install docker docker-compose
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Create the docker build image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/arm64
|
||||
file: platform/node/scripts/Dockerfile_Build
|
||||
tags: build
|
||||
push: false
|
||||
load: true
|
||||
|
||||
- name: Run the docker build image and create node libs
|
||||
run: docker run --rm -v $(pwd):/data build
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: npm ci
|
||||
run: npm ci --ignore-scripts
|
||||
|
||||
- name: Publish ARM Release to Github
|
||||
env:
|
||||
PUBLISH: true
|
||||
BUILDTYPE: RelWithDebInfo
|
||||
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.NODE_PRE_GYP_GITHUB_TOKEN }}
|
||||
run: |
|
||||
./platform/node/scripts/publish.sh --target_arch=arm64
|
||||
32
platform/node/scripts/Dockerfile_Build
Normal file
32
platform/node/scripts/Dockerfile_Build
Normal file
@@ -0,0 +1,32 @@
|
||||
FROM ubuntu:focal
|
||||
|
||||
RUN set -ex; \
|
||||
export DEBIAN_FRONTEND=noninteractive; \
|
||||
apt-get -qq update; \
|
||||
apt-get -y --no-install-recommends install \
|
||||
ca-certificates \
|
||||
wget \
|
||||
libjpeg-dev \
|
||||
libpng-dev \
|
||||
ccache \
|
||||
cmake \
|
||||
ninja-build \
|
||||
pkg-config \
|
||||
xvfb \
|
||||
libcurl4-openssl-dev \
|
||||
libglfw3-dev \
|
||||
libuv1-dev \
|
||||
libicu-dev \
|
||||
libjpeg-turbo8 \
|
||||
g++-10 \
|
||||
libc++-9-dev \
|
||||
libc++abi-9-dev; \
|
||||
wget -qO- https://deb.nodesource.com/setup_18.x | bash; \
|
||||
apt-get install -y nodejs;
|
||||
|
||||
VOLUME /data
|
||||
|
||||
RUN mkdir -p /usr/src/app
|
||||
COPY / /usr/src/app
|
||||
ENTRYPOINT ["/usr/src/app/platform/node/scripts/docker_build_entrypoint.sh"]
|
||||
RUN ["chmod", "+x", "/usr/src/app/platform/node/scripts/docker_build_entrypoint.sh"]
|
||||
15
platform/node/scripts/docker_build_entrypoint.sh
Normal file
15
platform/node/scripts/docker_build_entrypoint.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
node -v
|
||||
cat /etc/os-release
|
||||
uname -m
|
||||
|
||||
cd /usr/src/app
|
||||
npm ci --ignore-scripts
|
||||
ccache --clear --set-config cache_dir=~/.ccache
|
||||
cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10
|
||||
cmake --build build -j $(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null)
|
||||
cp -R ./lib/ /data/lib/
|
||||
|
||||
xvfb-run --auto-servernum ./build/mbgl-render-test-runner --manifestPath metrics/macos-xcode11-release-style.json
|
||||
xvfb-run --auto-servernum npm test
|
||||
Reference in New Issue
Block a user