chore: harden production readiness gates and runbooks
This commit is contained in:
@@ -3,7 +3,7 @@ run-name: ${{ gitea.actor }} Build Application
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
FrontendChecks:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
@@ -14,29 +14,74 @@ jobs:
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
- name: Install dependencies and build frontend
|
||||
- name: Install portal dependencies
|
||||
run: |
|
||||
cd frontend
|
||||
npm config set registry https://npm.hub.ipao.vip
|
||||
npm install
|
||||
npm run build
|
||||
cd frontend/portal
|
||||
npm ci
|
||||
|
||||
- name: Portal lint (check only)
|
||||
run: npm -C frontend/portal run lint
|
||||
|
||||
- name: Portal build
|
||||
run: npm -C frontend/portal run build
|
||||
|
||||
- name: Install superadmin dependencies
|
||||
run: |
|
||||
cd frontend/superadmin
|
||||
npm ci
|
||||
|
||||
- name: Superadmin lint (check only)
|
||||
run: npm -C frontend/superadmin run lint
|
||||
|
||||
- name: Superadmin build
|
||||
run: npm -C frontend/superadmin run build
|
||||
|
||||
BackendChecks:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: "1.22"
|
||||
|
||||
- name: Configure Go proxy
|
||||
run: |
|
||||
go env -w GOPROXY=https://go.hub.ipao.vip,direct
|
||||
go env -w GONOPROXY='git.ipao.vip'
|
||||
go env -w GONOSUMDB='git.ipao.vip'
|
||||
|
||||
- name: Run backend tests
|
||||
run: |
|
||||
cd backend
|
||||
go test ./...
|
||||
|
||||
- name: Build Go application
|
||||
run: |
|
||||
cd backend
|
||||
mkdir -p build
|
||||
go env -w GOPROXY=https://go.hub.ipao.vip,direct
|
||||
go env -w GONOPROXY='git.ipao.vip'
|
||||
go env -w GONOSUMDB='git.ipao.vip'
|
||||
go mod tidy
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/app .
|
||||
|
||||
- name: API smoke (health/readiness)
|
||||
run: |
|
||||
cd backend
|
||||
timeout 45s go run . serve > /tmp/quyun_backend.log 2>&1 &
|
||||
APP_PID=$!
|
||||
sleep 15
|
||||
curl -f -sS http://127.0.0.1:18080/healthz > /tmp/healthz.out
|
||||
curl -f -sS http://127.0.0.1:18080/readyz > /tmp/readyz.out
|
||||
kill ${APP_PID}
|
||||
|
||||
DockerImage:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [FrontendChecks, BackendChecks]
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build final Docker image
|
||||
run: |
|
||||
docker login -u ${{ secrets.DOCKER_AF_USERNAME }} -p ${{ secrets.DOCKER_AF_PASSWORD }} docker-af.hub.ipao.vip
|
||||
docker build --push -t docker-af.hub.ipao.vip/rogeecn/test:latest .
|
||||
docker build --push -t docker-af.hub.ipao.vip/rogeecn/test:latest .
|
||||
|
||||
Reference in New Issue
Block a user