Update node (ubuntu-20.04, arm64) docker build workflow (#804)

This commit is contained in:
Andrew Calcutt
2023-02-16 22:32:31 -05:00
committed by GitHub
parent 6b80162c41
commit 302bcfea14
4 changed files with 51 additions and 20 deletions

View File

@@ -130,11 +130,11 @@ jobs:
cache-name: ccache-v1
with:
path: ~/.ccache
key: ${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }}
key: ${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }}
restore-keys: |
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}
${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }}
${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}
- name: Clear ccache statistics
run: |
@@ -182,8 +182,10 @@ jobs:
npm pack --dry-run
test_linux_arm:
runs-on: macos-12-arm
runs-on: ubuntu-latest
name: test (ubuntu-20.04, arm64)
env:
DOCKERTAG: node-test-${{ github.run_id }}-${{ github.run_attempt }}
steps:
- name: Checkout
uses: actions/checkout@v3
@@ -191,6 +193,12 @@ jobs:
submodules: recursive
fetch-depth: 0
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: 'arm64'
- name: Install dependencies macOS
if: runner.os == 'macOS'
env:
@@ -208,9 +216,19 @@ jobs:
context: .
platforms: linux/arm64
file: platform/node/scripts/Dockerfile_Build
tags: build
tags: ${{ env.DOCKERTAG }}
push: false
load: true
- name: Run the docker build image and create node libs
run: docker run --rm -v $(pwd):/data build
run: docker run --rm -v $(pwd):/data ${{ env.DOCKERTAG }}
- name: Clean up the docker build image
if: always()
run: docker rmi $(docker images | grep ${{ env.DOCKERTAG }} | tr -s ' ' | cut -d ' ' -f 3) --force
# On PRs make sure that the npm package can be packaged.
- name: Pack
if: github.ref != 'refs/heads/main'
run: |
npm pack --dry-run

View File

@@ -131,11 +131,11 @@ jobs:
cache-name: ccache-v1
with:
path: ~/.ccache
key: ${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }}
key: ${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }}
restore-keys: |
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}
${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }}
${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}
- name: Clear ccache statistics
run: |
@@ -239,9 +239,11 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_ORG_TOKEN }}
publish_binary_linux_arm64:
runs-on: macos-12-arm
runs-on: ubuntu-latest
needs: bump_version
name: publish_binary (ubuntu-20.04, arm64)
env:
DOCKERTAG: node-build-${{ github.run_id }}-${{ github.run_attempt }}
steps:
- name: Checkout
uses: actions/checkout@v3
@@ -252,6 +254,12 @@ jobs:
- name: Get Latest Version
run: git pull
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: 'arm64'
- name: Install dependencies macOS
if: runner.os == 'macOS'
env:
@@ -269,12 +277,16 @@ jobs:
context: .
platforms: linux/arm64
file: platform/node/scripts/Dockerfile_Build
tags: build
tags: ${{ env.DOCKERTAG }}
push: false
load: true
- name: Run the docker build image and create node libs
run: docker run --rm -v $(pwd):/data build
run: docker run --rm -v $(pwd):/data ${{ env.DOCKERTAG }}
- name: Clean up the docker build image
if: always()
run: docker rmi $(docker images | grep ${{ env.DOCKERTAG }} | tr -s ' ' | cut -d ' ' -f 3) --force
- name: Setup node
uses: actions/setup-node@v3

View File

@@ -27,6 +27,6 @@ RUN set -ex; \
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"]
COPY /platform/node/scripts/docker_build_entrypoint.sh /usr/src/app/docker_build_entrypoint.sh
ENTRYPOINT ["/usr/src/app/docker_build_entrypoint.sh"]
RUN ["chmod", "+x", "/usr/src/app/docker_build_entrypoint.sh"]

View File

@@ -4,12 +4,13 @@ node -v
cat /etc/os-release
uname -m
cd /usr/src/app
#build lib files
cd /data/
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
#Test
xvfb-run --auto-servernum ./build/mbgl-render-test-runner --manifestPath metrics/linux-gcc8-release-style.json
xvfb-run --auto-servernum npm test