Skip to content

Commit

Permalink
feat: arm64 build for bw cli
Browse files Browse the repository at this point in the history
  • Loading branch information
mloiseleur committed Dec 22, 2023
1 parent 062a3ce commit b4c8b75
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/build-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,68 @@ 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 }}
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
update-binfmts --display
- 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: ./

- 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 }}-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-2019
Expand Down Expand Up @@ -374,6 +436,7 @@ jobs:
- cloc
- setup
- cli
- cli-arm64
- cli-windows
- snap
steps:
Expand Down
2 changes: 2 additions & 0 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit b4c8b75

Please sign in to comment.