name: Build Application run-name: ${{ gitea.actor }} Build Application on: [push] jobs: FrontendChecks: runs-on: ubuntu-latest steps: - name: Check out repository code uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v3 with: node-version: "20" - name: Install portal dependencies run: | 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 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 .