6bed9b92ca
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
132 lines
5.3 KiB
YAML
132 lines
5.3 KiB
YAML
name: launcher
|
|
# Builds the launcher on Linux, macOS and Windows. A pushed `launcher-vX.Y.Z` tag also puts the
|
|
# three archives on a draft GitHub release of that tag, to publish by hand. Horizon's own
|
|
# releases are tagged `vYYYY.MM.DD`; the launcher reads only `launcher-v*` releases for itself.
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches: [launcher, 'launcher-*']
|
|
tags: ['launcher-v*']
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
asset: horizon-launcher-linux-x86_64.tar.gz
|
|
binary: horizon-launcher
|
|
- os: macos-latest
|
|
asset: horizon-launcher-macos-arm64.zip
|
|
binary: horizon-launcher
|
|
- 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.os }}
|
|
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 }}
|
|
defaults:
|
|
run:
|
|
working-directory: launcher
|
|
shell: bash
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: launcher
|
|
- 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: The tag matches Cargo.toml
|
|
if: startsWith(github.ref, 'refs/tags/launcher-v')
|
|
run: grep -qx "version = \"${GITHUB_REF_NAME#launcher-v}\"" Cargo.toml
|
|
- run: cargo test --release --locked --lib
|
|
- run: cargo build --release --locked
|
|
- name: Only system libraries
|
|
if: runner.os == 'Windows'
|
|
run: python ../tools/check_imports.py target/release/${{ matrix.binary }}
|
|
- 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"
|
|
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; }
|
|
"$launcher" --version
|
|
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"
|
|
python ../tools/check_imports.py "$launcher"
|
|
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
|
|
- name: Package
|
|
run: |
|
|
mkdir -p dist
|
|
cp target/release/${{ matrix.binary }} dist/
|
|
cd dist
|
|
if [[ "${{ matrix.asset }}" == *.tar.gz ]]; then
|
|
tar czf ../${{ matrix.asset }} ${{ matrix.binary }}
|
|
elif [[ "$RUNNER_OS" == "Windows" ]]; then
|
|
7z a ../${{ matrix.asset }} ${{ matrix.binary }}
|
|
else
|
|
zip ../${{ matrix.asset }} ${{ matrix.binary }}
|
|
fi
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.asset }}
|
|
path: launcher/${{ matrix.asset }}
|
|
|
|
release:
|
|
if: startsWith(github.ref, 'refs/tags/launcher-v')
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
path: dist
|
|
merge-multiple: true
|
|
# A draft, and never marked latest: Horizon's own releases stay the repository's latest.
|
|
- uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ github.ref_name }}
|
|
name: Horizon launcher ${{ github.ref_name }}
|
|
draft: true
|
|
make_latest: false
|
|
files: dist/*
|