Files
oil-formula-calculator/.gitea/workflows/test.yml
Hera Zhao 4fbd18c952
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Failing after 20s
Fix Cypress: disable allowCypressEnv, hardcode test token, fix CI server wait
- cypress.config.js: set allowCypressEnv: false
- Replace Cypress.env('ADMIN_TOKEN') with hardcoded test DB token
- CI: use fixed venv path, retry loop for server readiness

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 22:11:21 +00:00

63 lines
1.7 KiB
YAML

name: Test
on: [push]
jobs:
unit-test:
runs-on: test
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: cd frontend && npm ci
- name: Run unit tests
run: cd frontend && npx vitest run --reporter=verbose
e2e-test:
runs-on: test
needs: unit-test
steps:
- uses: actions/checkout@v4
- name: Install frontend
run: cd frontend && npm ci
- name: Install backend
run: python3 -m venv /tmp/ci-venv && /tmp/ci-venv/bin/pip install -q -r backend/requirements.txt
- name: Start servers
run: |
/tmp/ci-venv/bin/uvicorn backend.main:app --port 8000 &
cd frontend && npx vite --port 5173 &
# Wait for both servers
for i in $(seq 1 30); do
curl -sf http://localhost:8000/api/version > /dev/null 2>&1 && \
curl -sf http://localhost:5173/ > /dev/null 2>&1 && break
sleep 1
done
curl -sf http://localhost:8000/api/version
curl -sf -o /dev/null http://localhost:5173/
env:
DB_PATH: /tmp/ci_oil_test.db
FRONTEND_DIR: /dev/null
- name: Run E2E tests
run: |
cd frontend
SPECS=$(ls cypress/e2e/*.cy.js | grep -v demo | grep -v visual | grep -v check | tr '\n' ',')
npx cypress run --spec "$SPECS" --config video=false
- name: Cleanup
if: always()
run: |
pkill -f "uvicorn backend" || true
pkill -f "node.*vite" || true
rm -f /tmp/ci_oil_test.db
build-check:
runs-on: test
steps:
- uses: actions/checkout@v4
- name: Build frontend
run: cd frontend && npm ci && npm run build