diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5dfe7d5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,65 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + # One CI run per branch/PR; superseded runs are cancelled to save minutes. + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + backend: + name: Backend tests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + cache-dependency-path: package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test + + website: + name: Website lint and build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + cache-dependency-path: website/package-lock.json + + - name: Install dependencies + working-directory: website + run: npm ci + + - name: Lint + working-directory: website + run: npm run lint + + - name: Build + working-directory: website + env: + GITHUB_PAGES: true + run: npm run build diff --git a/README.md b/README.md index db78eb0..4ffda5d 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ website/ src/backendSamples.js # GraphQL server samples in 10 backend languages vite.config.js # Vite config (GitHub Pages base path + /graphql dev proxy) .github/workflows/ + ci.yml # Backend tests plus website lint/build on push and PRs deploy-pages.yml # Builds website/ and publishes it to GitHub Pages ``` @@ -105,6 +106,18 @@ npm run lint # Oxlint npm test ``` +## Continuous integration + +The [`CI`](.github/workflows/ci.yml) workflow runs on every push to `main`, on +every pull request, and on demand from the Actions tab. It has two jobs: + +- **Backend tests** — `npm ci` then `npm test` (node:test) at the repository root. +- **Website lint and build** — `npm ci`, `npm run lint` (Oxlint) and + `GITHUB_PAGES=true npm run build` inside `website/`, matching what the Pages + deployment builds. + +Runs are grouped per branch and superseded runs are cancelled automatically. + ## Finance Cluster Integration (Priority 1) This service now exposes a unified finance GraphQL surface over three upstream