mirror of
https://github.com/sol1/rustguac.git
synced 2026-10-27 05:57:06 +00:00
c934065a84
A browser test harness under tests/e2e: serve.mjs serves the real static
tree over HTTP and lib/api.mjs answers /api/* from a small fixture address
book, recording every request the page makes, so the shipped pages run
against data the test controls without Vault, guacd or a session. CI gains
an e2e job that installs Chromium and runs the suite.
The first spec pins #252: at 1710px the connections, recordings and reports
tables fit inside the viewport and nothing scrolls sideways.
(cherry picked from commit 4ae28efec0)
108 lines
3.3 KiB
YAML
108 lines
3.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
jobs:
|
|
check:
|
|
name: Build & Lint
|
|
runs-on: ubuntu-latest
|
|
container: debian:trixie-slim
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y --no-install-recommends \
|
|
curl ca-certificates gcc g++ pkg-config make \
|
|
libcairo2-dev libjpeg-dev libpng-dev libwebp-dev \
|
|
libssh2-1-dev libssl-dev libvncserver-dev \
|
|
libpango1.0-dev libpulse-dev \
|
|
libavcodec-dev libavformat-dev libavutil-dev libswscale-dev \
|
|
libtelnet-dev libwebsockets-dev uuid-dev freerdp3-dev
|
|
|
|
- name: Install Rust toolchain
|
|
run: |
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
|
|
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
|
|
|
- name: Cache cargo registry & target
|
|
uses: actions/cache@v6
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
|
|
restore-keys: ${{ runner.os }}-cargo-
|
|
|
|
- name: Check formatting
|
|
run: $HOME/.cargo/bin/cargo fmt --check
|
|
|
|
- name: Clippy
|
|
run: $HOME/.cargo/bin/cargo clippy -- -D warnings
|
|
|
|
- name: Build
|
|
run: $HOME/.cargo/bin/cargo build --release
|
|
|
|
- name: Test
|
|
# Debug profile deliberately, not --release: debug_assertions and
|
|
# integer overflow checks are compiled in, and both are switched off
|
|
# in a release build. The wire-protocol parser and the session
|
|
# bookkeeping are exactly where an overflow would otherwise pass
|
|
# silently. Until now nothing here ran the suite at all, so the
|
|
# regression tests guarding past data-loss and access-control bugs
|
|
# were never exercised on a PR.
|
|
run: $HOME/.cargo/bin/cargo test
|
|
|
|
- name: Client tests
|
|
# Plain-node tests of the browser client (tests/*.mjs): no browser
|
|
# and no npm packages, just node's own test assertions.
|
|
run: |
|
|
apt-get install -y --no-install-recommends nodejs
|
|
for t in tests/*.mjs; do
|
|
echo "== $t"
|
|
node "$t"
|
|
done
|
|
|
|
- name: Security audit
|
|
# Ignored advisories + rationale live in .cargo/audit.toml so new
|
|
# advisories on the same crates still surface.
|
|
run: |
|
|
$HOME/.cargo/bin/cargo install cargo-audit
|
|
$HOME/.cargo/bin/cargo audit
|
|
|
|
e2e:
|
|
name: Browser tests
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Install Playwright
|
|
working-directory: tests/e2e
|
|
run: |
|
|
npm ci
|
|
npx playwright install --with-deps chromium
|
|
|
|
- name: End-to-end tests
|
|
# The real static pages against a stubbed API: see tests/e2e/README.md.
|
|
working-directory: tests/e2e
|
|
run: npm test
|
|
|
|
- name: Keep traces of failures
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: playwright-traces
|
|
path: tests/e2e/test-results/
|
|
if-no-files-found: ignore
|