feat: arm64 build for bw cli

This commit is contained in:
Michel Loiseleur 2023-12-22 09:57:16 +01:00
parent 0765240886
commit 1909e2948a
4 changed files with 85 additions and 7 deletions

View File

@ -131,6 +131,81 @@ jobs:
path: apps/cli/dist/bw-${{ env.LOWER_RUNNER_OS }}-sha256-${{ env._PACKAGE_VERSION }}.txt
if-no-files-found: error
cli-arm64:
name: Build CLI Linux arm64
runs-on: ubuntu-22.04
needs:
- setup
env:
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
_NODE_VERSION: ${{ needs.setup.outputs.node_version }}
# The only known way to get arm64 argon2 is to build it from sources
npm_config_arch: arm64
npm_config_build_from_source: true
steps:
- name: Checkout repo
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Setup Unix Vars
run: |
echo "LOWER_RUNNER_OS=$(echo $RUNNER_OS | awk '{print tolower($0)}')" >> $GITHUB_ENV
echo "SHORT_RUNNER_OS=$(echo $RUNNER_OS | awk '{print substr($0, 1, 3)}' | \
awk '{print tolower($0)}')" >> $GITHUB_ENV
- name: Configure binfmt with QEMU User Emulation
run: |
sudo apt install binfmt-support qemu-user-static
- name: Set up Node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: ${{ env._NODE_VERSION }}
- name: Install
run: npm ci
working-directory: ./
# argon2-node comes with an ELF binary for host arch, not target arch.
- name: Download argon2-node binary for arm64
working-directory: ./
run: |
ARGON2_VERSION=$(grep '"argon2":' apps/cli/package.json | sed -e 's/.*"argon2": "\(.*\)",/\1/g')
echo "ARGON2_VERSION: ${ARGON2_VERSION}"
curl -L -o argon2.tar.gz "https://github.com/ranisalt/node-argon2/releases/download/v${ARGON2_VERSION}/argon2-v${ARGON2_VERSION}-napi-v3-linux-arm64-glibc.tar.gz"
tar xvzf argon2.tar.gz
mv napi-v3/argon2.node node_modules/argon2/lib/binding/napi-v3/argon2.node
rm -rf argon2.tar.gz napi-v3
- name: Build & Package Unix
run: npm run dist:${{ env.SHORT_RUNNER_OS }}:arm64 --quiet
- name: Zip Unix
run: |
cd ./dist/${{ env.LOWER_RUNNER_OS }}-arm64
zip ../bw-${{ env.LOWER_RUNNER_OS }}-arm64-${{ env._PACKAGE_VERSION }}.zip ./bw
- name: Create checksums Unix
run: |
cd ./dist
shasum -a 256 bw-${{ env.LOWER_RUNNER_OS }}-arm64-${{ env._PACKAGE_VERSION }}.zip \
| awk '{split($0, a); print a[1]}' > bw-${{ env.LOWER_RUNNER_OS }}-arm64-sha256-${{ env._PACKAGE_VERSION }}.txt
- name: Upload unix zip asset
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: bw-${{ env.LOWER_RUNNER_OS }}-arm64-${{ env._PACKAGE_VERSION }}.zip
path: apps/cli/dist/bw-${{ env.LOWER_RUNNER_OS }}-arm64-${{ env._PACKAGE_VERSION }}.zip
if-no-files-found: error
- name: Upload unix checksum asset
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: bw-${{ env.LOWER_RUNNER_OS }}-arm64-sha256-${{ env._PACKAGE_VERSION }}.txt
path: apps/cli/dist/bw-${{ env.LOWER_RUNNER_OS }}-arm64-sha256-${{ env._PACKAGE_VERSION }}.txt
if-no-files-found: error
cli-windows:
name: Build CLI Windows
runs-on: windows-2022
@ -360,6 +435,7 @@ jobs:
needs:
- setup
- cli
- cli-arm64
- cli-windows
- snap
steps:

View File

@ -27,11 +27,13 @@
"package:win": "pkg . --targets win-x64 --output ./dist/windows/bw.exe",
"package:mac": "pkg . --targets macos-x64 --output ./dist/macos/bw",
"package:lin": "pkg . --targets linux-x64 --output ./dist/linux/bw",
"package:lin:arm64": "pkg . --targets linux-arm64 --output ./dist/linux-arm64/bw",
"debug": "node --inspect ./build/bw.js",
"dist": "npm run build:prod && npm run clean && npm run package",
"dist:win": "npm run build:prod && npm run clean && npm run package:win",
"dist:mac": "npm run build:prod && npm run clean && npm run package:mac",
"dist:lin": "npm run build:prod && npm run clean && npm run package:lin",
"dist:lin:arm64": "npm run build:prod && npm run clean && npm run package:lin:arm64",
"publish:npm": "npm run build:prod && npm publish --access public",
"test": "jest",
"test:watch": "jest --watch",
@ -49,7 +51,7 @@
"dependencies": {
"@koa/multer": "3.0.2",
"@koa/router": "12.0.1",
"argon2": "0.31.0",
"argon2": "0.31.2",
"big-integer": "1.6.51",
"browser-hrtime": "1.1.8",
"chalk": "4.1.2",

10
package-lock.json generated
View File

@ -29,7 +29,7 @@
"@microsoft/signalr": "8.0.0",
"@microsoft/signalr-protocol-msgpack": "8.0.0",
"@ng-select/ng-select": "11.2.0",
"argon2": "0.31.0",
"argon2": "0.31.2",
"argon2-browser": "1.18.0",
"big-integer": "1.6.51",
"bootstrap": "4.6.0",
@ -202,7 +202,7 @@
"dependencies": {
"@koa/multer": "3.0.2",
"@koa/router": "12.0.1",
"argon2": "0.31.0",
"argon2": "0.31.2",
"big-integer": "1.6.51",
"browser-hrtime": "1.1.8",
"chalk": "4.1.2",
@ -12457,9 +12457,9 @@
"dev": true
},
"node_modules/argon2": {
"version": "0.31.0",
"resolved": "https://registry.npmjs.org/argon2/-/argon2-0.31.0.tgz",
"integrity": "sha512-r56NWwlE3tjD/FIqL1T+V4Ka+Mb5yMF35w1YWHpwpEjeONXBUbxmjhWkWqY63mse8lpcZ+ZZIGpKL+s+qXhyfg==",
"version": "0.31.2",
"resolved": "https://registry.npmjs.org/argon2/-/argon2-0.31.2.tgz",
"integrity": "sha512-QSnJ8By5Mth60IEte45w9Y7v6bWcQw3YhRtJKKN8oNCxnTLDiv/AXXkDPf2srTMfxFVn3QJdVv2nhXESsUa+Yg==",
"hasInstallScript": true,
"dependencies": {
"@mapbox/node-pre-gyp": "^1.0.11",

View File

@ -162,7 +162,7 @@
"@microsoft/signalr": "8.0.0",
"@microsoft/signalr-protocol-msgpack": "8.0.0",
"@ng-select/ng-select": "11.2.0",
"argon2": "0.31.0",
"argon2": "0.31.2",
"argon2-browser": "1.18.0",
"big-integer": "1.6.51",
"bootstrap": "4.6.0",