c6760a39a1
Replace Alpine-style commands (apk, py3-pip, musl-dev) and incorrect apt usage with proper apt-get invocations and Debian package names for the ubuntu-latest runner.
68 lines
1.7 KiB
YAML
68 lines
1.7 KiB
YAML
name: Test and Lint
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Install system dependencies
|
|
shell: sh
|
|
run: |
|
|
apt-get update && apt-get install -y git python3 python3-pip gcc libpq-dev python3-dev
|
|
|
|
- name: Checkout code
|
|
shell: sh
|
|
run: |
|
|
git clone http://gitea.gitea.svc.cluster.local/${{ gitea.repository }}.git .
|
|
git checkout ${{ gitea.sha }}
|
|
|
|
- name: Install Python dependencies
|
|
shell: sh
|
|
run: |
|
|
pip3 install --break-system-packages -r requirements.txt ruff
|
|
|
|
- name: Run ruff linter
|
|
shell: sh
|
|
run: |
|
|
ruff check SPARC/ tests/
|
|
|
|
- name: Install Node.js and frontend dependencies
|
|
shell: sh
|
|
run: |
|
|
apt-get install -y nodejs npm
|
|
cd frontend && npm ci
|
|
|
|
- name: Verify generated API types are up to date
|
|
shell: sh
|
|
run: |
|
|
cd frontend && npm run generate:local
|
|
if ! git diff --quiet src/api/schema.d.ts; then
|
|
echo "ERROR: src/api/schema.d.ts is out of date. Run 'npm run generate:local' and commit the result."
|
|
git diff src/api/schema.d.ts
|
|
exit 1
|
|
fi
|
|
|
|
- name: Run TypeScript type check
|
|
shell: sh
|
|
run: |
|
|
cd frontend && npx tsc --noEmit
|
|
|
|
- name: Run pytest
|
|
shell: sh
|
|
env:
|
|
DATABASE_URL: "sqlite://"
|
|
API_KEY: "test-key"
|
|
OPENROUTER_API_KEY: "test-key"
|
|
JWT_SECRET: "test-secret-for-ci"
|
|
APP_ENV: "development"
|
|
run: |
|
|
python3 -m pytest tests/ -v --tb=short -x
|