Skip to content

Commit bb57e06

Browse files
agorischekCopilot
andauthored
Copilot setup steps: Considered, WebKit and a Rust cache, so cloud sessions check and test from their first step (#294)
* Copilot setup steps: Considered, WebKit and a Rust cache, so cloud sessions check and test from their first step The cloud agent's setup now installs Considered (tools check --fast failed without it), WebKit beside Chromium, and restores main's Rust build cache; it frees disk in the background as CI does and ends with tools doctor. AGENTS.md gains a Cloud sessions section: what is preinstalled and what still needs CI or a local machine. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> * Copilot setup steps: CI's release profile, so the CLI links in seconds and main's Rust cache fits Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --------- Co-authored-by: agorischek <6295280+agorischek@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 3478c0b commit bb57e06

4 files changed

Lines changed: 81 additions & 17 deletions

File tree

‎.github/workflows/actions.lock‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ workflows:
2424
'.github/workflows/copilot-setup-steps.yml':
2525
- 'actions/checkout@v6.1.0'
2626
- 'actions/setup-node@v6.5.0'
27+
- 'swatinem/rust-cache@v2.9.3'
2728
'.github/workflows/engine-quality.yml':
2829
- 'actions/checkout@v6.1.0'
2930
- 'actions/setup-node@v6.5.0'

‎.github/workflows/copilot-setup-steps.yml‎

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
name: Copilot setup steps
22
# Prepares the environment GitHub Copilot cloud agent works in when it runs on GitHub Actions: the toolchains this
3-
# repository pins, its dependencies, a build and Chromium, so the agent can build, test and render from its first
4-
# step. It runs on its own when it changes, so a pull request shows whether it still works.
3+
# repository pins, its dependencies, Considered, a build, and Chromium and WebKit, so the agent can check, build, test
4+
# and render from its first step. It runs on its own when it changes, so a pull request shows whether it still works.
55
on:
66
workflow_dispatch:
7+
# Weekly, so the Rust cache Copilot's sessions restore follows main's lockfile.
8+
schedule:
9+
- cron: '17 6 * * 1'
710
push:
811
paths:
912
- .github/workflows/copilot-setup-steps.yml
@@ -29,22 +32,48 @@ jobs:
2932
- uses: actions/checkout@v6.1.0
3033
with:
3134
persist-credentials: false
32-
# As in the check action: no incremental caches, line tables only, and the preinstalled toolchains nothing here
33-
# uses removed, so builds and test suites fit the runner's disk.
34-
- run: |
35+
# As in the check action: no incremental caches and line tables only, so builds and test suites fit the runner's
36+
# disk. As in ci.yml, the release profile without fat LTO and with 16 codegen units: the link alone takes minutes
37+
# otherwise, and the Rust cache main saves then fits what CI builds. Set for later steps, so the agent's own builds
38+
# reuse this build. Removing the preinstalled toolchains nothing here uses takes a minute or two, so it runs in the
39+
# background while the job installs and builds.
40+
- name: Build settings, and free disk space (in the background)
41+
run: |
3542
echo CARGO_INCREMENTAL=0 >> "$GITHUB_ENV"
3643
echo CARGO_PROFILE_DEV_DEBUG=line-tables-only >> "$GITHUB_ENV"
37-
sudo rm -rf /usr/local/lib/android /usr/local/.ghcup /opt/ghc /usr/share/swift \
38-
/usr/local/julia* /opt/hostedtoolcache/PyPy /opt/hostedtoolcache/CodeQL
44+
echo CARGO_PROFILE_RELEASE_LTO=false >> "$GITHUB_ENV"
45+
echo CARGO_PROFILE_RELEASE_CODEGEN_UNITS=16 >> "$GITHUB_ENV"
46+
nohup sudo rm -rf /usr/local/lib/android /usr/local/.ghcup /opt/ghc /usr/share/swift \
47+
/usr/local/julia* /opt/hostedtoolcache/PyPy /opt/hostedtoolcache/CodeQL >/dev/null 2>&1 &
3948
- uses: actions/setup-node@v6.5.0
4049
with:
4150
node-version-file: .node-version
4251
cache: npm
4352
cache-dependency-path: package-lock.json
44-
# Installs the toolchain rust-toolchain.toml pins, then the workspace, its build (the native engine and CLI
45-
# included) and Chromium for the renderer checks and screenshots.
46-
- run: |
53+
# The toolchain rust-toolchain.toml pins (with clippy, rustfmt and the Wasm target), then the dependencies' build
54+
# output, as in the check action. Only runs on main save it (pushes of this file, the weekly run and manual runs);
55+
# Copilot's sessions run on their own branches and restore main's.
56+
- name: Install Rust
57+
run: |
4758
rustup toolchain install
48-
npm ci --no-audit --no-fund
49-
npm run build
50-
tools/scripts/install-browsers.sh chromium
59+
rustc --version
60+
cargo --version
61+
- uses: Swatinem/rust-cache@v2.9.3
62+
with:
63+
key: build
64+
save-if: ${{ github.ref == 'refs/heads/main' }}
65+
- name: Install npm dependencies
66+
run: npm ci --no-audit --no-fund
67+
# The pinned file-standards checker (checksum verified), which tools check --fast runs.
68+
- name: Install Considered
69+
run: node tools/scripts/considered.mjs install
70+
# Every workspace, the native engine, CLI and Storybook included, so the agent's tools build and tools test find
71+
# them up to date.
72+
- name: Build
73+
run: npm run build
74+
# Chromium and WebKit with their system packages, as in the browser action, for the browser suites.
75+
- name: Install browsers
76+
run: tools/scripts/install-browsers.sh chromium webkit
77+
# What is installed, built and missing, in the session log.
78+
- name: Doctor
79+
run: npm run tools -- doctor

‎AGENTS.md‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,39 @@ that runs the same commands from anywhere, using the checkout you are in.
6767
- `tools --help` and `tools --llms` describe every command.
6868
- Report friction with `tools feedback "<summary>"`. It drafts an issue; only
6969
`--submit`, with the person's agreement, files it.
70+
71+
## Cloud sessions
72+
73+
GitHub Copilot cloud agent runs on an Ubuntu GitHub Actions runner prepared by
74+
[`copilot-setup-steps.yml`](.github/workflows/copilot-setup-steps.yml) before
75+
the agent's first step. It installs the Node version from `.node-version` and
76+
the Rust toolchain pinned in `rust-toolchain.toml` (with Clippy, rustfmt, and
77+
the Wasm target), runs `npm ci`, and installs Considered. Next, it builds every
78+
workspace with `npm run build` (native engine, CLI, and Storybook included) and
79+
installs Playwright's Chromium and WebKit with their system packages. Compiled
80+
Rust dependencies come from a cache saved only by runs on `main`. Setup also
81+
exports CI's release profile (`CARGO_PROFILE_RELEASE_LTO=false` and
82+
`CARGO_PROFILE_RELEASE_CODEGEN_UNITS=16`); without them, the next build
83+
recompiles the CLI and every crate under it. Setup finishes with `tools doctor`,
84+
so the session log shows what's ready and what's missing.
85+
86+
Verify in the order above. Because setup already built everything, `tools build`
87+
and `tools test` only rebuild what the session changes, and `--browser` works
88+
with any Chromium or WebKit project.
89+
90+
A few things still require CI or a local machine:
91+
92+
- WebKit on macOS. Linux WebKit runs every browser suite in the cloud, while the
93+
renderer harness on macOS WebKit (the platform Safari uses) runs only in CI's
94+
`browser-macos` job.
95+
- The macOS and Windows suites, the Windows VS Code smoke test, and the release
96+
proofs, all of which run only in CI (see
97+
[platform coverage](docs/maintainers/runner-coverage.md#platform-coverage)).
98+
- The opt-in native extractor suites (.NET, Django, Spring, SCIP, and
99+
Terraform). Setup doesn't install the toolchain versions CI pins for them.
100+
- The generated reference docs, which need the pinned nightly that
101+
`tools doctor` names. Without it, `tools check` skips the docs gate.
102+
103+
Copilot only uses `copilot-setup-steps.yml` from the default branch, so edits to
104+
it take effect for sessions once merged. A pull request that modifies the file
105+
runs it as a regular workflow, showing whether it still works.

‎CONTRIBUTING.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ agents:
6262
You can optionally run `npm run tools -- link` to place a `projections-tools`
6363
command on your `PATH` that works from any directory in whichever checkout or
6464
worktree you're in, though `npm run tools --` remains the documented entry
65-
point. In the cloud, GitHub Copilot cloud agent boots from
66-
[`copilot-setup-steps.yml`](.github/workflows/copilot-setup-steps.yml), which
67-
installs the pinned toolchains and dependencies, builds the workspace, and
68-
installs Chromium before the agent's first step.
65+
point. For GitHub Copilot cloud agent, see
66+
[Cloud sessions](AGENTS.md#cloud-sessions).
6967

7068
The browser test suites (`npm run test:browser`) use Playwright's Chromium and
7169
WebKit, which `npm ci` doesn't download. Install them once—and again after

0 commit comments

Comments
 (0)