From ede8765a2a4e7668479e6b5790082ac02cfa8447 Mon Sep 17 00:00:00 2001 From: Will Hou Date: Sun, 14 Jun 2026 13:23:36 -0400 Subject: [PATCH] ci: build and test on pushes to main and on PRs Add a GitHub Actions workflow that runs `npm ci`, `npm run build`, and `npm test` on every push to main and on every pull request, across Node 20.x and 22.x. Uses least-privilege permissions and cancels superseded runs for the same ref. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/ci.yml | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 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..e296008 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +# Cancel superseded runs for the same branch / PR to save CI minutes. +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + build-and-test: + name: Build & test (Node ${{ matrix.node-version }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-version: [20.x, 22.x] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Node ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Run unit tests + run: npm test