All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 4s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 7s
Test / e2e-test (push) Successful in 51s
68 lines
1.9 KiB
YAML
68 lines
1.9 KiB
YAML
name: Test
|
|
on: [push]
|
|
|
|
jobs:
|
|
unit-test:
|
|
runs-on: test
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install & Run unit tests
|
|
run: cd frontend && npm ci && npx vitest run --reporter=verbose
|
|
|
|
e2e-test:
|
|
runs-on: test
|
|
needs: unit-test
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install frontend deps
|
|
run: cd frontend && npm ci
|
|
|
|
- name: Install backend deps
|
|
run: python3 -m venv /tmp/ci-venv && /tmp/ci-venv/bin/pip install -q -r backend/requirements.txt
|
|
|
|
- name: E2E tests
|
|
run: |
|
|
# Start backend
|
|
DB_PATH=/tmp/ci_oil_test.db FRONTEND_DIR=/dev/null \
|
|
/tmp/ci-venv/bin/uvicorn backend.main:app --port 8000 &
|
|
|
|
# Start frontend (in subshell to not change cwd)
|
|
(cd frontend && npx vite --port 5173) &
|
|
|
|
# Wait for both servers
|
|
for i in $(seq 1 30); do
|
|
if curl -sf http://localhost:8000/api/version > /dev/null 2>&1 && \
|
|
curl -sf http://localhost:5173/ > /dev/null 2>&1; then
|
|
echo "Both servers ready"
|
|
break
|
|
fi
|
|
sleep 1
|
|
done
|
|
|
|
# Run core cypress specs (proven stable)
|
|
cd frontend
|
|
npx cypress run --spec "\
|
|
cypress/e2e/recipe-detail.cy.js,\
|
|
cypress/e2e/oil-reference.cy.js,\
|
|
cypress/e2e/oil-data-integrity.cy.js,\
|
|
cypress/e2e/recipe-cost-parity.cy.js,\
|
|
cypress/e2e/category-modules.cy.js,\
|
|
cypress/e2e/notification-flow.cy.js,\
|
|
cypress/e2e/registration-flow.cy.js\
|
|
" --config video=false
|
|
EXIT_CODE=$?
|
|
|
|
# Cleanup
|
|
pkill -f "uvicorn backend" || true
|
|
pkill -f "node.*vite" || true
|
|
rm -f /tmp/ci_oil_test.db
|
|
exit $EXIT_CODE
|
|
|
|
build-check:
|
|
runs-on: test
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Build frontend
|
|
run: cd frontend && npm ci && npm run build
|