blob: a3e5a5fb5d0f1d3690027ec4998307fa7e728f76 [file]
name: Terminal
on:
push:
branches: [main, "tui/**"]
paths:
- "crates/**"
- "examples/terminal-workbench/**"
- "tests/compat/cases/layout/fonts/**"
- "third-party/icy_sixel/**"
- "Cargo.toml"
- "Cargo.lock"
- ".cargo/**"
- "rust-toolchain.toml"
- ".github/workflows/tui.yml"
pull_request:
paths:
- "crates/**"
- "examples/terminal-workbench/**"
- "tests/compat/cases/layout/fonts/**"
- "third-party/icy_sixel/**"
- "Cargo.toml"
- "Cargo.lock"
- ".cargo/**"
- "rust-toolchain.toml"
- ".github/workflows/tui.yml"
merge_group:
types: [checks_requested]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: tui-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-15, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
env:
NSH_EXE_SUFFIX: ${{ matrix.os == 'windows-latest' && '.exe' || '' }}
steps:
- uses: actions/checkout@v4
# QuickJS and its generated bindings need a C compiler and libclang.
# The terminal crates build independently of the GUI toolkits.
- name: Install clang
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y clang libclang-dev
- name: Configure Windows compiler
if: runner.os == 'Windows'
run: |
echo 'LIBCLANG_PATH=C:\Program Files\LLVM\bin' >> "$GITHUB_ENV"
echo 'RUST_MIN_STACK=268435456' >> "$GITHUB_ENV"
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-tui-${{ hashFiles('Cargo.lock', 'rust-toolchain.toml') }}
restore-keys: |
${{ runner.os }}-tui-
- name: Clippy
run: cargo clippy --locked --all-targets -p nsh-platform-tui -p nsh-tui-host -p nsh-tui-app -- -D warnings
- name: Test
run: cargo test --locked -p nsh-platform-tui -p nsh-tui-host -p nsh-tui-app
- name: Check the Rust runtime
run: cargo check --locked -p nsh-platform-tui --no-default-features
- name: Build the operations workbench
run: |
cargo build --locked -p nsh-cli -p nsh-tui-host
./target/debug/nsh${NSH_EXE_SUFFIX} build examples/terminal-workbench -o target/terminal-workbench
- name: Exercise Unicode, filters, deployment and resize
run: |
./target/debug/nsh-tui-host${NSH_EXE_SUFFIX} --bundle target/terminal-workbench/bundle.nshc --size 160x50 \
--script "wait 300; expect Operations workbench; expect-focus; shot target/terminal-workbench-home.txt; type 王宁; expect 12 services; key Ctrl+a; type gateway; expect 2 services; key Tab; key Tab; key Tab; key Enter; expect No matching services; key Shift+Tab; key Shift+Tab; key Enter; expect 2 services; tap 40 13; expect Selected: edge-gateway; tap 148 1; expect Deploy service; key Ctrl+a; type Canary · 安全发布 👩‍💻; key Tab; key Tab; key Enter; expect Deployment queued; wait 300; expect v2.19.0; shot target/terminal-workbench-deployed.txt; tap 8 9; expect Active incidents; tap 8 11; expect Release history; resize 120 34; expect Release history; expect Traffic overview; resize 100 30; expect Release history; expect-focus; shot target/terminal-workbench-compact.txt; quit"
- name: Exercise effects, popup menus and the HTML runbook
run: |
./target/debug/nsh-tui-host${NSH_EXE_SUFFIX} --bundle target/terminal-workbench/bundle.nshc --size 160x50 \
--script "wait 700; tap 142 5; wait 800; expect Surface effects; expect Canvas lettering; shot target/terminal-workbench-effects.txt; tap 151 6; expect Soft focus; key Enter; wait 500; expect Soft focus / 3pt; tap 153 5; wait 1000; expect Rollout checklist; expect Runbook ready; shot target/terminal-workbench-runbook.txt; tap 153 6; wait 500; expect Runbook ready; tap 132 5; expect Activity timeline; quit"
- name: Upload terminal snapshots
if: always()
uses: actions/upload-artifact@v4
with:
name: terminal-snapshots-${{ runner.os }}
path: target/terminal-workbench-*.txt
if-no-files-found: ignore