Revert "ci: speed up arm64-glibc test" #49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
npm-package-version: | |
description: Specify the package.json npm package version, e.g. `0.0.1-alpha.0` | |
required: true | |
npm-package-tag: | |
description: Specify the tag to be used for npm publish, e.g. `latest`, `beta`, `alpha` | |
required: true | |
jobs: | |
cancel-previous-runs: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
build_linux-x64-musl: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: x86_64-unknown-linux-musl | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- uses: Swatinem/rust-cache@v2 | |
- name: Download x86_64-linux-musl-cross toolchain | |
run: curl -O -C - https://musl.cc/x86_64-linux-musl-cross.tgz | |
- name: Install x86_64-linux-musl-cross toolchain | |
run: tar xf x86_64-linux-musl-cross.tgz | |
- name: Configure linux-x64-musl cross compile | |
run: | | |
echo "CC_x86_64_unknown_linux_musl=$(pwd)/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc" >> $GITHUB_ENV | |
echo "CXX_x86_64_unknown_linux_musl=$(pwd)/x86_64-linux-musl-cross/bin/x86_64-linux-musl--g++" >> $GITHUB_ENV | |
echo "AR_x86_64_unknown_linux_musl=$(pwd)/x86_64-linux-musl-cross/bin/x86_64-linux-musl-ar" >> $GITHUB_ENV | |
echo "CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=$(pwd)/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc" >> $GITHUB_ENV | |
echo "CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_AR=$(pwd)/x86_64-linux-musl-cross/bin/x86_64-linux-musl-ar" >> $GITHUB_ENV | |
echo "TARGET_PLATFORM=linux" >> $GITHUB_ENV | |
echo "TARGET_ARCH=x64" >> $GITHUB_ENV | |
echo "TARGET_LIBC=musl" >> $GITHUB_ENV | |
- name: npm i | |
run: npm i | |
- name: Build | |
run: npm run build:cargo | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: linux-x64-musl | |
path: native/linux-x64-musl.node | |
if-no-files-found: error | |
build_linux-arm64-musl: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: aarch64-unknown-linux-musl | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- uses: Swatinem/rust-cache@v2 | |
- name: Download aarch64-linux-musl-cross toolchain | |
run: curl -O -C - https://musl.cc/aarch64-linux-musl-cross.tgz | |
- name: Install aarch64-linux-musl-cross toolchain | |
run: tar xf aarch64-linux-musl-cross.tgz | |
- name: Configure linux-arm64-musl cross compile | |
run: | | |
echo "CC_aarch64_unknown_linux_musl=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc" >> $GITHUB_ENV | |
echo "CXX_aarch64_unknown_linux_musl=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl--g++" >> $GITHUB_ENV | |
echo "AR_aarch64_unknown_linux_musl=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-ar" >> $GITHUB_ENV | |
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc" >> $GITHUB_ENV | |
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_AR=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-ar" >> $GITHUB_ENV | |
echo "TARGET_PLATFORM=linux" >> $GITHUB_ENV | |
echo "TARGET_ARCH=arm64" >> $GITHUB_ENV | |
echo "TARGET_LIBC=musl" >> $GITHUB_ENV | |
- name: npm i | |
run: npm i | |
- name: Build | |
run: npm run build:cargo | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: linux-arm64-musl | |
path: native/linux-arm64-musl.node | |
if-no-files-found: error | |
build_linux-x64-glibc: | |
runs-on: ubuntu-22.04 | |
container: | |
image: rust:buster | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: x86_64-unknown-linux-gnu | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- uses: Swatinem/rust-cache@v2 | |
- name: npm i | |
run: npm i | |
- name: Build | |
run: npm run build:cargo | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: linux-x64-glibc | |
path: native/linux-x64-glibc.node | |
if-no-files-found: error | |
build_linux-arm64-glibc: | |
runs-on: ubuntu-22.04 | |
container: | |
image: rust:buster | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: aarch64-unknown-linux-gnu | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install cross compile deps | |
run: | | |
apt-get update && apt-get install -y g++-aarch64-linux-gnu libc6-dev-arm64-cross gcc-aarch64-linux-gnu qemu-user | |
- name: Configure linux-arm64 cross compile | |
run: | | |
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
echo 'CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-aarch64 -L /usr/aarch64-linux-gnu"' >> $GITHUB_ENV | |
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++" >> $GITHUB_ENV | |
echo "TARGET_ARCH=arm64" >> $GITHUB_ENV | |
- name: npm i | |
run: npm i | |
- name: Build | |
run: npm run build:cargo | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: linux-arm64-glibc | |
path: native/linux-arm64-glibc.node | |
if-no-files-found: error | |
build_win-x64: | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: x86_64-pc-windows-msvc | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- uses: Swatinem/rust-cache@v2 | |
- name: npm i | |
run: npm i | |
- name: Build | |
run: npm run build:cargo | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: win32-x64 | |
path: native/win32-x64.node | |
if-no-files-found: error | |
build_darwin-x64: | |
runs-on: macos-12 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: x86_64-apple-darwin | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- uses: Swatinem/rust-cache@v2 | |
- name: npm i | |
run: npm i | |
- name: Build | |
run: npm run build:cargo | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: darwin-x64 | |
path: native/darwin-x64.node | |
if-no-files-found: error | |
build_darwin-arm64: | |
runs-on: macos-12 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: aarch64-apple-darwin | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- uses: Swatinem/rust-cache@v2 | |
- name: Configure macos-arm64 cross compile | |
run: | | |
echo "SDKROOT=$(xcrun -sdk macosx --show-sdk-path)" >> $GITHUB_ENV | |
echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)" >> $GITHUB_ENV | |
echo "TARGET_ARCH=arm64" >> $GITHUB_ENV | |
- name: npm i | |
run: npm i | |
- name: Build | |
run: npm run build:cargo | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: darwin-arm64 | |
path: native/darwin-arm64.node | |
if-no-files-found: error | |
test_linux-arm64-glibc: | |
runs-on: ubuntu-22.04 | |
needs: | |
- build_linux-arm64-glibc | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: linux-arm64-glibc | |
path: native | |
- name: npm i | |
run: npm i | |
- name: Build js | |
run: npm run build:ts | |
- uses: uraimo/run-on-arch-action@v2 | |
name: Run on arch | |
with: | |
arch: aarch64 | |
distro: ubuntu_latest | |
githubToken: ${{ github.token }} | |
install: | | |
apt-get update && apt-get install -y curl | |
curl -fsSL https://deb.nodesource.com/setup_16.x | bash - | |
apt-get install -y --no-install-recommends nodejs | |
run: | | |
npm run test:js | |
test_linux-arm64-musl: | |
runs-on: ubuntu-22.04 | |
needs: | |
- build_linux-arm64-musl | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: linux-arm64-musl | |
path: native | |
- name: npm i | |
run: npm i | |
- name: Build js | |
run: npm run build:ts | |
- uses: uraimo/run-on-arch-action@v2 | |
name: Run on arch | |
with: | |
arch: aarch64 | |
distro: alpine_latest | |
githubToken: ${{ github.token }} | |
install: | | |
apk add nodejs npm | |
run: | | |
npm run test:js | |
test_linux-x64-glibc: | |
runs-on: ubuntu-22.04 | |
container: | |
image: node:16-bullseye | |
needs: | |
- build_linux-x64-glibc | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: linux-x64-glibc | |
path: native | |
- name: npm i | |
run: npm i | |
- name: Build js | |
run: npm run build:ts | |
- name: Test js | |
run: npm run test:js | |
- name: Test examples | |
working-directory: examples | |
run: npm i && npm test | |
test_linux-x64-musl: | |
runs-on: ubuntu-22.04 | |
container: | |
image: node:16-alpine | |
needs: | |
- build_linux-x64-musl | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: linux-x64-musl | |
path: native | |
- name: npm i | |
run: npm i | |
- name: Build js | |
run: npm run build:ts | |
- name: Test js | |
run: npm run test:js | |
- name: Test examples | |
working-directory: examples | |
run: npm i && npm test | |
test_win-x64: | |
runs-on: windows-2022 | |
needs: | |
- build_win-x64 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: win32-x64 | |
path: native | |
- name: npm i | |
run: npm i | |
- name: Build js | |
run: npm run build:ts | |
- name: Test js | |
run: npm run test:js | |
- name: Test examples | |
working-directory: examples | |
run: npm i && npm test | |
test_darwin-x64: | |
runs-on: macos-12 | |
needs: | |
- build_darwin-x64 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: darwin-x64 | |
path: native | |
- name: npm i | |
run: npm i | |
- name: Build js | |
run: npm run build:ts | |
- name: Test js | |
run: npm run test:js | |
- name: Test examples | |
working-directory: examples | |
run: npm i && npm test | |
npm-package: | |
runs-on: ubuntu-22.04 | |
needs: | |
- build_linux-x64-musl | |
- build_linux-arm64-musl | |
- build_linux-x64-glibc | |
- build_linux-arm64-glibc | |
- build_win-x64 | |
- build_darwin-x64 | |
- build_darwin-arm64 | |
env: | |
NPM_PACKAGE_VERSION: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.npm-package-version || '0.0.1-alpha.0' }} | |
NPM_PACKAGE_TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.npm-package-tag || 'alpha' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
registry-url: https://registry.npmjs.org | |
always-auth: true | |
- uses: actions/download-artifact@v3 | |
with: | |
path: native | |
- name: Position downloaded artifacts | |
run: | | |
mkdir -p ./native | |
find ./native -mindepth 2 -type f -exec mv -t ./native -i '{}' + | |
find ./native -mindepth 1 -type d -empty -delete | |
ls -R ./native | |
- name: npm version | |
run: npm version --git-tag-version=false --allow-same-version $NPM_PACKAGE_VERSION | |
- name: npm build | |
run: | | |
npm i | |
npm run build:ts | |
- name: npm pack | |
run: | | |
npm pack | |
mv "stacks-encoding-native-js-$NPM_PACKAGE_VERSION.tgz" "stacks-encoding-native-js.tgz" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: stacks-encoding-native-js.tgz | |
path: stacks-encoding-native-js.tgz | |
if-no-files-found: error | |
- name: Publish npm package | |
if: github.event_name == 'workflow_dispatch' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npm publish stacks-encoding-native-js.tgz --tag $NPM_PACKAGE_TAG --access public |