From c2b8bba95ea38be5c9d08c9904f8edb01c6dba1c Mon Sep 17 00:00:00 2001 From: Leslie Owusu-Appiah Date: Sat, 23 May 2026 18:52:24 +0200 Subject: [PATCH] chore: set up CI (typecheck + lint + test on PR and push) (closes #8) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GitHub Actions workflow at .github/workflows/ci.yml. Runs on every PR against develop and every push to develop. Three parallel jobs: typecheck (tsc --noEmit), lint (eslint src), test (jest). Node 20 matches package.json's engines field and Workspace's toolchain. Single Node version on purpose — adding a 22/24 matrix triples runner minutes for negligible value at this scale. Concurrency group cancels superseded runs on the same PR ref. Pushes to develop don't cancel (they should always complete to publish status). Manual follow-up (can't encode in repo): set up branch protection on develop requiring Typecheck / Lint / Test contexts before merge. Command in the PR description. Refs: #8 Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/ci.yml | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 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..86cc3fd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,63 @@ +# CI for @workspace.sh/react-native-jsoncanvas. +# +# Runs on every PR against develop and on every push to develop. Three jobs +# in parallel: typecheck, lint, test. All three are required to be green +# before a PR can merge (set up via branch protection on develop — manual +# repo setting, not encoded here). +# +# Node 20 matches the engines field in package.json ("node": ">=20") and +# Workspace's own toolchain. Single Node version on purpose — adding 22 / 24 +# matrix runs triples CI time for negligible value at this scale; revisit +# when there's a real consumer pinning a different Node version. + +name: CI + +on: + push: + branches: [develop] + pull_request: + branches: [develop] + +# Cancel superseded runs on the same ref — saves runner minutes on +# rapid-fire pushes during a long review cycle. Pushes to develop don't +# cancel (they should always complete to publish status). +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + typecheck: + name: Typecheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + - run: npm ci + - run: npm run typecheck + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + - run: npm ci + - run: npm run lint + + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + - run: npm ci + - run: npm test