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
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:
@@ -4,13 +4,19 @@ on:
|
|||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
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:
|
deploy:
|
||||||
|
needs: test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- name: Deploy Production
|
||||||
- name: Unit tests
|
|
||||||
run: cd frontend && npm ci && npm run test:unit
|
|
||||||
|
|
||||||
- name: Deploy
|
|
||||||
run: python3 scripts/deploy-preview.py deploy-prod
|
run: python3 scripts/deploy-preview.py deploy-prod
|
||||||
|
|||||||
@@ -4,18 +4,22 @@ on:
|
|||||||
types: [opened, synchronize, reopened, closed]
|
types: [opened, synchronize, reopened, closed]
|
||||||
|
|
||||||
jobs:
|
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:
|
deploy-preview:
|
||||||
if: github.event.action != 'closed'
|
if: github.event.action != 'closed'
|
||||||
|
needs: test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Unit tests
|
|
||||||
run: cd frontend && npm ci && npm run test:unit
|
|
||||||
|
|
||||||
- name: Deploy Preview
|
- name: Deploy Preview
|
||||||
run: python3 scripts/deploy-preview.py deploy ${{ github.event.pull_request.number }}
|
run: python3 scripts/deploy-preview.py deploy ${{ github.event.pull_request.number }}
|
||||||
|
|
||||||
- name: Comment PR
|
- name: Comment PR
|
||||||
env:
|
env:
|
||||||
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
|
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
|
||||||
@@ -32,10 +36,8 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Teardown
|
- name: Teardown
|
||||||
run: python3 scripts/deploy-preview.py teardown ${{ github.event.pull_request.number }}
|
run: python3 scripts/deploy-preview.py teardown ${{ github.event.pull_request.number }}
|
||||||
|
|
||||||
- name: Comment PR
|
- name: Comment PR
|
||||||
env:
|
env:
|
||||||
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
|
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
|
||||||
|
|||||||
@@ -2,16 +2,81 @@ name: Test
|
|||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
unit-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: test
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: cd frontend && npm ci
|
run: cd frontend && npm ci
|
||||||
|
|
||||||
- name: Unit tests
|
- name: Run unit tests
|
||||||
run: cd frontend && npm run test:unit
|
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
|
- name: Upload unit test results
|
||||||
run: cd frontend && npm run build
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user