From b5e23c9b154919ba663baee692256de150f1adf4 Mon Sep 17 00:00:00 2001 From: "theeraphat.ch" Date: Mon, 3 Aug 2026 23:19:16 +0700 Subject: [PATCH] ci: add CI on main and dry-run verification on dev No workflow ran on branch pushes or pull requests: cavimg-package.yaml only triggers on v* tags and workflow_dispatch, so typecheck, tests and the Go MCP suite were never exercised before a publish. Add ci.yaml (push/PR on main, plus workflow_call) running cavimg typecheck/test/build and cavimg-mcp vet/test. Add dev-check.yaml (push/PR on dev) which reuses ci.yaml and then runs `npm publish --dry-run` so dev validates the packed tarball and manifest without contacting the registry or publishing. Both pin pnpm/action-setup by commit SHA, declare `permissions: contents: read`, and keep `${{ }}` out of run blocks, matching the hardening in a4ac388. --- .github/workflows/ci.yaml | 72 ++++++++++++++++++++++++++++++++ .github/workflows/dev-check.yaml | 55 ++++++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/dev-check.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..84d4978 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,72 @@ +name: ci + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_call: + +permissions: + contents: read + +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + web: + name: cavimg (typecheck / test / build) + runs-on: ubuntu-latest + + permissions: + contents: read + + steps: + - uses: actions/checkout@v6 + + - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 + with: + version: 10.27.0 + + - uses: actions/setup-node@v6 + with: + node-version: "24" + package-manager-cache: false + + - name: Install dependencies + run: pnpm install --frozen-lockfile --filter cavimg... --ignore-scripts + + - name: Typecheck + run: pnpm --filter cavimg typecheck + + - name: Test + run: pnpm --filter cavimg test + + - name: Build + run: pnpm --filter cavimg build + + mcp: + name: cavimg-mcp (vet / test) + runs-on: ubuntu-latest + + permissions: + contents: read + + steps: + - uses: actions/checkout@v6 + + - uses: actions/setup-go@v6 + with: + go-version-file: packages/cavimg-mcp/go.mod + cache-dependency-path: packages/cavimg-mcp/go.sum + + - name: Vet + working-directory: packages/cavimg-mcp + run: go vet ./... + + - name: Test + working-directory: packages/cavimg-mcp + run: go test ./... diff --git a/.github/workflows/dev-check.yaml b/.github/workflows/dev-check.yaml new file mode 100644 index 0000000..9460089 --- /dev/null +++ b/.github/workflows/dev-check.yaml @@ -0,0 +1,55 @@ +name: dev-check + +on: + push: + branches: + - dev + pull_request: + branches: + - dev + +permissions: + contents: read + +concurrency: + group: dev-check-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + verify: + name: verify + uses: ./.github/workflows/ci.yaml + permissions: + contents: read + + pack: + name: publish dry-run (no registry write) + needs: verify + runs-on: ubuntu-latest + + permissions: + contents: read + + steps: + - uses: actions/checkout@v6 + + - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 + with: + version: 10.27.0 + + - uses: actions/setup-node@v6 + with: + node-version: "24" + package-manager-cache: false + + - name: Install dependencies + run: pnpm install --frozen-lockfile --filter cavimg... --ignore-scripts + + - name: Build + run: pnpm --filter cavimg build + + - name: Pack and inspect manifest + working-directory: packages/cavimg + run: | + echo "::notice::--dry-run packs the tarball only. It does NOT contact the registry, validate OIDC, or publish." + npm publish --dry-run --tag latest