From f4d9c250fa48c77d1f7997fd9449e6aae38aac2b Mon Sep 17 00:00:00 2001 From: Reda Lemeden Date: Mon, 12 Oct 2026 09:02:39 +0200 Subject: [PATCH] Add a Check & Build GitHub Actions workflow --- .github/workflows/test.yml | 42 ++++++++++++++++++++++++++++++++++++++ TODO.md | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..ad0125a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,42 @@ +name: Test + +on: + pull_request: + branches: [main] + push: + branches: [main] + +jobs: + check-and-build: + name: Check & Build + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v7 + + - name: Setup pnpm + uses: pnpm/action-setup@v6 + + - name: Setup Node.js + uses: actions/setup-node@v7 + with: + node-version: "24" + cache: "pnpm" + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + # Every check below runs even if an earlier one failed, so a single CI + # run reports every problem at once. + - name: Check formatting + if: ${{ !cancelled() }} + run: pnpm format:check + + - name: Type check + if: ${{ !cancelled() }} + run: pnpm check + + - name: Build + if: ${{ !cancelled() }} + run: pnpm build diff --git a/TODO.md b/TODO.md index d7f494a..d8b3f59 100644 --- a/TODO.md +++ b/TODO.md @@ -37,7 +37,7 @@ Ordered queue: each item is one focused PR, and earlier items are prerequisites - Gap: the site is on Astro 5.15, `@astrojs/mdx` 4, TypeScript 5, `prettier-plugin-astro` 0.14, and `prettier-plugin-tailwindcss` 0.7, with no Node or pnpm version pinned. `@astrojs/rss` is installed but no feed exists, and `@astrojs/check` sits in `dependencies`. The i18next removal above has shipped, so nothing blocks the upgrade. - Scope (one toolchain change, kept whole): bump `astro` to `^7.3.7`, `@astrojs/mdx` to `^8.0.3`, `@astrojs/sitemap` to `^3.7.4`, `tailwindcss`/`@tailwindcss/vite` to `^4.3.3`, `@tailwindcss/typography` to `^0.5.20`, `typescript` to `^6.0.3`, `prettier` to `^3.9.9`, `prettier-plugin-astro` to `^1.1.0`, and `prettier-plugin-tailwindcss` to `^0.8.1`. Move `@astrojs/check` (`^0.9.10`) to `devDependencies`. Remove the unused `@astrojs/rss`. Add `"engines": {"node": ">=22.19.0"}`, `"packageManager": "pnpm@11.22.0"`, `.nvmrc` (`22.19.0`), and a `pnpm-workspace.yaml` (`packages: ["."]`, `allowBuilds: {esbuild: true, sharp: true}`) so pnpm 11 runs the required build scripts. Add `// @ts-check` and `output: "static"` to `astro.config.mjs`. Change `preview` to `astro build && astro preview`. Regenerate `pnpm-lock.yaml` and re-run `pnpm format` if the new plugin versions change formatting. - Acceptance: `pnpm install --frozen-lockfile` succeeds on Node 22.19+ with pnpm 11. Check, `format:check`, and build pass with no new warnings. `dist/` still contains `index.html` and `sitemap-index.xml`. -- [ ] **Add a Check & Build GitHub Actions workflow** +- [x] **Add a Check & Build GitHub Actions workflow** - Gap: no CI exists, so formatting, type errors, and build failures are only caught locally. Its prerequisites have shipped: `package.json` has the `format:check` and `check` scripts and pins `packageManager: pnpm@11.22.0`, which `pnpm/action-setup` reads. Node 24 satisfies `engines.node` (`>=22.19.0`). - Scope: add `.github/workflows/test.yml`, named `Test` with job `Check & Build`, triggered on pull requests to and pushes to `main`. Steps: `actions/checkout@v7`, `pnpm/action-setup@v6` (reads `packageManager`), `actions/setup-node@v7` with `node-version: "24"` and `cache: "pnpm"`, then `pnpm install --frozen-lockfile`. Run `pnpm format:check`, `pnpm check`, and `pnpm build` as separate steps, each with `if: ${{ !cancelled() }}` so one run reports every failure. - Acceptance: the workflow passes on its own PR. Validate the YAML locally by running the three commands in order.