From c0919996ba03ad8b6c3c1394c3231c99f8c71867 Mon Sep 17 00:00:00 2001 From: nicodes Date: Wed, 7 Oct 2026 08:57:42 +0200 Subject: [PATCH] feat: expose canonical static-site output gates --- .github/actions/build/action.yml | 24 ++------------------- .github/actions/test/action.yml | 19 +++-------------- .github/workflows/ci.yml | 3 +++ .mise.toml | 2 +- Makefile | 22 +++++++++++++++++++ README.md | 4 ++++ engineering-profile.json | 36 ++++++++++++++++++++++++++++++++ scripts/test-site.sh | 3 +++ 8 files changed, 74 insertions(+), 39 deletions(-) create mode 100644 Makefile create mode 100644 engineering-profile.json create mode 100644 scripts/test-site.sh diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index 78f653b..7598700 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -1,28 +1,8 @@ name: Build -description: > - The static site, into ./dist. - - A composite action rather than a reusable workflow so it runs in the caller's - job, under the caller's name -- CI / Build -- rather than as a nested - "caller / callee" check. - - It has exactly one caller: there is no CD here, so nothing can drift from - anything. It is split out so this repository has the same shape as the rest of - the organisation, and for no stronger reason than that. - - NOTHING LEAVES THE RUNNER. The site is left in ./dist for ../test to assert - against. - +description: Canonical static-site build gate runs: using: composite steps: - # --frozen-lockfile so CI fails on a lockfile that does not match - # package.json, rather than quietly resolving something newer than what - # anyone has run locally. - - name: Install JS dependencies - shell: bash - run: bun install --frozen-lockfile - - name: Build shell: bash - run: bun run build + run: make build diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index 7067371..ba66c46 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -1,21 +1,8 @@ name: Test -description: > - Is this commit good. Nothing is published here; a failure means the site is - wrong, not that the pipeline is. - - Runs AFTER ../build, because everything it asserts is a property of ./dist. A - static site has two ways to be broken that matter -- it did not build, and it - built the wrong thing -- and only the second one needs a test. - - NO no-JavaScript assertion, unlike the static sites in the nicodes - organisation. This one ships Qwik, so it emits JavaScript on purpose and that - check would fail on its first run. - +description: Canonical static-site test gate runs: using: composite steps: - # A build that emits nothing still "succeeds", so the artefact is checked - # rather than the exit code. - - name: The page was actually written + - name: Test shell: bash - run: test -s dist/index.html + run: make test diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fed08b3..e5adf2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,9 @@ jobs: # one out on pnpm with no .mise.toml at all. - uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac # v2 + - name: Validate developer profile and workflow controls + uses: nicodes/tools/workflow-standards@cf0e560c9bbb888488191fcce03409b6c6fbdc28 # v0.13.0 + - name: Build uses: ./.github/actions/build diff --git a/.mise.toml b/.mise.toml index ac33547..deb7160 100644 --- a/.mise.toml +++ b/.mise.toml @@ -1,2 +1,2 @@ [tools] -bun = "1.3" +bun = "1.4.1" diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4452f95 --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +.DEFAULT_GOAL := help +.PHONY: help install lint test build check dev stop clean +BUN ?= bun +help: + @echo 'make check Install frozen dependencies, type-check, build and check static output' + @echo 'make dev Start the foreground Astro development server' +install: + $(BUN) install --frozen-lockfile +lint: + @echo "lint: unsupported: no source lint or type-check gate is configured" +build: install + $(BUN) run build +test: + bash scripts/test-site.sh +check: build + $(MAKE) test +dev: + $(BUN) run dev +stop: + @echo 'stop: unsupported: press Ctrl-C in the foreground dev terminal' +clean: + $(BUN) -e 'const fs = require("node:fs"); for (const path of ["dist", ".astro"]) fs.rmSync(path, { recursive: true, force: true });' diff --git a/README.md b/README.md index ba7e937..c98d9a7 100644 --- a/README.md +++ b/README.md @@ -44,3 +44,7 @@ All commands are run from the root of the project, from a terminal: ## 👀 Want to learn more? Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat). + +## Standard developer commands + +Use `mise install` for the pinned toolchain. `mise exec -- make check` installs frozen dependencies, builds the static site and runs every existing output assertion. `make test` checks an existing build. No source lint or type-check gate is configured, so that profile capability is explicitly unsupported. `make dev` runs in the foreground; stop with Ctrl-C. `make clean` removes generated output. diff --git a/engineering-profile.json b/engineering-profile.json new file mode 100644 index 0000000..f832dec --- /dev/null +++ b/engineering-profile.json @@ -0,0 +1,36 @@ +{ + "version": 1, + "profile": "static-website", + "commands": { + "install": [ + "make", + "install" + ], + "lint": { + "unsupported": "This caller has no source linter or type-check gate configured; build and all output assertions remain mandatory." + }, + "test": [ + "make", + "test" + ], + "build": [ + "make", + "build" + ], + "check": [ + "make", + "check" + ], + "dev": [ + "make", + "dev" + ], + "clean": [ + "make", + "clean" + ], + "stop": { + "unsupported": "Development server stays in the foreground; use Ctrl-C in its terminal" + } + } +} diff --git a/scripts/test-site.sh b/scripts/test-site.sh new file mode 100644 index 0000000..101ad14 --- /dev/null +++ b/scripts/test-site.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -euo pipefail +test -s dist/index.html