linux-arm-native workflow (electerm/electerm)
The linux-arm-native workflow from electerm/electerm, explained and optimized by Latchkey.
CI health: D - needs work
Point runs-on at Latchkey and get caching, run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the linux-arm-native workflow from the electerm/electerm repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
# Alternative workflow using native ARM64 runners
name: linux-arm-native
on:
push:
branches: [ build, test, build-only, linux-arm ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-24.04-arm
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip arm-linux]') && !contains(github.event.head_commit.message, '[skip linux3]') }}
env:
# Force electron-builder to use the system fpm (ARM native) instead of downloading x86 prebuilt bundle
USE_SYSTEM_FPM: true
steps:
- uses: actions/checkout@v4
- name: Set up Node.js 16.x
uses: actions/setup-node@v4
with:
node-version: 16.x
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
python3-dev \
build-essential \
libnss3-dev \
libsecret-1-dev \
fakeroot \
rpm \
libgtk-3-0 \
libnotify4 \
libnss3 \
libxss1 \
libxtst6 \
xdg-utils \
libatspi2.0-0 \
libuuid1 \
libsecret-1-0 \
libappindicator3-1 \
ruby-full
- name: Install FPM
run: sudo gem install fpm
- name: Verify glibc version
run: ldd --version
- name: Verify fpm
run: |
which fpm
fpm --version
- name: Install yarn
run: npm install -g yarn
- name: ci init
run: npm config set legacy-peer-deps true
- name: Clear electron-builder cache
run: rm -rf ~/.cache/electron-builder
- name: Update electron version and remove package-lock
run: |
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json'));
pkg.devDependencies.electron = '22.3.27';
pkg.devDependencies['electron-builder'] = '26.0.20';
pkg.devDependencies['@electron/rebuild'] = '3.7.2';
pkg.dependencies['node-pty'] = '1.1.0-beta14';
pkg.dependencies.serialport = '13.0.0';
pkg.devDependencies.vite = '4';
pkg.devDependencies['@vitejs/plugin-react'] = '4.7.0';
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
"
rm -f package-lock.json
- name: Install npm dependencies
run: npm i && npm i -S @electron/rebuild@3.7.2
- name: Install R2 dependencies if needed
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
run: npm i -D @aws-sdk/client-s3
- name: Build application
run: npm run b
- name: Run pb
run: npm run pb
- name: Build ARM64 packages
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CF_R2_ACCOUNT_ID: ${{ secrets.CF_R2_ACCOUNT_ID }}
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
WORKFLOW_NAME: ${{ github.workflow }}
run: node build/bin/build-linux-armThe same workflow, on Latchkey
Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.
# Alternative workflow using native ARM64 runners name: linux-arm-native on: push: branches: [ build, test, build-only, linux-arm ] workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build: timeout-minutes: 30 runs-on: latchkey-small-arm environment: build if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip arm-linux]') && !contains(github.event.head_commit.message, '[skip linux3]') }} env: # Force electron-builder to use the system fpm (ARM native) instead of downloading x86 prebuilt bundle USE_SYSTEM_FPM: true steps: - uses: actions/checkout@v4 - name: Set up Node.js 16.x uses: actions/setup-node@v4 with: cache: 'npm' node-version: 16.x - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' - name: Install system dependencies run: | sudo apt-get update sudo apt-get install -y \ python3-dev \ build-essential \ libnss3-dev \ libsecret-1-dev \ fakeroot \ rpm \ libgtk-3-0 \ libnotify4 \ libnss3 \ libxss1 \ libxtst6 \ xdg-utils \ libatspi2.0-0 \ libuuid1 \ libsecret-1-0 \ libappindicator3-1 \ ruby-full - name: Install FPM run: sudo gem install fpm - name: Verify glibc version run: ldd --version - name: Verify fpm run: | which fpm fpm --version - name: Install yarn run: npm install -g yarn - name: ci init run: npm config set legacy-peer-deps true - name: Clear electron-builder cache run: rm -rf ~/.cache/electron-builder - name: Update electron version and remove package-lock run: | node -e " const fs = require('fs'); const pkg = JSON.parse(fs.readFileSync('package.json')); pkg.devDependencies.electron = '22.3.27'; pkg.devDependencies['electron-builder'] = '26.0.20'; pkg.devDependencies['@electron/rebuild'] = '3.7.2'; pkg.dependencies['node-pty'] = '1.1.0-beta14'; pkg.dependencies.serialport = '13.0.0'; pkg.devDependencies.vite = '4'; pkg.devDependencies['@vitejs/plugin-react'] = '4.7.0'; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2)); " rm -f package-lock.json - name: Install npm dependencies run: npm i && npm i -S @electron/rebuild@3.7.2 - name: Install R2 dependencies if needed if: ${{ contains(github.event.head_commit.message, '[r2]') }} run: npm i -D @aws-sdk/client-s3 - name: Build application run: npm run b - name: Run pb run: npm run pb - name: Build ARM64 packages env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} CF_R2_ACCOUNT_ID: ${{ secrets.CF_R2_ACCOUNT_ID }} CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }} CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }} CF_R2_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }} BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }} WORKFLOW_NAME: ${{ github.workflow }} run: node build/bin/build-linux-arm
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cancel superseded runs when a branch or PR gets a newer push.
- Cache dependency installs on the setup step so they are served from cache.
- Add a job timeout so a hung step cannot burn hours of runner time.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.