103 lines
3.9 KiB
YAML
103 lines
3.9 KiB
YAML
name: CI
|
|
on:
|
|
push:
|
|
branches: ['**']
|
|
tags-ignore: ['**']
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ci-${{ gitea.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
verify:
|
|
name: Rust, web and container
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- name: Verify Linux runner
|
|
run: |
|
|
set -eu
|
|
test "$(uname -s)" = Linux
|
|
for tool in cargo rustc node npm docker; do command -v "$tool" >/dev/null || { echo "Missing $tool on ubuntu-latest runner"; exit 1; }; done
|
|
test "$(node -p 'process.versions.node.split(".")[0]')" -ge 22
|
|
rustup component list --installed | grep -q rustfmt
|
|
rustup component list --installed | grep -q clippy
|
|
pkg-config --exists webkit2gtk-4.1 ayatana-appindicator3-0.1 librsvg-2.0 || { echo 'Missing Tauri GTK/WebKit development packages'; exit 1; }
|
|
docker info >/dev/null || { echo 'Docker daemon unavailable'; exit 1; }
|
|
- uses: Swatinem/rust-cache@v2
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
cache: npm
|
|
cache-dependency-path: |
|
|
panel/web/package-lock.json
|
|
launcher/package-lock.json
|
|
- name: Check Rust
|
|
run: |
|
|
mkdir -p launcher/dist
|
|
echo '<!doctype html>' > launcher/dist/index.html
|
|
cargo fmt --all --check
|
|
cargo clippy --workspace --all-targets --locked -- -D warnings
|
|
cargo test --workspace --locked
|
|
- name: Check panel and launcher UI
|
|
run: |
|
|
for app in panel/web launcher; do
|
|
(cd "$app" && npm ci --no-audit --no-fund && npm run check && npm run build)
|
|
done
|
|
- name: Build panel container
|
|
run: docker build -t scopenet-panel:ci .
|
|
|
|
launcher-windows:
|
|
name: Windows launcher
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- name: Find PowerShell 7 on Windows runner
|
|
shell: powershell
|
|
run: |
|
|
$pwsh = (Get-Command pwsh -ErrorAction SilentlyContinue | Select-Object -First 1).Source
|
|
if (-not $pwsh) { $pwsh = Join-Path $env:ProgramFiles 'PowerShell\7\pwsh.exe' }
|
|
if (-not (Test-Path $pwsh)) { throw "PowerShell 7 is not available to the runner at $pwsh" }
|
|
$version = & $pwsh -NoProfile -Command '$PSVersionTable.PSVersion.ToString()'
|
|
Write-Host "Using PowerShell $version at $pwsh"
|
|
Add-Content -Path $env:GITEA_PATH -Value (Split-Path $pwsh)
|
|
- name: Verify Windows runner
|
|
shell: pwsh
|
|
run: |
|
|
if (-not $IsWindows) { throw 'windows-latest must be a Windows host runner' }
|
|
foreach ($tool in @('cargo', 'rustc', 'node', 'npm')) {
|
|
if (-not (Get-Command $tool -ErrorAction SilentlyContinue)) { throw "Missing $tool" }
|
|
}
|
|
if ([int](node -p 'process.versions.node.split(".")[0]') -lt 22) { throw 'Node 22+ required' }
|
|
- uses: Swatinem/rust-cache@v2
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
cache: npm
|
|
cache-dependency-path: launcher/package-lock.json
|
|
- run: npm ci --no-audit --no-fund
|
|
working-directory: launcher
|
|
- run: npm run build
|
|
working-directory: launcher
|
|
- run: cargo clippy -p scopenet-launcher --locked -- -D warnings
|
|
- run: cargo test -p scopenet-launcher -p scopenet-core -p scopenet-shared --locked
|
|
|
|
engine-online:
|
|
name: Real Minecraft installs (manual)
|
|
if: ${{ gitea.event_name == 'workflow_dispatch' }}
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: true
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- name: Verify runner
|
|
run: |
|
|
test "$(uname -s)" = Linux
|
|
command -v cargo
|
|
- uses: Swatinem/rust-cache@v2
|
|
- run: cargo test -p scopenet-core --test online --locked -- --ignored --test-threads=2 --nocapture
|