wails/.github/workflows/cross-compile-test-v3.yml
Lea Anthony 284c67d037 perf(ci): use native ARM64 runner for linux/arm64 builds
Use ubuntu-24.04-arm runner for linux/arm64 cross-compile tests
instead of QEMU emulation. This should reduce build time from ~20min
to ~3min.

- Remove QEMU and Buildx setup (not needed with native runner)
- Remove --platform flag from Docker commands
- Each matrix entry now specifies its runner

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 10:10:58 +11:00

135 lines
4.2 KiB
YAML

name: Cross-Compile Test v3
on:
pull_request_review:
types: [submitted]
branches:
- v3-alpha
workflow_dispatch:
inputs:
pr_number:
description: 'PR number to test (optional, uses current branch if not specified)'
required: false
type: string
jobs:
check_approval:
name: Check PR Approval
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || github.event.review.state == 'approved'
outputs:
approved: ${{ steps.check.outputs.approved }}
steps:
- name: Check if PR is approved or manual dispatch
id: check
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "Manual dispatch, proceeding with cross-compile tests"
else
echo "PR approved, proceeding with cross-compile tests"
fi
echo "approved=true" >> $GITHUB_OUTPUT
cross_compile:
name: Cross-Compile (${{ matrix.target_os }}/${{ matrix.target_arch }})
needs: check_approval
runs-on: ${{ matrix.runner }}
if: needs.check_approval.outputs.approved == 'true'
strategy:
fail-fast: false
matrix:
include:
- target_os: darwin
target_arch: arm64
runner: ubuntu-latest
- target_os: darwin
target_arch: amd64
runner: ubuntu-latest
- target_os: linux
target_arch: arm64
runner: ubuntu-24.04-arm # Native ARM64 runner - much faster than QEMU
- target_os: linux
target_arch: amd64
runner: ubuntu-latest
- target_os: windows
target_arch: arm64
runner: ubuntu-latest
- target_os: windows
target_arch: amd64
runner: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout PR (if specified)
if: github.event_name == 'workflow_dispatch' && inputs.pr_number != ''
run: gh pr checkout ${{ inputs.pr_number }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true
cache-dependency-path: "v3/go.sum"
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Linux dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libgtk-3-dev libwebkit2gtk-4.1-dev build-essential pkg-config
version: 1.0
- name: Install Wails3 CLI
working-directory: v3
run: |
go install ./cmd/wails3
wails3 version
- name: Create test project
run: |
mkdir -p test-cross-compile
cd test-cross-compile
wails3 init -n crosstest -t vanilla
- name: Setup Docker cross-compile image
working-directory: test-cross-compile/crosstest
run: task common:setup:docker
- name: Fix replace directive for Docker build
working-directory: test-cross-compile/crosstest
run: |
# Change the replace directive to use absolute path that matches Docker mount
go mod edit -dropreplace github.com/wailsapp/wails/v3
go mod edit -replace github.com/wailsapp/wails/v3=${{ github.workspace }}/v3
- name: Cross-compile for ${{ matrix.target_os }}/${{ matrix.target_arch }}
working-directory: test-cross-compile/crosstest
run: |
echo "Cross-compiling for ${{ matrix.target_os }}/${{ matrix.target_arch }}..."
task ${{ matrix.target_os }}:build ARCH=${{ matrix.target_arch }}
echo "Cross-compilation successful!"
ls -la bin/
cross_compile_results:
if: ${{ always() }}
runs-on: ubuntu-latest
name: Cross-Compile Results
needs: [cross_compile]
steps:
- run: |
result="${{ needs.cross_compile.result }}"
echo "Cross-compile result: $result"
if [[ $result == "success" ]]; then
echo "All cross-compile tests passed!"
exit 0
else
echo "One or more cross-compile tests failed"
exit 1
fi