diff --git a/.buildkite/desktop.yml b/.buildkite/desktop.yml new file mode 100644 index 000000000..9c983d68e --- /dev/null +++ b/.buildkite/desktop.yml @@ -0,0 +1,117 @@ +env: + CI: "true" + CARGO_TERM_COLOR: "always" + # Resolved from the checkout root, where every step runs `npm ci`. + NPM_CONFIG_CACHE: ".npm-cache" + # Debug info is most of a target/ directory. Line tables keep file:line in + # panics and backtraces, and make builds and caches much smaller. + CARGO_PROFILE_DEV_DEBUG: "line-tables-only" + +__defs: + # Keeps Rust in the checkout, so that the cache volume can hold it. rustup + # reads rust-toolchain.toml, which adds rustfmt and clippy. + install_rust: &install_rust | + export CARGO_HOME="$$PWD/.cargo-ci/cargo" + export RUSTUP_HOME="$$PWD/.cargo-ci/rustup" + export PATH="$$CARGO_HOME/bin:$$PATH" + command -v rustup || curl -fsSL https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal + + desktop_changes: &desktop_changes "{desktop/**,shared/**,package{,-lock}.json,.npmrc,.nvmrc,.buildkite/desktop.yml}" + +steps: + - label: "๐Ÿ”Ž desktop js" + key: desktop-js + if_changed: *desktop_changes + timeout_in_minutes: 10 + # Each step has its own volume: the last of two concurrent steps to finish + # would discard what the other wrote to a shared one. + cache: + name: desktop-js + paths: + - ".npm-cache" + plugins: + # Tracks the major version in .nvmrc. + - docker#v5.14.0: + image: "node:24-bookworm" + # Without this the cache volume links point at nothing. + volumes: + - "/cache/bkcache:/cache/bkcache" + environment: + - CI + - NPM_CONFIG_CACHE + commands: + - npm ci + - cd desktop + - npm run check-js + - npm run test:unit + + - label: "๐Ÿฆ€ desktop rust" + key: desktop-rust + if_changed: *desktop_changes + timeout_in_minutes: 45 + cache: + name: desktop-rust + paths: + - "desktop/.cargo-ci" + - "desktop/target" + plugins: + - docker#v5.14.0: + image: "node:24-bookworm" + volumes: + - "/cache/bkcache:/cache/bkcache" + environment: + - CI + - CARGO_TERM_COLOR + - CARGO_PROFILE_DEV_DEBUG + commands: + # The system libraries Tauri links against. + - | + apt-get update -qq + apt-get install -y -qq --no-install-recommends \ + libxdo-dev libayatana-appindicator3-dev librsvg2-dev \ + libwebkit2gtk-4.1-dev libjavascriptcoregtk-4.1-dev + - cd desktop + - *install_rust + - scripts/check-rs + + - label: "๐ŸŽญ desktop e2e" + key: desktop-e2e + if_changed: *desktop_changes + timeout_in_minutes: 45 + cache: + name: desktop-e2e + paths: + - ".npm-cache" + - "desktop/.cargo-ci" + - "desktop/target" + - "desktop/tests/tmp/bin" + artifact_paths: + - "desktop/tests/artifacts/**/*" + plugins: + - docker#v5.14.0: + # Ships WebKit. The tag must match @playwright/test in package.json. + image: "mcr.microsoft.com/playwright:v1.61.1-noble" + # WebKit exhausts Docker's default 64MB /dev/shm. + ipc: host + volumes: + - "/cache/bkcache:/cache/bkcache" + environment: + - CI + - NPM_CONFIG_CACHE + - CARGO_TERM_COLOR + - CARGO_PROFILE_DEV_DEBUG + commands: + # test-http-api links Tauri through radicle-types. + - | + apt-get update -qq + apt-get install -y -qq --no-install-recommends \ + build-essential pkg-config xz-utils libssl-dev openssh-client \ + libxdo-dev libayatana-appindicator3-dev librsvg2-dev \ + libwebkit2gtk-4.1-dev libjavascriptcoregtk-4.1-dev + - npm ci + - cd desktop + - *install_rust + - scripts/install-binaries + - npm run build:http + - mkdir -p tests/artifacts + - npm run test:e2e diff --git a/.buildkite/explorer-e2e.yml b/.buildkite/explorer-e2e.yml index 070766864..30a506586 100644 --- a/.buildkite/explorer-e2e.yml +++ b/.buildkite/explorer-e2e.yml @@ -13,6 +13,9 @@ env: steps: - label: "๐ŸŽญ explorer e2e" key: explorer-e2e + if_changed: + include: "{explorer/**,shared/**,package{,-lock}.json,.npmrc,.nvmrc,.buildkite/explorer-*.yml}" + exclude: "explorer/{crates/**,Cargo.*,rust-toolchain,.cargo/**}" # The explorer-check step in explorer-node-checks.yml seeds the shared # volume. depends_on: explorer-check diff --git a/.buildkite/explorer-node-checks.yml b/.buildkite/explorer-node-checks.yml index dcd048f1c..885bf582f 100644 --- a/.buildkite/explorer-node-checks.yml +++ b/.buildkite/explorer-node-checks.yml @@ -66,9 +66,14 @@ __defs: # path is always a directory, so the two files share one. - "explorer/.lintcache" + explorer_web_changes: &explorer_web_changes + include: "{explorer/**,shared/**,package{,-lock}.json,.npmrc,.nvmrc,.buildkite/explorer-*.yml}" + exclude: "explorer/{crates/**,Cargo.*,rust-toolchain,.cargo/**}" + steps: - label: "๐Ÿ”Ž explorer check" key: explorer-check + if_changed: *explorer_web_changes timeout_in_minutes: 10 cache: *deps_cache plugins: @@ -84,6 +89,7 @@ steps: - label: "๐Ÿงช explorer unit-tests" key: explorer-unit-tests + if_changed: *explorer_web_changes depends_on: explorer-check timeout_in_minutes: 10 cache: *deps_cache @@ -98,6 +104,7 @@ steps: # binaries on PATH even though it runs under vitest rather than Playwright. - label: "๐Ÿ”Œ explorer http-client-tests" key: explorer-http-client-tests + if_changed: *explorer_web_changes depends_on: explorer-check timeout_in_minutes: 15 cache: *deps_cache @@ -116,6 +123,7 @@ steps: # needs a browser but no Radicle binaries or fixtures. - label: "๐Ÿ— explorer build-smoke" key: explorer-build-smoke + if_changed: *explorer_web_changes depends_on: explorer-check timeout_in_minutes: 30 cache: *deps_cache diff --git a/.buildkite/explorer-rust.yml b/.buildkite/explorer-rust.yml index 8d91fe11d..b096b0c36 100644 --- a/.buildkite/explorer-rust.yml +++ b/.buildkite/explorer-rust.yml @@ -45,10 +45,13 @@ __defs: - "~/.rustup" - "~/.cache/cargo-target" + explorer_rust_changes: &explorer_rust_changes "{explorer/{crates/**,Cargo.*,rust-toolchain,.cargo/**},.buildkite/explorer-rust.yml}" + steps: # RUSTFLAGS is set on the build only, not on the test run. - label: "๐Ÿฆ€ explorer test" key: explorer-rust-test + if_changed: *explorer_rust_changes timeout_in_minutes: 30 cache: name: rust-test @@ -63,6 +66,7 @@ steps: - label: "๐Ÿฆ€ explorer lint" key: explorer-rust-lint + if_changed: *explorer_rust_changes timeout_in_minutes: 30 cache: name: rust-lint diff --git a/.buildkite/explorer-visual.yml b/.buildkite/explorer-visual.yml index 5de4902f8..7a2f6ab4d 100644 --- a/.buildkite/explorer-visual.yml +++ b/.buildkite/explorer-visual.yml @@ -86,6 +86,11 @@ steps: - label: "๐Ÿ“ธ explorer visual" key: explorer-visual + # The master step runs on every build, as branch builds take their + # baselines from it. + if_changed: + include: "{explorer/**,shared/**,package{,-lock}.json,.npmrc,.nvmrc,.buildkite/explorer-*.yml}" + exclude: "explorer/{crates/**,Cargo.*,rust-toolchain,.cargo/**}" branches: "!master" depends_on: explorer-check timeout_in_minutes: 30 diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 0daa10401..d2ef8daba 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -5,17 +5,20 @@ # The broker creates exactly one Buildkite pipeline per Radicle repo, so every # suite lands in this single build. Cache volumes are scoped to the pipeline, so # the same name in two uploaded files is one volume: explorer-node-checks.yml, -# explorer-e2e.yml and explorer-visual.yml all attach `deps` on purpose. Share a -# name only where that is safe, because a step that commits a volume version -# discards what a concurrent step wrote to the same volume. +# explorer-e2e.yml and explorer-visual.yml all attach `deps` on purpose, while +# desktop.yml uses its own volume. Share a name only where that is safe, +# because a step that commits a volume version discards what a concurrent step +# wrote to the same volume. # # Upload explorer-node-checks.yml before explorer-e2e.yml: the e2e step depends # on the `explorer-check` key defined there, and Buildkite rejects a step whose # dependency is not yet part of the build. # # A push of a `releases/httpd/` tag also starts a build, with the tag -# name as the branch. explorer-release.yml only runs then; the other suites run -# too, against the tagged commit. +# name as the branch. explorer-release.yml only runs then. +# +# `if_changed` skips steps whose files are unchanged against master. A master +# build runs every step. # # Superseded builds are not cancelled. Buildkite has no YAML equivalent of the # GitHub Actions cancel-in-progress. @@ -23,8 +26,12 @@ steps: - label: ":pipeline: upload" commands: + # The commands share one shell, so the export reaches every upload. + - '[ "$$BUILDKITE_BRANCH" != master ] || export BUILDKITE_AGENT_APPLY_IF_CHANGED=false' - buildkite-agent pipeline upload .buildkite/explorer-node-checks.yml - buildkite-agent pipeline upload .buildkite/explorer-e2e.yml - buildkite-agent pipeline upload .buildkite/explorer-visual.yml - buildkite-agent pipeline upload .buildkite/explorer-rust.yml - buildkite-agent pipeline upload .buildkite/explorer-release.yml + - buildkite-agent pipeline upload .buildkite/desktop.yml + - buildkite-agent pipeline upload .buildkite/shared.yml diff --git a/.buildkite/shared.yml b/.buildkite/shared.yml new file mode 100644 index 000000000..324e739dd --- /dev/null +++ b/.buildkite/shared.yml @@ -0,0 +1,28 @@ +env: + CI: "true" + # Resolved from the checkout root, where every step runs `npm ci`. + NPM_CONFIG_CACHE: ".npm-cache" + +steps: + - label: "๐Ÿงฉ shared" + key: shared + if_changed: "{shared/**,package{,-lock}.json,.npmrc,.nvmrc,.buildkite/shared.yml}" + timeout_in_minutes: 10 + cache: + name: shared + paths: + - ".npm-cache" + plugins: + # Tracks the major version in .nvmrc. + - docker#v5.14.0: + image: "node:24-bookworm" + # Without this the cache volume links point at nothing. + volumes: + - "/cache/bkcache:/cache/bkcache" + environment: + - CI + - NPM_CONFIG_CACHE + commands: + - npm ci + - (cd shared/ui && npm run check && npm run test:unit) + - (cd shared/core && npm run check && npm run test:unit) diff --git a/AGENTS.md b/AGENTS.md index e03c64ef8..909f90943 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -29,7 +29,7 @@ source of truth for anything inside it. | `package.json`, `package-lock.json`, `.npmrc`, `.nvmrc` | The npm workspace, its lockfile and npm and Node settings | | `docs/adr/` | Decisions that affect the whole repository | | `.github/workflows/` | GitHub CI: `explorer-*.yml` for explorer, `desktop-*.yml` for desktop, `shared-ui.yml` and `shared-core.yml` for the shared packages | -| `.buildkite/` | Radicle CI pipelines (explorer only) | +| `.buildkite/` | Radicle CI pipelines, which mirror the GitHub workflows | | `.ryph/` | Dev machine image and setup for agents, see `.ryph/environment.md` | ## Working in this repo