From ba3a11f415e15c455a2b9f75efbcc31e904b9692 Mon Sep 17 00:00:00 2001 From: seakee Date: Mon, 11 May 2026 09:24:53 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20ci(actions):=20add=20PR=20valida?= =?UTF-8?q?tion=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add pull_request and main push checks for frontend type checks, linting, and production builds. Run Usage Service Go tests and a non-pushing Docker image build to catch integration failures before merge. Keep release publishing unchanged and avoid requiring DockerHub secrets for PR checks. --- .github/workflows/pr-check.yml | 86 ++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/pr-check.yml diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml new file mode 100644 index 000000000..1355c087d --- /dev/null +++ b/.github/workflows/pr-check.yml @@ -0,0 +1,86 @@ +name: PR Check + +on: + pull_request: + branches: + - main + push: + branches: + - main + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + frontend: + name: Frontend + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '24' + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Type check + run: npm run type-check + + - name: Lint + run: npm run lint + + - name: Build + run: npm run build + env: + VERSION: ci + + usage-service: + name: Usage Service + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: '1.24.x' + cache-dependency-path: usage-service/go.sum + + - name: Test + working-directory: usage-service + run: go test ./... + + docker-build: + name: Docker Build + runs-on: ubuntu-latest + needs: + - frontend + - usage-service + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Usage Service image + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile.usage-service + push: false + build-args: | + VERSION=ci