Files

172 lines
5.4 KiB
YAML

name: GPUI Preview Build
on:
workflow_dispatch:
inputs:
source_ref:
description: GPUI source branch, tag, or commit to package
required: true
default: migration/gpui
type: string
permissions:
contents: read
concurrency:
group: gpui-preview-${{ inputs.source_ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: '0'
jobs:
prepare:
name: Resolve GPUI preview source
runs-on: ubuntu-24.04
timeout-minutes: 10
outputs:
source_sha: ${{ steps.metadata.outputs.source_sha }}
version: ${{ steps.metadata.outputs.version }}
steps:
- name: Checkout GPUI source
uses: actions/checkout@v4
with:
ref: ${{ inputs.source_ref }}
fetch-depth: 1
persist-credentials: false
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Resolve and validate preview metadata
id: metadata
shell: bash
run: |
set -euo pipefail
source_sha="$(git rev-parse HEAD)"
version="$(python3 -c 'import tomllib; print(tomllib.load(open("Cargo.toml", "rb"))["workspace"]["package"]["version"])')"
python3 - "${version}" <<'PY'
import re
import sys
version = sys.argv[1]
semver = r"[0-9]+\.[0-9]+\.[0-9]+-(?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?"
if not re.fullmatch(semver, version):
raise SystemExit(
f"GPUI Preview Build requires a prerelease workspace version, got {version!r}. "
"Use a version such as 2.0.0-preview.1 so the packaged application uses the Preview identity."
)
PY
{
echo "source_sha=${source_sha}"
echo "version=${version}"
} >> "${GITHUB_OUTPUT}"
echo "GPUI source: ${source_sha}"
echo "Preview version: ${version}"
- name: Verify build configuration
shell: bash
env:
NYATERM_GITHUB_GIST_CLIENT_ID: ${{ vars.NYATERM_GITHUB_GIST_CLIENT_ID }}
run: |
set -euo pipefail
if [[ -z "${NYATERM_GITHUB_GIST_CLIENT_ID:-}" ]]; then
echo 'NYATERM_GITHUB_GIST_CLIENT_ID repository variable is required' >&2
exit 1
fi
- name: Test packaging helpers
run: >-
python -m unittest
scripts.tests.test_package_native
scripts.tests.test_verify_native_package
package:
name: Package ${{ matrix.label }}
needs: prepare
runs-on: ${{ matrix.os }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
include:
- { label: macos-arm64, os: macos-15, target: aarch64-apple-darwin }
- { label: macos-x64, os: macos-15-intel, target: x86_64-apple-darwin }
- { label: linux-x64, os: ubuntu-22.04, target: x86_64-unknown-linux-gnu }
- { label: linux-arm64, os: ubuntu-24.04-arm, target: aarch64-unknown-linux-gnu }
- { label: windows-x64, os: windows-2025, target: x86_64-pc-windows-msvc }
- { label: windows-arm64, os: windows-2025, target: aarch64-pc-windows-msvc }
steps:
- name: Checkout resolved GPUI source
uses: actions/checkout@v4
with:
ref: ${{ needs.prepare.outputs.source_sha }}
persist-credentials: false
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
targets: ${{ matrix.target }}
cache-key: gpui-preview-${{ matrix.target }}
cache-on-failure: 'true'
save-cache: always
- name: Install Linux system dependencies
if: runner.os == 'Linux'
uses: ./.github/actions/install-linux-deps
with:
extra_packages: curl file patchelf desktop-file-utils dpkg-dev rpm
- name: Install AppImage tooling
if: runner.os == 'Linux'
shell: bash
env:
TARGET: ${{ matrix.target }}
run: bash scripts/ci/install-appimagetool.sh "${TARGET}"
- name: Install NSIS
if: runner.os == 'Windows'
shell: pwsh
run: ./scripts/ci/install-nsis.ps1
- name: Package native GPUI application
shell: bash
env:
APPIMAGE_EXTRACT_AND_RUN: ${{ runner.os == 'Linux' && '1' || '' }}
NYATERM_ARTIFACT_VERSION: ${{ needs.prepare.outputs.version }}
NYATERM_GITHUB_GIST_CLIENT_ID: ${{ vars.NYATERM_GITHUB_GIST_CLIENT_ID }}
NYATERM_VERSION: ${{ needs.prepare.outputs.version }}
TARGET: ${{ matrix.target }}
run: python scripts/release/package_native.py "${TARGET}"
- name: Verify native package
shell: bash
env:
TARGET: ${{ matrix.target }}
VERSION: ${{ needs.prepare.outputs.version }}
run: >-
python scripts/release/verify_native_package.py
--target "${TARGET}" --version "${VERSION}"
--artifact-version "${VERSION}" --dist dist
- name: Upload preview package artifact
uses: actions/upload-artifact@v4
with:
name: NyaTerm-GPUI-Preview-${{ matrix.label }}
path: dist/*
if-no-files-found: error
retention-days: 7