Files
codewhale/.github/workflows/ci.yml
T
HUQIANTAO 72e8ca45de feat: add mobile smoke tests and QR code for mobile URL (#2403)
* feat: add mobile smoke tests and QR code for mobile URL

#2396: Add scripts/mobile-smoke.sh that launches the compiled binary on
loopback ports and verifies the mobile surface through real HTTP requests:
- Token auth (401/200, Bearer, query param, approval 404)
- Insecure mode (no token required)
- Binding warnings (0.0.0.0, LAN URL hint)

Add mobile-smoke job to CI workflow.

#2397: Add --qr flag to 'codewhale serve --mobile' that renders a
terminal QR code for the mobile URL. Uses the LAN IP when available,
falls back to 127.0.0.1. Adds qrcode crate (pure Rust, no C deps).

* fix: address review feedback on mobile smoke tests

- Fix Test Group 3 subprocess capture: use temp file instead of command
  substitution to avoid hanging and subshell variable isolation
- Allow BINARY path to be overridden via BINARY env var
- Add libdbus-1-dev system dependency to CI job for ubuntu build

* fix: pass auth header in mobile smoke status helper

* fix: send approval JSON in mobile smoke

---------

Co-authored-by: Hu Qiantao <huqiantao@HudeMacBook-Air.local>
Co-authored-by: Hunter B <hmbown@gmail.com>
2026-05-31 02:04:32 -07:00

151 lines
4.5 KiB
YAML

name: CI
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
schedule:
- cron: '31 6 * * 1'
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
jobs:
versions:
name: Version drift
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Check version drift
run: ./scripts/release/check-versions.sh
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check
- name: Check provider registry drift
run: python3 scripts/check-provider-registry.py
- name: Linux clippy location
run: echo "Linux clippy/test gates run on CNB for mirrored fix/*, rebrand/*, work/v*, and main branches."
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Linux workspace tests moved to CNB; GitHub keeps the platform
# coverage CNB cannot provide.
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
if: runner.os != 'Linux'
- uses: dtolnay/rust-toolchain@stable
if: runner.os != 'Linux'
- uses: Swatinem/rust-cache@v2
if: runner.os != 'Linux'
with:
cache-bin: false
- name: Run tests
if: runner.os != 'Linux'
run: cargo test --workspace --all-features --locked
- name: Lockfile drift guard
if: runner.os != 'Linux'
run: git diff --exit-code -- Cargo.lock
- name: Run Offline Eval Harness
if: runner.os != 'Linux'
run: cargo run -p codewhale-tui --all-features -- eval
- name: Linux test location
if: runner.os == 'Linux'
run: echo "Linux workspace tests run on CNB for mirrored first-party branches."
npm-wrapper-smoke:
name: npm wrapper smoke
if: github.event_name != 'schedule'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ${{ fromJSON(github.event_name == 'pull_request' && '["ubuntu-latest"]' || '["ubuntu-latest","macos-latest","windows-latest"]') }}
steps:
- uses: actions/checkout@v4
if: runner.os != 'Linux'
- uses: dtolnay/rust-toolchain@stable
if: runner.os != 'Linux'
- uses: actions/setup-node@v4
if: runner.os != 'Linux'
with:
node-version: 20
- uses: Swatinem/rust-cache@v2
if: runner.os != 'Linux'
with:
cache-bin: false
- name: Build wrapper binaries
if: runner.os != 'Linux'
run: cargo build --release --locked -p codewhale-cli -p codewhale-tui
- name: Smoke wrapper install and delegated entrypoints
if: runner.os != 'Linux'
run: node scripts/release/npm-wrapper-smoke.js
- name: Linux smoke location
if: runner.os == 'Linux'
run: echo "Linux npm wrapper smoke runs on CNB for mirrored first-party branches."
mobile-smoke:
name: Mobile runtime smoke
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install Linux system dependencies
run: |
for i in 1 2 3 4 5; do
sudo apt-get update && break
echo "apt-get update failed (attempt $i); retrying in 15s"
sleep 15
done
sudo apt-get install -y libdbus-1-dev pkg-config
- uses: Swatinem/rust-cache@v2
with:
cache-bin: false
- name: Run mobile smoke tests
run: ./scripts/mobile-smoke.sh
# Check documentation builds without warnings
docs:
name: Documentation
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install Linux system dependencies
if: runner.os == 'Linux'
run: |
for i in 1 2 3 4 5; do
sudo apt-get update && break
echo "apt-get update failed (attempt $i); retrying in 15s"
sleep 15
done
sudo apt-get install -y libdbus-1-dev pkg-config
- uses: Swatinem/rust-cache@v2
with:
cache-bin: false
- name: Build docs
run: cargo doc --workspace --no-deps
env:
RUSTDOCFLAGS: -Dwarnings