dev #2

Merged
hera merged 40 commits from dev into main 2026-04-07 22:12:01 +00:00
3 changed files with 91 additions and 18 deletions
Showing only changes of commit 22b60c1716 - Show all commits

View File

@@ -4,13 +4,19 @@ on:
branches: [main]
jobs:
test:
runs-on: test
steps:
- uses: actions/checkout@v4
- name: Unit tests
run: cd frontend && npm ci && npx vitest run
- name: Build check
run: cd frontend && npm run build
deploy:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Unit tests
run: cd frontend && npm ci && npm run test:unit
- name: Deploy
- name: Deploy Production
run: python3 scripts/deploy-preview.py deploy-prod

View File

@@ -4,18 +4,22 @@ on:
types: [opened, synchronize, reopened, closed]
jobs:
test:
if: github.event.action != 'closed'
runs-on: test
steps:
- uses: actions/checkout@v4
- name: Unit tests
run: cd frontend && npm ci && npx vitest run
deploy-preview:
if: github.event.action != 'closed'
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Unit tests
run: cd frontend && npm ci && npm run test:unit
- name: Deploy Preview
run: python3 scripts/deploy-preview.py deploy ${{ github.event.pull_request.number }}
- name: Comment PR
env:
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
@@ -32,10 +36,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Teardown
run: python3 scripts/deploy-preview.py teardown ${{ github.event.pull_request.number }}
- name: Comment PR
env:
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}

View File

@@ -2,16 +2,81 @@ name: Test
on: [push]
jobs:
test:
runs-on: ubuntu-latest
unit-test:
runs-on: test
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: cd frontend && npm ci
- name: Unit tests
run: cd frontend && npm run test:unit
- 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: Build check
run: cd frontend && npm run build
- 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