diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index 966c82884..90f90501f 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/node-release.yml b/.github/workflows/node-release.yml index 27e362d85..95d285704 100644 --- a/.github/workflows/node-release.yml +++ b/.github/workflows/node-release.yml @@ -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 }} \ No newline at end of file + 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 \ No newline at end of file diff --git a/platform/node/scripts/Dockerfile_Build b/platform/node/scripts/Dockerfile_Build new file mode 100644 index 000000000..fe02f48e8 --- /dev/null +++ b/platform/node/scripts/Dockerfile_Build @@ -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"] \ No newline at end of file diff --git a/platform/node/scripts/docker_build_entrypoint.sh b/platform/node/scripts/docker_build_entrypoint.sh new file mode 100644 index 000000000..580ecbbe6 --- /dev/null +++ b/platform/node/scripts/docker_build_entrypoint.sh @@ -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 \ No newline at end of file