Skip to content

Commit c930d2d

Browse files
committed
ci: gate pull requests and enforce coverage thresholds
Add a pull_request trigger so branches are checked before merge, run vitest with --coverage in CI so the configured 90/80/89/90 gates fail the job on regression, and require the push event (plus Docker Hub secrets) before QEMU/buildx/publish steps run so PR builds never push images.
1 parent 23965ee commit c930d2d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎.github/workflows/deploy.yml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ name: Build and Push Docker Image
33
on:
44
push:
55
branches: [ "main" ]
6+
pull_request:
67
workflow_dispatch:
78

89
jobs:
910
build:
1011
runs-on: ubuntu-latest
1112
env:
12-
DOCKER_PUSH: ${{ secrets.DOCKER_USERNAME != '' && secrets.DOCKER_PASSWORD != '' }}
13+
DOCKER_PUSH: ${{ github.event_name == 'push' && secrets.DOCKER_USERNAME != '' && secrets.DOCKER_PASSWORD != '' }}
1314
steps:
1415
- name: Checkout code
1516
uses: actions/checkout@v4
@@ -29,15 +30,17 @@ jobs:
2930
run: npm run typecheck
3031

3132
- name: Test
32-
run: npm test
33+
run: npm test -- --coverage
3334

3435
- name: Build
3536
run: npm run build
3637

3738
- name: Set up QEMU
39+
if: env.DOCKER_PUSH == 'true'
3840
uses: docker/setup-qemu-action@v3
3941

4042
- name: Set up Docker Buildx
43+
if: env.DOCKER_PUSH == 'true'
4144
uses: docker/setup-buildx-action@v3
4245

4346
- name: Login to Docker Hub
@@ -49,6 +52,7 @@ jobs:
4952

5053
# Create a minimal Dockerfile for multi-arch that just uses pre-built assets
5154
- name: Create production Dockerfile
55+
if: env.DOCKER_PUSH == 'true'
5256
run: |
5357
cat > Dockerfile.prod << 'EOF'
5458
FROM nginx:alpine

0 commit comments

Comments
 (0)