mirror of
https://github.com/truewhile/MeBox.git
synced 2026-09-28 11:16:37 +08:00
85 lines
2.0 KiB
YAML
85 lines
2.0 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
backend:
|
|
name: Backend (Go)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.25'
|
|
cache: true
|
|
|
|
# The binary embeds the SPA (web/dist) via go:embed, so the dist must exist
|
|
# before the Go toolchain touches the `web` package.
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
cache-dependency-path: web/package-lock.json
|
|
- name: Build SPA
|
|
working-directory: web
|
|
run: |
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: go vet
|
|
run: go vet ./...
|
|
|
|
- name: go build
|
|
run: go build ./...
|
|
|
|
- name: go test
|
|
run: go test ./...
|
|
|
|
frontend:
|
|
name: Frontend (Node)
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: web
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
cache-dependency-path: web/package-lock.json
|
|
|
|
- name: Install
|
|
run: npm ci
|
|
|
|
- name: Type-check & build
|
|
run: npm run build
|
|
|
|
smoke:
|
|
name: Deployment smoke test
|
|
runs-on: ubuntu-latest
|
|
needs: [backend, frontend]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Validate single-image compose
|
|
run: docker compose -f docker-compose.simple.yml config --quiet
|
|
- name: Validate tier 1 compose
|
|
run: docker compose -f docker-compose.yml config --quiet
|
|
- name: Validate tier 2 compose
|
|
run: docker compose -f docker-compose.standard.yml config --quiet
|
|
- name: Validate tier 3 compose
|
|
run: docker compose -f docker-compose.search.yml config --quiet
|
|
ci-success:
|
|
name: CI Success
|
|
runs-on: ubuntu-latest
|
|
needs: [backend, frontend, smoke]
|
|
if: success()
|
|
steps:
|
|
- run: echo "CI passed, ready for release"
|