name: 'Build Linux ARM'
description: 'Cross-compiles Hyper app for ARMv7l and ARM64 using arm-runner'
inputs:
node-version:
description: 'Node.js version to use'
required: true
matrix-name:
description: 'Matrix name (arch)'
required: true
matrix-cpu:
description: 'CPU architecture'
required: true
matrix-image:
description: 'Base OS image for ARM emulation'
required: true
upload-artifact:
description: 'Whether to upload artifacts'
required: false
default: 'true'
runs:
using: 'composite'
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
- name: Use Node.js
uses: actions/setup-node@v6.4.0
with:
node-version: ${{ inputs.node-version }}
- name: Enable pnpm
uses: pnpm/action-setup@v4
- name: Set up Python 3.10
uses: actions/setup-python@v6.2.0
with:
python-version: '3.10'
- name: Fix node-gyp and Python
shell: bash
run: |
python3 -m pip install packaging setuptools
- name: Get pnpm store directory path
shell: bash
id: pnpm-store-dir-path
run: echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@v5.0.5
with:
path: ${{ steps.pnpm-store-dir-path.outputs.dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml', 'app/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Delete old electron headers
shell: bash
run: |
rm -rf ~/.electron-gyp || true
- name: Install dependencies and tools
shell: bash
run: |
pnpm install --frozen-lockfile
sudo apt update
sudo apt install libarchive-tools
- name: Install Flatpak build tools
if: ${{ inputs.matrix-name == 'arm64' }}
shell: bash
run: |
sudo apt install -y flatpak flatpak-builder
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
- name: Cache Flatpak runtimes
if: ${{ inputs.matrix-name == 'arm64' }}
uses: actions/cache@v5.0.5
with:
path: ~/.local/share/flatpak
key: flatpak-runtimes-${{ runner.os }}-arm64-25.08
- name: Rebuild node-pty and all native modules for ARM
uses: pguyot/arm-runner-action@v2.6.5
with:
image_additional_mb: 2000
base_image: ${{ inputs.matrix-image }}
cpu: ${{ inputs.matrix-cpu }}
shell: bash
copy_artifact_path: target
copy_artifact_dest: target
commands: |
sudo apt-get update
sudo apt-get install -y python3-pip python3-setuptools python3-dev
pip3 install setuptools --break-system-packages || pip3 install setuptools
cd target
wget https://nodejs.org/dist/v22.11.0/node-v22.11.0-linux-${{ inputs.matrix-name }}.tar.xz
tar -xJf node-v22.11.0-linux-${{ inputs.matrix-name }}.tar.xz
sudo cp node-v22.11.0-linux-${{ inputs.matrix-name }}/* /usr/local/ -R
rm -rf node-v22.11.0-linux-${{ inputs.matrix-name }}.tar.xz node-v22.11.0-linux-${{ inputs.matrix-name }}
cd ..
npm install -g pnpm@10.33.0
pnpm run rebuild-node-pty
cd target
npx electron-rebuild
- name: Compile
shell: bash
run: pnpm run build
- name: Chown rebuilt node_modules
shell: bash
run: |
sudo chown -R $USER:$USER target/node_modules
- name: Prepare v8 snapshot (only armv7l)
if: ${{ inputs.matrix-name == 'armv7l' }}
shell: bash
run: |
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y libglib2.0-0:i386 libexpat1:i386 libgcc-s1:i386
SNAPSHOT_TARGET_ARCH=armv7l pnpm run v8-snapshot:arch
- name: Build final Electron App for ARM
shell: bash
run: |
TARGETS="deb rpm AppImage pacman"
if [ "${{ inputs.matrix-name }}" = "arm64" ]; then
TARGETS="$TARGETS flatpak"
fi
pnpm exec electron-builder -p never -l $TARGETS --${{ inputs.matrix-name }} -c electron-builder-linux-ci.json
env:
GH_TOKEN: ${{ env.GH_TOKEN }}
- name: Archive Build Artifacts
if: ${{ inputs.upload-artifact == 'true' }}
uses: actions/upload-artifact@v7.0.1
with:
name: hyper-linux-${{ inputs.matrix-name }}
path: |
dist/*.snap
dist/*.AppImage
dist/*.deb
dist/*.rpm
dist/*.pacman
dist/*.flatpak
- uses: actions/cache/save@v5.0.5
if: github.event_name != 'pull_request'
with:
path: ${{ steps.pnpm-store-dir-path.outputs.dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml', 'app/pnpm-lock.yaml') }}