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 5s
Test / e2e-test (push) Has been cancelled
60 lines
1.8 KiB
YAML
60 lines
1.8 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 2>&1 | tee /tmp/vitest-${{ github.sha }}.log
|
|
echo "Results saved to /tmp/vitest-${{ github.sha }}.log"
|
|
|
|
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/activate && pip install -q -r backend/requirements.txt
|
|
|
|
- name: Start servers
|
|
run: |
|
|
. /tmp/ci-venv-*/bin/activate
|
|
DB_PATH=/tmp/ci_oil_${{ github.run_id }}.db FRONTEND_DIR=/dev/null \
|
|
nohup uvicorn backend.main:app --port 8000 > /tmp/backend.log 2>&1 &
|
|
cd frontend && nohup npx vite --port 5173 > /tmp/frontend.log 2>&1 &
|
|
sleep 4
|
|
curl -sf http://localhost:8000/api/version
|
|
curl -sf -o /dev/null http://localhost:5173/
|
|
|
|
- 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 2>&1 | tee /tmp/cypress-${{ github.sha }}.log
|
|
|
|
- name: Cleanup
|
|
if: always()
|
|
run: |
|
|
pkill -f "uvicorn backend" || true
|
|
pkill -f "node.*vite" || true
|
|
rm -f /tmp/ci_oil_${{ github.run_id }}.db
|
|
|
|
build-check:
|
|
runs-on: test
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Build frontend
|
|
run: cd frontend && npm ci && npm run build
|