Split CI: tests on hera, deploy on oci
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>
This commit is contained in:
2026-04-06 21:22:51 +00:00
parent b515cf162b
commit 22b60c1716
3 changed files with 91 additions and 18 deletions

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