diff --git a/.github/workflows/actions.lock b/.github/workflows/actions.lock index f4d364f36..17d2dd3af 100644 --- a/.github/workflows/actions.lock +++ b/.github/workflows/actions.lock @@ -24,6 +24,7 @@ workflows: '.github/workflows/copilot-setup-steps.yml': - 'actions/checkout@v6.1.0' - 'actions/setup-node@v6.5.0' + - 'swatinem/rust-cache@v2.9.3' '.github/workflows/engine-quality.yml': - 'actions/checkout@v6.1.0' - 'actions/setup-node@v6.5.0' diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index dfc41475b..0ca0a7ae8 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -1,9 +1,12 @@ name: Copilot setup steps # Prepares the environment GitHub Copilot cloud agent works in when it runs on GitHub Actions: the toolchains this -# repository pins, its dependencies, a build and Chromium, so the agent can build, test and render from its first -# step. It runs on its own when it changes, so a pull request shows whether it still works. +# repository pins, its dependencies, Considered, a build, and Chromium and WebKit, so the agent can check, build, test +# and render from its first step. It runs on its own when it changes, so a pull request shows whether it still works. on: workflow_dispatch: + # Weekly, so the Rust cache Copilot's sessions restore follows main's lockfile. + schedule: + - cron: '17 6 * * 1' push: paths: - .github/workflows/copilot-setup-steps.yml @@ -29,22 +32,48 @@ jobs: - uses: actions/checkout@v6.1.0 with: persist-credentials: false - # As in the check action: no incremental caches, line tables only, and the preinstalled toolchains nothing here - # uses removed, so builds and test suites fit the runner's disk. - - run: | + # As in the check action: no incremental caches and line tables only, so builds and test suites fit the runner's + # disk. As in ci.yml, the release profile without fat LTO and with 16 codegen units: the link alone takes minutes + # otherwise, and the Rust cache main saves then fits what CI builds. Set for later steps, so the agent's own builds + # reuse this build. Removing the preinstalled toolchains nothing here uses takes a minute or two, so it runs in the + # background while the job installs and builds. + - name: Build settings, and free disk space (in the background) + run: | echo CARGO_INCREMENTAL=0 >> "$GITHUB_ENV" echo CARGO_PROFILE_DEV_DEBUG=line-tables-only >> "$GITHUB_ENV" - sudo rm -rf /usr/local/lib/android /usr/local/.ghcup /opt/ghc /usr/share/swift \ - /usr/local/julia* /opt/hostedtoolcache/PyPy /opt/hostedtoolcache/CodeQL + echo CARGO_PROFILE_RELEASE_LTO=false >> "$GITHUB_ENV" + echo CARGO_PROFILE_RELEASE_CODEGEN_UNITS=16 >> "$GITHUB_ENV" + nohup sudo rm -rf /usr/local/lib/android /usr/local/.ghcup /opt/ghc /usr/share/swift \ + /usr/local/julia* /opt/hostedtoolcache/PyPy /opt/hostedtoolcache/CodeQL >/dev/null 2>&1 & - uses: actions/setup-node@v6.5.0 with: node-version-file: .node-version cache: npm cache-dependency-path: package-lock.json - # Installs the toolchain rust-toolchain.toml pins, then the workspace, its build (the native engine and CLI - # included) and Chromium for the renderer checks and screenshots. - - run: | + # The toolchain rust-toolchain.toml pins (with clippy, rustfmt and the Wasm target), then the dependencies' build + # output, as in the check action. Only runs on main save it (pushes of this file, the weekly run and manual runs); + # Copilot's sessions run on their own branches and restore main's. + - name: Install Rust + run: | rustup toolchain install - npm ci --no-audit --no-fund - npm run build - tools/scripts/install-browsers.sh chromium + rustc --version + cargo --version + - uses: Swatinem/rust-cache@v2.9.3 + with: + key: build + save-if: ${{ github.ref == 'refs/heads/main' }} + - name: Install npm dependencies + run: npm ci --no-audit --no-fund + # The pinned file-standards checker (checksum verified), which tools check --fast runs. + - name: Install Considered + run: node tools/scripts/considered.mjs install + # Every workspace, the native engine, CLI and Storybook included, so the agent's tools build and tools test find + # them up to date. + - name: Build + run: npm run build + # Chromium and WebKit with their system packages, as in the browser action, for the browser suites. + - name: Install browsers + run: tools/scripts/install-browsers.sh chromium webkit + # What is installed, built and missing, in the session log. + - name: Doctor + run: npm run tools -- doctor diff --git a/AGENTS.md b/AGENTS.md index d704b3916..cf7e0dc9d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -67,3 +67,39 @@ that runs the same commands from anywhere, using the checkout you are in. - `tools --help` and `tools --llms` describe every command. - Report friction with `tools feedback ""`. It drafts an issue; only `--submit`, with the person's agreement, files it. + +## Cloud sessions + +GitHub Copilot cloud agent runs on an Ubuntu GitHub Actions runner prepared by +[`copilot-setup-steps.yml`](.github/workflows/copilot-setup-steps.yml) before +the agent's first step. It installs the Node version from `.node-version` and +the Rust toolchain pinned in `rust-toolchain.toml` (with Clippy, rustfmt, and +the Wasm target), runs `npm ci`, and installs Considered. Next, it builds every +workspace with `npm run build` (native engine, CLI, and Storybook included) and +installs Playwright's Chromium and WebKit with their system packages. Compiled +Rust dependencies come from a cache saved only by runs on `main`. Setup also +exports CI's release profile (`CARGO_PROFILE_RELEASE_LTO=false` and +`CARGO_PROFILE_RELEASE_CODEGEN_UNITS=16`); without them, the next build +recompiles the CLI and every crate under it. Setup finishes with `tools doctor`, +so the session log shows what's ready and what's missing. + +Verify in the order above. Because setup already built everything, `tools build` +and `tools test` only rebuild what the session changes, and `--browser` works +with any Chromium or WebKit project. + +A few things still require CI or a local machine: + +- WebKit on macOS. Linux WebKit runs every browser suite in the cloud, while the + renderer harness on macOS WebKit (the platform Safari uses) runs only in CI's + `browser-macos` job. +- The macOS and Windows suites, the Windows VS Code smoke test, and the release + proofs, all of which run only in CI (see + [platform coverage](docs/maintainers/runner-coverage.md#platform-coverage)). +- The opt-in native extractor suites (.NET, Django, Spring, SCIP, and + Terraform). Setup doesn't install the toolchain versions CI pins for them. +- The generated reference docs, which need the pinned nightly that + `tools doctor` names. Without it, `tools check` skips the docs gate. + +Copilot only uses `copilot-setup-steps.yml` from the default branch, so edits to +it take effect for sessions once merged. A pull request that modifies the file +runs it as a regular workflow, showing whether it still works. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f17959272..5da4beb32 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,10 +62,8 @@ agents: You can optionally run `npm run tools -- link` to place a `projections-tools` command on your `PATH` that works from any directory in whichever checkout or worktree you're in, though `npm run tools --` remains the documented entry -point. In the cloud, GitHub Copilot cloud agent boots from -[`copilot-setup-steps.yml`](.github/workflows/copilot-setup-steps.yml), which -installs the pinned toolchains and dependencies, builds the workspace, and -installs Chromium before the agent's first step. +point. For GitHub Copilot cloud agent, see +[Cloud sessions](AGENTS.md#cloud-sessions). The browser test suites (`npm run test:browser`) use Playwright's Chromium and WebKit, which `npm ci` doesn't download. Install them once—and again after