Skip to content

feat: worktree UX, PR status badges, reliable restart, model-spawn fix #279

feat: worktree UX, PR status badges, reliable restart, model-spawn fix

feat: worktree UX, PR status badges, reliable restart, model-spawn fix #279

Workflow file for this run

name: Automated Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
# Cancel previous run when new commits are pushed
concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-test:
name: Build & Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build shared package
run: npm run build -w shared
- name: Build backend
run: npm run build -w backend
- name: Build frontend
run: npm run build -w frontend
- name: Build Electron
run: npm run build:electron
- name: Validate shell scripts (Linux)
if: runner.os == 'Linux'
run: |
echo "Syntax checking bash scripts..."
bash -n start.sh
bash -n install.sh
echo "Running shellcheck..."
shellcheck start.sh install.sh || true
echo "Testing install.sh prerequisite checks..."
# Run install.sh but expect it to fail at npm install -g (prereq checks should pass)
bash -c 'source <(sed "/npm install -g/d" install.sh)' || true
echo "Testing start.sh dependency checks..."
# Extract and run just the dependency check function from start.sh
bash -c '
check_deps() {
local missing=0
if ! command -v node &>/dev/null; then
echo "Node.js is not installed."
missing=1
fi
if ! command -v npm &>/dev/null; then
echo "npm is not installed."
missing=1
fi
if [ $missing -eq 1 ]; then
exit 1
fi
echo "Dependency checks passed"
}
check_deps
'
- name: Validate PowerShell scripts (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Write-Host "Parsing PowerShell scripts..."
$scripts = @("install.ps1", "start-electron.ps1")
foreach ($script in $scripts) {
Write-Host " Checking $script..."
$null = [System.Management.Automation.PSParser]::Tokenize((Get-Content $script -Raw), [ref]$null)
$errors = $null
$null = [System.Management.Automation.Language.Parser]::ParseFile(
(Resolve-Path $script),
[ref]$null,
[ref]$errors
)
if ($errors.Count -gt 0) {
Write-Host "Parse errors in ${script}:"
$errors | ForEach-Object { Write-Host " $_" }
exit 1
}
Write-Host " OK"
}
Write-Host "All PowerShell scripts are valid"
- name: Run backend unit tests
run: npm test -w backend
- name: Run frontend unit tests
run: npm test -w frontend