86e0e122f4
Ludovic wants releases as often as changes land. A kind now releases when player-facing pull requests merged since its last release and the newest of them merged 15 minutes ago (a burst of merges becomes one release), or the oldest an hour ago when merges never pause; release-now still ships at once. There is no minimum time between releases. The scheduled checks run every 10 minutes (game at :02, launcher at :07) so a settled release goes out without another merge. Release titles keep proper nouns (Horizon's mark, Microsoft, LAN, ...) when they lowercase the clauses after the first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
253 lines
12 KiB
YAML
253 lines
12 KiB
YAML
name: launcher
|
|
# Builds the launcher on Linux, macOS and Windows, and releases it by itself (docs/release-flow.md): after a
|
|
# push to main that changes the launcher or what it builds in (crates/horizon-prepare, crates/horizon-theme),
|
|
# every 10 minutes (a release waiting for merges to settle goes out) and by hand, tools/release_train.py decides as
|
|
# for the game.
|
|
# A release is launcher-vX.Y.Z: the patch after the last launcher tag, or the next minor when a merged pull
|
|
# request is labelled feature. The version is given to the build (HORIZON_LAUNCHER_VERSION): no bump commits.
|
|
# Never marked latest. Pushes to launcher branches only build. RELEASES_PAUSED=1 stops releases.
|
|
# gh workflow run launcher --ref <branch> # dry run: builds everything, publishes nothing
|
|
# gh workflow run launcher --ref main -f dry_run=false -f force=true
|
|
|
|
on:
|
|
push:
|
|
branches: [main, launcher, 'launcher-*']
|
|
paths:
|
|
- 'launcher/**'
|
|
- 'crates/horizon-prepare/**'
|
|
- 'crates/horizon-theme/**'
|
|
- '.github/workflows/launcher.yml'
|
|
schedule:
|
|
- cron: '7-59/10 * * * *'
|
|
workflow_dispatch:
|
|
inputs:
|
|
dry_run:
|
|
description: Build everything and write the notes, but publish nothing
|
|
type: boolean
|
|
default: true
|
|
force:
|
|
description: Release even without launcher changes, before merges settle or while paused
|
|
type: boolean
|
|
default: false
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: launcher-${{ github.ref == 'refs/heads/main' && 'release' || github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
decide:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
outputs:
|
|
release: ${{ steps.decide.outputs.release }}
|
|
tag: ${{ steps.decide.outputs.tag }}
|
|
head: ${{ steps.decide.outputs.head }}
|
|
version: ${{ steps.decide.outputs.version }}
|
|
dry_run: ${{ steps.mode.outputs.dry_run }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- id: mode
|
|
# Off main every run is a dry run (a launcher branch's push only builds).
|
|
run: echo "dry_run=${{ github.ref != 'refs/heads/main' || (github.event_name == 'workflow_dispatch' && inputs.dry_run) }}" >> "$GITHUB_OUTPUT"
|
|
- id: decide
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
RELEASES_PAUSED: ${{ vars.RELEASES_PAUSED }}
|
|
# A push or a run off main builds its own commit; otherwise main's newest commit with green checks.
|
|
HEAD_SHA: ${{ (github.event_name == 'push' || steps.mode.outputs.dry_run == 'true') && github.sha || '' }}
|
|
FORCE: ${{ inputs.force && 'yes' || '' }}
|
|
run: |
|
|
python3 tools/release_train.py decide --kind launcher ${HEAD_SHA:+--head "$HEAD_SHA"} ${FORCE:+--force} | tee decision.json
|
|
echo "### $(jq -r '.reason' decision.json)" >> "$GITHUB_STEP_SUMMARY"
|
|
tag=$(jq -r '.tag' decision.json)
|
|
echo "version=${tag#launcher-v}" >> "$GITHUB_OUTPUT"
|
|
# A dry run (and a launcher branch's push) builds whatever the decision.
|
|
if [[ "${{ steps.mode.outputs.dry_run }}" == true ]]; then
|
|
echo "release=true" >> "$GITHUB_OUTPUT"
|
|
echo "head=$GITHUB_SHA" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
build:
|
|
needs: decide
|
|
if: needs.decide.outputs.release == 'true'
|
|
name: build ${{ matrix.name }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: linux
|
|
os: ubuntu-22.04
|
|
asset: horizon-launcher-linux-x86_64.tar.gz
|
|
binary: horizon-launcher
|
|
- name: macos
|
|
mac: true
|
|
asset: horizon-launcher-macos-arm64.zip
|
|
binary: horizon-launcher
|
|
- name: windows
|
|
os: windows-latest
|
|
asset: horizon-launcher-windows-x64.zip
|
|
binary: horizon-launcher.exe
|
|
# The C runtime linked in: without it the launcher asks for VCRUNTIME140.dll,
|
|
# which only the Visual C++ redistributable installs.
|
|
rustflags: -C target-feature=+crt-static
|
|
runs-on: ${{ matrix.mac && (vars.MAC_RUNNER || 'ludovics-mac-mini') || matrix.os }}
|
|
timeout-minutes: 40
|
|
env:
|
|
RUSTFLAGS: ${{ matrix.rustflags }}
|
|
# Horizon's Azure app for Microsoft sign-in (docs/microsoft-account.md): a repository
|
|
# variable, not a secret. Unset, the launcher says sign-in is not configured.
|
|
HORIZON_MSA_CLIENT_ID: ${{ vars.HORIZON_MSA_CLIENT_ID }}
|
|
# The release's version, built in (launcher/src/backend.rs VERSION); a launcher branch's build keeps
|
|
# Cargo.toml's.
|
|
HORIZON_LAUNCHER_VERSION: ${{ (github.event_name != 'push' || github.ref == 'refs/heads/main') && needs.decide.outputs.version || '' }}
|
|
defaults:
|
|
run:
|
|
working-directory: launcher
|
|
shell: bash
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ needs.decide.outputs.head }}
|
|
persist-credentials: false
|
|
# The Mac mini's runner keeps its target/ between runs.
|
|
clean: ${{ runner.environment == 'github-hosted' }}
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
if: runner.environment == 'github-hosted'
|
|
with:
|
|
workspaces: launcher
|
|
shared-key: launcher-${{ matrix.name }}
|
|
- name: Linux libraries GPUI links to
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libxkbcommon-x11-dev libwayland-dev libx11-xcb-dev libfontconfig-dev libvulkan-dev libasound2-dev
|
|
- name: Metal shaders compiled now, or at run time without the Metal toolchain
|
|
# GPUI compiles its Metal shaders when it builds; the Mac mini has Xcode without the Metal toolchain
|
|
# (xcodebuild -downloadComponent MetalToolchain), so there they are compiled when the launcher starts.
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
if ! xcrun metal --version > /dev/null 2>&1; then
|
|
echo "::notice::No Metal toolchain on this runner: GPUI compiles its shaders at run time"
|
|
echo "LAUNCHER_FEATURES=gpui/runtime_shaders" >> "$GITHUB_ENV"
|
|
fi
|
|
- run: cargo test --release --locked --lib ${LAUNCHER_FEATURES:+--features "$LAUNCHER_FEATURES"}
|
|
- run: cargo build --release --locked ${LAUNCHER_FEATURES:+--features "$LAUNCHER_FEATURES"}
|
|
- name: The version is the release's
|
|
run: |
|
|
out=$(target/release/${{ matrix.binary }} --version)
|
|
echo "$out"
|
|
expected="${HORIZON_LAUNCHER_VERSION:-$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)}"
|
|
[[ "$out" == "horizon-launcher $expected" ]] || { echo "::error::expected horizon-launcher $expected"; exit 1; }
|
|
- name: Only system libraries
|
|
run: |
|
|
file=target/release/${{ matrix.binary }}
|
|
case "$RUNNER_OS" in
|
|
Windows) python ../tools/check_imports.py "$file" ;;
|
|
macOS) others=$(otool -L "$file" | tail -n +2 | awk '{print $1}' | grep -v -E '^(/usr/lib/|/System/Library/)' || true)
|
|
[[ -z "$others" ]] || { echo "::error::links $others"; exit 1; } ;;
|
|
esac
|
|
- name: Smoke test
|
|
env:
|
|
HORIZON_LAUNCHER_NO_SELF_UPDATE: '1'
|
|
HORIZON_GITHUB_TOKEN: ${{ github.token }}
|
|
run: |
|
|
set -euo pipefail
|
|
export HORIZON_LAUNCHER_HOME="${RUNNER_TEMP//\\//}/horizon-launcher-smoke"
|
|
export HORIZON_HOME="$HORIZON_LAUNCHER_HOME/game"
|
|
rm -rf "$HORIZON_LAUNCHER_HOME"
|
|
launcher="$PWD/target/release/${{ matrix.binary }}"
|
|
# GitHub's API rate-limits shared runner addresses now and then: try a few times.
|
|
retry() { for i in 1 2 3 4; do "$@" && return 0; sleep $((i * 15)); done; return 1; }
|
|
retry "$launcher" versions
|
|
retry "$launcher" install latest
|
|
"$launcher" versions --installed
|
|
"$launcher" links --json
|
|
"$launcher" menu-style classic
|
|
grep -qx 'menuStyle:classic' "$HORIZON_HOME/horizon.txt"
|
|
"$launcher" menu-style horizon
|
|
clients=("$HORIZON_LAUNCHER_HOME"/versions/v*/horizon-client*)
|
|
client="${clients[0]}"
|
|
echo "installed client: $client"
|
|
# The game's Linux build is the game's to keep portable (release.yml checks it): a
|
|
# release linked to a Nix store is a warning here, not a broken launcher.
|
|
soft() { if [[ "$RUNNER_OS" == "Linux" ]]; then "$@" || echo "::warning::$* failed"; else "$@"; fi; }
|
|
if [[ "$RUNNER_OS" == "Windows" ]]; then
|
|
python ../tools/check_imports.py "$client"
|
|
elif [[ "$RUNNER_OS" == "Linux" ]]; then
|
|
soft python3 ../tools/check_imports.py "$client"
|
|
fi
|
|
# The client starts: --help prints before any window or GPU is needed.
|
|
help() { "$client" --help > "$RUNNER_TEMP/help.txt" 2>&1 && head -3 "$RUNNER_TEMP/help.txt" && grep -q -- '--resources' "$RUNNER_TEMP/help.txt"; }
|
|
soft help
|
|
rm -rf "$HORIZON_LAUNCHER_HOME"
|
|
- name: Package
|
|
run: |
|
|
rm -rf dist out && mkdir -p out
|
|
if [[ "$RUNNER_OS" == "macOS" ]]; then
|
|
# Horizon.app, zipped (self-update) and in a .dmg (installer): packaging/macos.
|
|
python3 -m venv "$RUNNER_TEMP/dmg" && "$RUNNER_TEMP/dmg/bin/pip" install --quiet dmgbuild==1.6.5
|
|
version=${HORIZON_LAUNCHER_VERSION:-$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)}
|
|
DMGBUILD="$RUNNER_TEMP/dmg/bin/dmgbuild" ../packaging/macos/package.sh target/release/${{ matrix.binary }} "$version" out
|
|
rm -rf out/Horizon.app
|
|
else
|
|
mkdir -p dist
|
|
cp target/release/${{ matrix.binary }} dist/
|
|
if [[ "${{ matrix.asset }}" == *.tar.gz ]]; then
|
|
(cd dist && tar czf ../out/${{ matrix.asset }} ${{ matrix.binary }})
|
|
else
|
|
(cd dist && 7z a ../out/${{ matrix.asset }} ${{ matrix.binary }})
|
|
fi
|
|
fi
|
|
ls -l out
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.asset }}
|
|
path: launcher/out/*
|
|
retention-days: 7
|
|
|
|
release:
|
|
needs: [decide, build]
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Notes
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
python3 tools/release_train.py notes --kind launcher --tag "${{ needs.decide.outputs.tag }}" \
|
|
--head "${{ needs.decide.outputs.head }}" --out notes > /dev/null
|
|
{ echo "## $(cat notes/title.txt)"; echo; cat notes/body.md; } >> "$GITHUB_STEP_SUMMARY"
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
path: dist
|
|
merge-multiple: true
|
|
# Never marked latest: Horizon's own releases stay the repository's latest.
|
|
- name: Publish ${{ needs.decide.outputs.tag }}
|
|
if: needs.decide.outputs.dry_run != 'true'
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
TAG: ${{ needs.decide.outputs.tag }}
|
|
run: |
|
|
gh release create "$TAG" --target "${{ needs.decide.outputs.head }}" --title "$(cat notes/title.txt)" \
|
|
--notes-file notes/body.md --latest=false dist/horizon-launcher-*
|
|
- name: Dry run, the release that would be published
|
|
if: needs.decide.outputs.dry_run == 'true'
|
|
run: |
|
|
echo "Would publish ${{ needs.decide.outputs.tag }} at ${{ needs.decide.outputs.head }}: $(cat notes/title.txt)"
|
|
ls -l dist
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: launcher-release-notes
|
|
path: notes/
|