Skip to content

chore: clean harness paths + watcher scope #20

chore: clean harness paths + watcher scope

chore: clean harness paths + watcher scope #20

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- main
jobs:
changes:
name: detect integration-impacting changes
runs-on: ubuntu-latest
outputs:
integration: ${{ steps.filter.outputs.integration }}
rust: ${{ steps.filter.outputs.rust }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect changed paths
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
integration:
- "runtime/**"
- "src-tauri/src/**"
- "src/lib/components/layout/**"
- "src/lib/services/runtimeService.ts"
- "src/lib/stores/runtimeDebugStore.ts"
- "src/lib/stores/taskStore.ts"
- "src/lib/__tests__/integration/**"
- "scripts/testing/run-regressions.sh"
- "scripts/testing/run-regressions-if-needed.sh"
- "mise-tasks/runtime-build*"
rust:
- ".cargo/**"
- "src-tauri/**"
- "mise.toml"
check:
name: check (fast)
runs-on: macos-14
timeout-minutes: 30
needs: changes
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: |
src-tauri -> target
- name: Setup mise
uses: jdx/mise-action@v2
- name: Install sccache
run: brew install sccache
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run fast gate
env:
CARGO_INCREMENTAL: "0"
CARGO_PROFILE_DEV_DEBUG: "0"
CARGO_PROFILE_TEST_DEBUG: "0"
run: |
set -euo pipefail
if [[ "${{ needs.changes.outputs.rust }}" == "true" ]]; then
echo "Rust-impacting changes detected -> running full CI fast gate"
mise run check-ci
else
echo "No Rust-impacting changes detected -> skipping clippy + Rust tests"
mise run format-check
pnpm exec oxlint --tsconfig tsconfig.json src
mise run compile
mise run test-vite
fi
- name: Verify checkout is clean
run: git diff --exit-code
- name: Show sccache stats
if: always()
run: sccache --show-stats || true
check-full:
name: check-full (live regressions)
runs-on: macos-14
timeout-minutes: 75
needs: [check, changes]
if: needs.changes.outputs.integration == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: |
src-tauri -> target
- name: Setup mise
uses: jdx/mise-action@v2
- name: Install runtime deps
run: brew install qemu sccache
- name: Install pi CLI for runtime build
run: npm install -g @mariozechner/pi-coding-agent
- name: Resolve pi CLI version
id: pi-version
run: |
set -euo pipefail
PI_VERSION=$(npm list -g @mariozechner/pi-coding-agent --depth=0 --json \
| node -e 'const fs = require("node:fs"); const data = JSON.parse(fs.readFileSync(0, "utf8")); process.stdout.write(data.dependencies?.["@mariozechner/pi-coding-agent"]?.version ?? "unknown");')
echo "version=$PI_VERSION" >> "$GITHUB_OUTPUT"
echo "pi_version=$PI_VERSION"
- name: Restore runtime pack cache
id: runtime-pack-cache
uses: actions/cache/restore@v4
with:
path: "~/Library/Application Support/com.pi.work/runtime"
key: runtime-pack-${{ runner.os }}-${{ runner.arch }}-pi-${{ steps.pi-version.outputs.version }}-${{ hashFiles('mise-tasks/runtime-build', 'runtime/init.sh', 'runtime/taskd.js') }}
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Seed CI auth profile for regressions
run: |
set -euo pipefail
AUTH_FILE="$HOME/Library/Application Support/com.pi.work/auth/default/auth.json"
if [[ -f "$AUTH_FILE" ]]; then
echo "auth profile already present at $AUTH_FILE"
exit 0
fi
mkdir -p "$(dirname "$AUTH_FILE")"
cat > "$AUTH_FILE" <<'JSON'
{
"anthropic": {
"type": "api_key",
"key": "piwork-regression-placeholder"
}
}
JSON
echo "seeded CI auth stub at $AUTH_FILE"
- name: Run full live regression gate
env:
PIWORK_QEMU_ACCEL: tcg
PIWORK_RUNTIME_CACHE_HIT: ${{ steps.runtime-pack-cache.outputs.cache-hit }}
CARGO_INCREMENTAL: "0"
CARGO_PROFILE_DEV_DEBUG: "0"
CARGO_PROFILE_TEST_DEBUG: "0"
run: mise run test-regressions
- name: Verify checkout is clean
run: git diff --exit-code
- name: Show sccache stats
if: always()
run: sccache --show-stats || true
- name: Check runtime pack cache save eligibility
if: always()
id: runtime-pack-cache-ready
run: |
set -euo pipefail
RUNTIME_DIR="$HOME/Library/Application Support/com.pi.work/runtime"
if [[ -f "$RUNTIME_DIR/manifest.json" ]] \
&& [[ -f "$RUNTIME_DIR/vmlinuz-virt" ]] \
&& [[ -f "$RUNTIME_DIR/initramfs-virt-fast" ]]; then
echo "ready=true" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "ready=false" >> "$GITHUB_OUTPUT"
- name: Save runtime pack cache
if: always() && steps.runtime-pack-cache.outputs.cache-hit != 'true' && steps.runtime-pack-cache-ready.outputs.ready == 'true'
uses: actions/cache/save@v4
with:
path: "~/Library/Application Support/com.pi.work/runtime"
key: runtime-pack-${{ runner.os }}-${{ runner.arch }}-pi-${{ steps.pi-version.outputs.version }}-${{ hashFiles('mise-tasks/runtime-build', 'runtime/init.sh', 'runtime/taskd.js') }}
- name: Collect integration diagnostics on failure
if: failure()
run: |
set -euo pipefail
DEST="tmp/dev/ci-diagnostics"
mkdir -p "$DEST"
cp -f tmp/dev/piwork.integration.log "$DEST/" 2>/dev/null || true
cp -f tmp/dev/piwork.log "$DEST/" 2>/dev/null || true
MAC_VM_DIR="$HOME/Library/Application Support/com.pi.work/vm"
LINUX_VM_DIR="$HOME/.local/share/com.pi.work/vm"
if [ -d "$MAC_VM_DIR" ]; then
mkdir -p "$DEST/vm-macos"
cp -R "$MAC_VM_DIR/." "$DEST/vm-macos/" || true
fi
if [ -d "$LINUX_VM_DIR" ]; then
mkdir -p "$DEST/vm-linux"
cp -R "$LINUX_VM_DIR/." "$DEST/vm-linux/" || true
fi
{
echo "=== Environment ==="
uname -a || true
echo
echo "HOME=$HOME"
echo
echo "=== Dest tree ==="
find "$DEST" -maxdepth 4 -print || true
} > "$DEST/diagnostics.txt"
- name: Upload integration diagnostics on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: integration-diagnostics
path: tmp/dev/ci-diagnostics
if-no-files-found: ignore