Initial template: Vue 3 + FastAPI + SQLite full-stack with K8s deployment
Extracted from oil project — business logic removed, auth/db/deploy infrastructure generalized with APP_NAME placeholders. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
22
.gitea/workflows/deploy.yml
Normal file
22
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
name: Deploy Production
|
||||
on:
|
||||
push:
|
||||
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: Deploy Production
|
||||
run: python3 scripts/deploy-preview.py deploy-prod
|
||||
50
.gitea/workflows/preview.yml
Normal file
50
.gitea/workflows/preview.yml
Normal file
@@ -0,0 +1,50 @@
|
||||
name: PR Preview
|
||||
on:
|
||||
pull_request:
|
||||
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: Deploy Preview
|
||||
run: python3 scripts/deploy-preview.py deploy ${{ github.event.pull_request.number }}
|
||||
- name: Comment PR
|
||||
env:
|
||||
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
|
||||
run: |
|
||||
PR_ID="${{ github.event.pull_request.number }}"
|
||||
curl -sf -X POST \
|
||||
"https://git.euphon.cloud/api/v1/repos/${{ github.repository }}/issues/${PR_ID}/comments" \
|
||||
-H "Authorization: token ${GIT_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"body\": \"Preview: https://pr-${PR_ID}.APP_NAME.oci.euphon.net\n\nDB is a copy of production.\"}" || true
|
||||
|
||||
teardown-preview:
|
||||
if: github.event.action == 'closed'
|
||||
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 }}
|
||||
run: |
|
||||
PR_ID="${{ github.event.pull_request.number }}"
|
||||
curl -sf -X POST \
|
||||
"https://git.euphon.cloud/api/v1/repos/${{ github.repository }}/issues/${PR_ID}/comments" \
|
||||
-H "Authorization: token ${GIT_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"body\": \"Preview torn down.\"}" || true
|
||||
57
.gitea/workflows/test.yml
Normal file
57
.gitea/workflows/test.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
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
|
||||
|
||||
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_app_${{ 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/health
|
||||
curl -sf -o /dev/null http://localhost:5173/
|
||||
|
||||
- name: Run E2E tests
|
||||
run: |
|
||||
cd frontend
|
||||
npx cypress run --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_app_${{ 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
|
||||
Reference in New Issue
Block a user