From 2d51f60190fdf1f3b47e880c813108c6f70e47a1 Mon Sep 17 00:00:00 2001 From: "deploy-debbie[bot]" <268472978+deploy-debbie[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 10:25:58 +0000 Subject: [PATCH] ci: add GitHub Actions workflow for frontend Add CI pipeline with ESLint, TypeScript checking, Vitest tests, and GHCR Docker build. Co-Authored-By: Paperclip --- .github/workflows/ci.yml | 78 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5640db0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,78 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + packages: write + +env: + REGISTRY: ghcr.io + IMAGE_NAME: cartsnitch/cartsnitch + +jobs: + lint: + runs-on: local-ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "20" + cache: npm + - run: npm ci + - name: ESLint + run: npx eslint . + - name: Type check + run: npx tsc --noEmit + + test: + runs-on: local-ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "20" + cache: npm + - run: npm ci + - name: Run tests + run: npx vitest run + + build-and-push: + runs-on: local-ubuntu-latest + needs: [lint, test] + steps: + - uses: actions/checkout@v4 + + - name: Log in to GHCR + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=sha,prefix=sha- + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + target: prod