Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 2 additions & 22 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -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
19 changes: 3 additions & 16 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .mise.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
bun = "1.3"
bun = "1.4.1"
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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 });'
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
36 changes: 36 additions & 0 deletions engineering-profile.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
3 changes: 3 additions & 0 deletions scripts/test-site.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
set -euo pipefail
test -s dist/index.html
Loading