Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Failing after 15s
Test / e2e-test (push) Has been skipped
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 9s
- test.yml: unit + e2e + build on 'test' runner (hera) - Vitest results + Cypress videos/screenshots as artifacts - Auto starts/stops backend + frontend for E2E - preview.yml: test on hera → deploy on oci (sequential) - deploy.yml: test on hera → deploy-prod on oci Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
83 lines
2.3 KiB
YAML
83 lines
2.3 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 --reporter=json --outputFile=test-results/vitest.json 2>&1 | tee test-results/vitest.log
|
|
shell: bash
|
|
|
|
- name: Upload unit test results
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: unit-test-results
|
|
path: frontend/test-results/
|
|
retention-days: 14
|
|
|
|
e2e-test:
|
|
runs-on: test
|
|
needs: unit-test
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install frontend dependencies
|
|
run: cd frontend && npm ci
|
|
|
|
- name: Install backend dependencies
|
|
run: python3 -m venv .venv && . .venv/bin/activate && pip install -q -r backend/requirements.txt
|
|
|
|
- name: Start backend
|
|
run: |
|
|
. .venv/bin/activate
|
|
DB_PATH=/tmp/ci_oil_test_$$.db FRONTEND_DIR=/dev/null \
|
|
nohup uvicorn backend.main:app --port 8000 > /tmp/backend.log 2>&1 &
|
|
sleep 3
|
|
curl -sf http://localhost:8000/api/version
|
|
|
|
- name: Start frontend
|
|
run: |
|
|
cd frontend && nohup npx vite --port 5173 > /tmp/frontend.log 2>&1 &
|
|
sleep 3
|
|
curl -sf -o /dev/null http://localhost:5173/
|
|
|
|
- name: Run E2E tests
|
|
run: |
|
|
cd frontend
|
|
npx cypress run \
|
|
--spec "$(ls cypress/e2e/*.cy.js | grep -v demo | grep -v visual | grep -v check | tr '\n' ',')" \
|
|
--config video=true,screenshotOnRunFailure=true \
|
|
2>&1 | tee cypress/test-results.log
|
|
|
|
- name: Upload E2E results
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: e2e-test-results
|
|
path: |
|
|
frontend/cypress/videos/
|
|
frontend/cypress/screenshots/
|
|
frontend/cypress/test-results.log
|
|
retention-days: 14
|
|
|
|
- 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
|