Skip to content

test(mobile): run the generated apps on a simulator and an emulator #69

test(mobile): run the generated apps on a simulator and an emulator

test(mobile): run the generated apps on a simulator and an emulator #69

name: Native Package Lifecycle
on:
push:
branches: [main]
paths:
- packages/typescript/src/package.ts
- packages/typescript/src/package.test.ts
- scripts/native-lifecycle.ts
- .github/workflows/native-lifecycle.yml
- package.json
- bun.lock
pull_request:
paths:
- packages/typescript/src/package.ts
- packages/typescript/src/package.test.ts
- scripts/native-lifecycle.ts
- .github/workflows/native-lifecycle.yml
- package.json
- bun.lock
workflow_dispatch:
permissions:
contents: read
jobs:
lifecycle:
name: ${{ matrix.name }} install/update/rollback
strategy:
fail-fast: false
matrix:
include:
# `name` is the whole identity of a leg: it is the evidence label the
# script writes under, the artifact name, and the path the upload
# reads back. It used to be two fields, `name` and `report`, and they
# disagreed on Windows — the script wrote windows-x64/ while the
# upload looked in win32-x64/ and failed with "No files were found".
- os: macos-15
name: darwin-arm64
- os: macos-15-intel
name: darwin-x64
- os: ubuntu-24.04
name: linux-x64
- os: windows-2025
name: windows-x64
runs-on: ${{ matrix.os }}
timeout-minutes: 30
env:
CRAFT_EVIDENCE_LABEL: ${{ matrix.name }}
steps:
- uses: actions/checkout@v6
- name: Setup Pantry (provides Bun)
uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777 # pinned: last SHA whose bundled typescript resolves on linux-x64
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Install WiX Toolset v3
if: runner.os == 'Windows'
shell: pwsh
run: |
# The windows-2025 image already ships WiX v3 — 3.14.1.20250415 as of
# this writing — and `choco install --version=3.14.1` is a *downgrade*
# against it, which choco refuses:
#
# A newer version of wixtoolset (v3.14.1.20250415) is already installed.
# Chocolatey installed 0/1 packages. 1 packages failed.
#
# So the step failed before it ever looked for the toolset it needed,
# and every Windows lifecycle run died at setup. Look first, install
# only when it is genuinely absent, and take whatever v3 the image
# provides rather than pinning under it.
$wixBin = {
Get-ChildItem "${env:ProgramFiles(x86)}\WiX Toolset v3*\bin" -Directory -ErrorAction SilentlyContinue |
Sort-Object Name -Descending | Select-Object -First 1
}
$bin = & $wixBin
if (-not $bin) {
choco install wixtoolset --version=3.14.1 --yes --no-progress
$bin = & $wixBin
}
if (-not $bin) { throw 'WiX Toolset v3 bin directory not found' }
Write-Host "Using WiX at $($bin.FullName)"
$bin.FullName | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Test packaging API
# The leading `./` is load-bearing. Without it bun reads the argument as
# a *filter* and walks the repository looking for test files that match,
# and on a hoisted node_modules that walk runs out of file descriptors
# before it finds anything:
#
# error: Cannot read file ".../packages/typescript/tsconfig.json": EMFILE
#
# which surfaces as a missing tsconfig rather than as a limit, and whose
# only job-level symptom is the artifact upload two steps later
# reporting "No files were found". With `./` bun opens the one file it
# was given: measured, the filter form needs >512 descriptors and the
# path form runs the same 19 tests in 64.
run: bun test ./packages/typescript/src/package.test.ts
- name: Exercise native lifecycle
run: bun scripts/native-lifecycle.ts --install
- name: Upload lifecycle evidence
if: always()
uses: actions/upload-artifact@v4
with:
name: native-lifecycle-${{ matrix.name }}
# Everything, not just report.json and the packages directory. The
# macOS relocation bug took a workflow dispatch to diagnose because
# the compiled fixtures at work/craft-lifecycle-* were outside the
# uploaded subtree, so the artifact alone could not answer what the
# runner had actually built.
path: artifacts/native-lifecycle/${{ matrix.name }}/**
if-no-files-found: error
retention-days: 90