ci: media dependencies, Windows toolchain, release builds, X11 tests
- system-deps composite action shared by all jobs: apt packages for audio, UI, libvpx/dav1d, PipeWire/SPA, libclang and Xvfb on Linux; NASM (aws-lc-sys) and libvpx from vcpkg (x64-windows-static-md, binary cache keyed on the vcpkg revision) on Windows, exporting VPX_LIB_DIR, VPX_INCLUDE_DIR, VPX_VERSION and VPX_STATIC for libvpx-native-sys - Linux tests run under xvfb-run with TSC_X11_TEST_DISPLAY set, so X11 capture and the XInput2 hotkey test run - release-build job: cargo build --release -p tsc-ui on Linux and Windows, uploads the binary (plus desktop files, or the NSIS installer when NSIS is on the runner) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
This commit is contained in:
2 files changed
+143
-7
No files matched your search
@@ -0,0 +1,82 @@
|
||||
name: System dependencies
|
||||
description: >
|
||||
Native libraries and tools the workspace builds against: apt packages on
|
||||
Linux; NASM and libvpx (vcpkg, cached) on Windows, exporting VPX_LIB_DIR,
|
||||
VPX_INCLUDE_DIR, VPX_VERSION and VPX_STATIC for libvpx-native-sys.
|
||||
|
||||
inputs:
|
||||
vpx-triplet:
|
||||
description: vcpkg triplet for libvpx on Windows (static library, dynamic CRT like Rust's default)
|
||||
default: x64-windows-static-md
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: apt packages
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
# ALSA (audio devices), fontconfig + xkbcommon (UI), libvpx + dav1d
|
||||
# (video codecs), PipeWire + SPA (screen and audio capture), libclang
|
||||
# (bindgen), Xvfb (X11 tests).
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
libasound2-dev libfontconfig1-dev libxkbcommon-dev \
|
||||
libvpx-dev libdav1d-dev libpipewire-0.3-dev libspa-0.2-dev libclang-dev \
|
||||
xvfb
|
||||
|
||||
# aws-lc-sys (WebRTC DTLS through str0m) assembles with NASM on Windows.
|
||||
- name: NASM
|
||||
if: runner.os == 'Windows'
|
||||
uses: ilammy/setup-nasm@v1
|
||||
|
||||
- name: vcpkg revision
|
||||
if: runner.os == 'Windows'
|
||||
id: vcpkg
|
||||
shell: pwsh
|
||||
run: |
|
||||
"commit=$(git -C "$env:VCPKG_INSTALLATION_ROOT" rev-parse HEAD)" >> $env:GITHUB_OUTPUT
|
||||
|
||||
- name: Cache vcpkg packages
|
||||
if: runner.os == 'Windows'
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ runner.temp }}\vcpkg-archives
|
||||
key: vcpkg-libvpx-${{ inputs.vpx-triplet }}-${{ steps.vcpkg.outputs.commit }}
|
||||
restore-keys: vcpkg-libvpx-${{ inputs.vpx-triplet }}-
|
||||
|
||||
- name: libvpx
|
||||
if: runner.os == 'Windows'
|
||||
shell: pwsh
|
||||
env:
|
||||
TRIPLET: ${{ inputs.vpx-triplet }}
|
||||
VCPKG_BINARY_SOURCES: clear;files,${{ runner.temp }}\vcpkg-archives,readwrite
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$vcpkg = Join-Path $env:VCPKG_INSTALLATION_ROOT 'vcpkg.exe'
|
||||
New-Item -ItemType Directory -Force (Join-Path $env:RUNNER_TEMP 'vcpkg-archives') | Out-Null
|
||||
& $vcpkg install "libvpx:$env:TRIPLET"
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
|
||||
# "libvpx:x64-windows-static-md 1.15.2#1 The reference ..."
|
||||
$line = (& $vcpkg list libvpx | Select-String -Pattern "^libvpx:$env:TRIPLET\s").Line
|
||||
if (-not $line) { throw "vcpkg list does not show libvpx:$env:TRIPLET" }
|
||||
$version = (($line -split '\s+')[1] -split '#')[0]
|
||||
|
||||
$root = Join-Path $env:VCPKG_INSTALLATION_ROOT "installed\$env:TRIPLET"
|
||||
$libdir = Join-Path $root 'lib'
|
||||
# libvpx-native-sys links "vpx"; libvpx's own MSVC build names the
|
||||
# library vpxmd.lib / vpxmt.lib, so provide vpx.lib if needed.
|
||||
if (-not (Test-Path (Join-Path $libdir 'vpx.lib'))) {
|
||||
$lib = Get-ChildItem $libdir -Filter 'vpx*.lib' | Select-Object -First 1
|
||||
if (-not $lib) { Get-ChildItem $libdir; throw "no vpx library in $libdir" }
|
||||
$libdir = Join-Path $env:RUNNER_TEMP 'vpx-lib'
|
||||
New-Item -ItemType Directory -Force $libdir | Out-Null
|
||||
Copy-Item $lib.FullName (Join-Path $libdir 'vpx.lib')
|
||||
}
|
||||
|
||||
"VPX_LIB_DIR=$libdir" >> $env:GITHUB_ENV
|
||||
"VPX_INCLUDE_DIR=$(Join-Path $root 'include')" >> $env:GITHUB_ENV
|
||||
"VPX_VERSION=$version" >> $env:GITHUB_ENV
|
||||
"VPX_STATIC=1" >> $env:GITHUB_ENV
|
||||
Write-Host "libvpx $version from $libdir"
|
||||
@@ -20,8 +20,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install system dependencies
|
||||
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libfontconfig1-dev libxkbcommon-dev
|
||||
- uses: ./.github/actions/system-deps
|
||||
- name: Install toolchain (rust-toolchain.toml)
|
||||
run: rustup toolchain install
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
@@ -44,17 +43,73 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install system dependencies
|
||||
if: runner.os == 'Linux'
|
||||
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libfontconfig1-dev libxkbcommon-dev
|
||||
- uses: ./.github/actions/system-deps
|
||||
- name: Install toolchain (rust-toolchain.toml)
|
||||
run: rustup toolchain install
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Build
|
||||
run: cargo build --workspace --all-targets --locked
|
||||
# Under Xvfb, so X11 tests (screen capture, global hotkeys through
|
||||
# XTEST input) run instead of skipping.
|
||||
- name: Test (Linux, Xvfb)
|
||||
if: runner.os == 'Linux'
|
||||
run: xvfb-run -a bash -c 'TSC_X11_TEST_DISPLAY="$DISPLAY" cargo test --workspace --locked'
|
||||
- name: Test
|
||||
if: runner.os != 'Linux'
|
||||
run: cargo test --workspace --locked
|
||||
|
||||
release-build:
|
||||
name: release build (${{ matrix.os }})
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-24.04
|
||||
artifact: tsc-desktop-linux-x86_64
|
||||
- os: windows-2025
|
||||
artifact: tsc-desktop-windows-x86_64
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/system-deps
|
||||
- name: Install toolchain (rust-toolchain.toml)
|
||||
run: rustup toolchain install
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
key: release
|
||||
- name: Build tsc-desktop
|
||||
run: cargo build --release --locked -p tsc-ui
|
||||
- name: Stage (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
mkdir -p dist
|
||||
cp target/release/tsc-desktop dist/
|
||||
cp packaging/linux/* dist/
|
||||
# The installer is built when NSIS is on the runner; unsigned.
|
||||
- name: Stage (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: pwsh
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force dist | Out-Null
|
||||
Copy-Item target\release\tsc-desktop.exe dist\
|
||||
$makensis = (Get-Command makensis -ErrorAction SilentlyContinue).Source
|
||||
if (-not $makensis) {
|
||||
$makensis = "${env:ProgramFiles(x86)}\NSIS\makensis.exe"
|
||||
}
|
||||
if (Test-Path $makensis) {
|
||||
$version = (cargo metadata --no-deps --format-version 1 | ConvertFrom-Json).packages |
|
||||
Where-Object name -eq 'tsc-ui' | Select-Object -ExpandProperty version
|
||||
& $makensis "/DVERSION=$version" "/DOUTDIR=$PWD\dist" packaging\windows\installer.nsi
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
} else {
|
||||
Write-Host "::notice::NSIS not found, uploading the executable only"
|
||||
}
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.artifact }}
|
||||
path: dist/
|
||||
if-no-files-found: error
|
||||
|
||||
deny:
|
||||
name: cargo-deny
|
||||
runs-on: ubuntu-24.04
|
||||
@@ -72,8 +127,7 @@ jobs:
|
||||
needs: test
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install system dependencies
|
||||
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libfontconfig1-dev libxkbcommon-dev
|
||||
- uses: ./.github/actions/system-deps
|
||||
- name: Install toolchain (rust-toolchain.toml)
|
||||
run: rustup toolchain install
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
Reference in new issue
Block a user