site: fold the two long blocks in markdown too #42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ci | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| # The same checks, started by hand. A push delivers its event once, so an Actions outage | |
| # during that moment leaves a commit with no run at all and nothing to re-run: the branch | |
| # reads as unchecked and no button brings it back. Every job below reads the ref rather | |
| # than the event, so dispatching against a branch does what pushing it would have. The | |
| # release workflow carries this for the same reason. | |
| workflow_dispatch: | |
| # A branch pushed again while its last run is still going does not need both runs. Guarded on | |
| # pull requests only: every push to main is a deploy through Workers Builds, and canceling one | |
| # of those would leave a commit that shipped without its checks ever finishing. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| env: | |
| # turbo prints a first-run telemetry notice into every log otherwise. | |
| TURBO_TELEMETRY_DISABLED: 1 | |
| jobs: | |
| test: | |
| # The suite runs TypeScript sources directly, so it needs type stripping, and pnpm needs | |
| # Node 22.13 or newer to run at all. The higher of the two floors is the one that binds. | |
| # Neither is the tool's floor: the published package ships compiled JavaScript. | |
| name: test on node ${{ matrix.node }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node: ['22', '24'] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: pnpm/action-setup@v6 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: pnpm | |
| # `--ignore-scripts` skips the `prepare` build. `turbo run test` depends on `build` and | |
| # is what should put `dist/` on disk, so without this the job compiles it twice. | |
| - run: pnpm install --frozen-lockfile --ignore-scripts | |
| # `test` depends on `build` in turbo.json, so this is both steps in order. | |
| # Deliberately not cached between runs: this job exists to run the suite on | |
| # real runtimes, and a restored result is not a runtime having run it. | |
| - run: pnpm exec turbo run test | |
| lint: | |
| # oxlint over both projects in this repository. The root config carries the | |
| # TypeScript and correctness rules; the site adds React and Tailwind on top | |
| # of them, which is where the design system is enforced: a size or a color | |
| # written into a class rather than declared in `@theme` fails here. | |
| name: lint and types | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: pnpm/action-setup@v6 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version-file: .node-version | |
| cache: pnpm | |
| cache-dependency-path: | | |
| pnpm-lock.yaml | |
| site/pnpm-lock.yaml | |
| # Type-aware rules read the real TypeScript program, so both projects have | |
| # to be installed rather than just checked out. Nothing here reads `dist/`: | |
| # `tsconfig.check.json` is `noEmit` and oxlint reads sources, so the root | |
| # install skips its `prepare` build. | |
| - run: pnpm install --frozen-lockfile --ignore-scripts | |
| - run: pnpm --dir site install --frozen-lockfile | |
| - uses: actions/cache@v4 | |
| with: | |
| path: .turbo | |
| key: turbo-lint-${{ github.sha }} | |
| restore-keys: turbo-lint- | |
| # Every gate that is not the test suite, in one pass. `format` is one | |
| # formatter for the whole repository and covers both projects; `lint` and | |
| # `check-types` are per project, because type-aware rules and | |
| # `tsconfig.check.json` each read one project's TypeScript program. | |
| # `--continue` so a failure in one reports the rest rather than hiding it. | |
| - run: pnpm exec turbo run format lint check-types site:lint site:check-types --continue=dependencies-successful | |
| site: | |
| # Cloudflare Workers Builds deploys this on every push to main, so a build | |
| # that only fails there fails after the fact. Running it on pull requests is | |
| # the point at which it can still stop something. Deployment itself stays | |
| # with Workers Builds; there is no wrangler token in this repository. | |
| name: build the site | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: pnpm/action-setup@v6 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version-file: .node-version | |
| cache: pnpm | |
| cache-dependency-path: | | |
| pnpm-lock.yaml | |
| site/pnpm-lock.yaml | |
| # The root install is what the site build runs the CLI out of: the command | |
| # reference on the page is real output, generated by executing the CLI in | |
| # this checkout against a throwaway project. It runs `src/cli.ts` under type | |
| # stripping rather than `dist/`, so the root install skips its `prepare` build. | |
| - run: pnpm install --frozen-lockfile --ignore-scripts | |
| - run: pnpm --dir site install --frozen-lockfile | |
| - uses: actions/cache@v4 | |
| with: | |
| path: .turbo | |
| key: turbo-site-${{ github.sha }} | |
| restore-keys: turbo-site- | |
| - run: pnpm exec turbo run site:build | |
| install: | |
| # What `npm install -g agent-reference` actually produces, on the oldest Node the | |
| # package claims to support. Everything this catches is invisible from a source | |
| # checkout: a file left out of `files`, a bin without its executable mode, a runtime | |
| # read resolved against a path that only exists here. | |
| name: install the tarball on node ${{ matrix.node }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node: ['20', '24'] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| # Two runtimes, deliberately. pnpm and the compiler need a recent Node; the whole | |
| # point of this job is the old one. So the tarball is built up here and the matrix | |
| # version is switched in underneath it, which is also how a user meets this package: | |
| # they never build it, they install what someone else built. | |
| - uses: pnpm/action-setup@v6 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: '24' | |
| cache: pnpm | |
| # `--ignore-scripts` skips the `prepare` build; `npm pack` fires `prepack`, and that | |
| # is the build that actually reaches the tarball. | |
| - run: pnpm install --frozen-lockfile --ignore-scripts | |
| # Packed with npm, because that is the route a user takes. | |
| - run: npm pack | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - run: npm install -g ./agent-reference-*.tgz | |
| - name: the commands that read shipped files | |
| run: | | |
| agent-reference version | |
| agent-reference schema > /dev/null | |
| agent-reference guide > /dev/null | |
| mkdir -p /tmp/smoke && cd /tmp/smoke && agent-reference init > /dev/null |