From fbd5784ecc0c4c50d54c4dde3efd3c0ba9ac84da Mon Sep 17 00:00:00 2001 From: "Ricardo Q. Bazan" Date: Sun, 18 Oct 2026 12:26:44 -0500 Subject: [PATCH] ci: lint and type-check the examples Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012xRhgX9oTNKCAhLoiC8vSX --- .github/workflows/examples.yml | 69 ++++++++++++++++++++++++++++++++++ docs/contributing.md | 1 + docs/development.md | 5 ++- 3 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/examples.yml diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml new file mode 100644 index 0000000..47a9a54 --- /dev/null +++ b/.github/workflows/examples.yml @@ -0,0 +1,69 @@ +name: Examples + +# Same paths as e2e.yml: the examples, the library they pack, and the tooling that installs both. +on: + push: + branches: + - main + paths: + - "examples/**" + - "package/**" + - ".github/workflows/examples.yml" + - "pnpm-lock.yaml" + - "pnpm-workspace.yaml" + - "mise.toml" + - "mise.lock" + pull_request: + types: [opened, synchronize, reopened] + branches: + - main + paths: + - "examples/**" + - "package/**" + - ".github/workflows/examples.yml" + - "pnpm-lock.yaml" + - "pnpm-workspace.yaml" + - "mise.toml" + - "mise.lock" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: {} + +jobs: + check: + name: Check examples + runs-on: ubuntu-latest + permissions: + contents: read + timeout-minutes: 10 + env: + MISE_EXPERIMENTAL: "1" + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: 🛠️ Setup mise + uses: jdx/mise-action@c2a87611a18de5b3828c5652fe268e992400cb5c # v4.3.0 + with: + install: true + cache: true + experimental: true + + # `mise install` takes no monorepo glob, so each example's own runtime (bun, deno) installs here. + - name: 🧰 Install example tools + run: for d in examples/*/; do mise install --locked -C "$d"; done + + - name: 📦 Install root dependencies + run: pnpm install --frozen-lockfile + + - name: 🎁 Pack @variablelab/env + run: mise run env:pack + + - name: 💅 Lint and typecheck examples + timeout-minutes: 5 + run: mise run examples:check diff --git a/docs/contributing.md b/docs/contributing.md index 96cda83..7114d97 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -42,6 +42,7 @@ The pull request title takes the same form, because it becomes the squash-merge - [ ] The pull request title follows Conventional Commits. - [ ] Tests cover the change: unit tests in `package/src/__tests__/`, and e2e tests in `examples//test/e2e/` when relevant. - [ ] `mise run lib:test` and `mise run check` pass locally. +- [ ] `mise run examples:check` passes locally, when the change touches `examples/` or `package/`. - [ ] `mise run test:e2e` passes locally, at least for the examples the change touches. - [ ] A changeset is added, if the published `@variablelab/env` changed. See [Changesets](#changesets). - [ ] The docs are updated, if public API or behavior changed. diff --git a/docs/development.md b/docs/development.md index b207a56..2442436 100644 --- a/docs/development.md +++ b/docs/development.md @@ -117,9 +117,10 @@ On every pull request to `main`: - **CI** ([`ci.yml`](../.github/workflows/ci.yml)): the library and docs pipeline, inside the pnpm workspace (`package` + `docsite`). It runs `mise run check`, `mise run lib:test` and `mise run lib:build`. On `main`, it also runs the Changesets release job, and for a `feat/*` or `fix/*` branch, or a pull request with the `preview` label, it publishes a [preview release](contributing.md#preview-releases). - **E2E** ([`e2e.yml`](../.github/workflows/e2e.yml)): a matrix job per example, when the pull request touches `examples/`, `package/`, the workflow itself, the pnpm lockfile or workspace, or the root mise files. Each job sets up its own runtime with `jdx/mise-action` v4.3.0 (with `working_directory: examples/`), packs the library with `mise run env:pack`, and runs `mise run //examples/:test:e2e`. +- **Examples** ([`examples.yml`](../.github/workflows/examples.yml)): one job, on the same paths as E2E, that installs each example's tools, packs the library and runs `mise run examples:check`. - **Workflow audit** ([`workflow-audit.yml`](../.github/workflows/workflow-audit.yml)): zizmor on the workflows in `.github/`. -CI and E2E use the experimental mise monorepo feature (`MISE_EXPERIMENTAL=1`). +CI, E2E and Examples use the experimental mise monorepo feature (`MISE_EXPERIMENTAL=1`). Outside pull requests: @@ -303,4 +304,4 @@ mise run examples:bump ### CI passes but local fails (or the reverse) -Make sure your local mise is current (`mise self-update`), and that you ran `mise install` from the root and from the example. CI uses `jdx/mise-action` v4.3.0 with `working_directory: examples/` to provision both layers. +Make sure your local mise is current (`mise self-update`), and that you ran `mise install` from the root and from the example. E2E uses `jdx/mise-action` v4.3.0 with `working_directory: examples/` to provision both layers. Examples runs it from the root, then `mise install --locked` in each example.