Skip to content

Route a hosted pnpm lock under a rules_js hub whose build takes a routed lock #134

Route a hosted pnpm lock under a rules_js hub whose build takes a routed lock

Route a hosted pnpm lock under a rules_js hub whose build takes a routed lock #134

Workflow file for this run

name: Bazel patch compatibility (NuGet)
# The NuGet flows of the real-Bazel tests (`nuget::` in `e2e_bazel_build`):
# hosted mode for a package that rules_csharp's `nuget.from_lock` reads from
# `packages.lock.json` and `nuget.config`, for a tag that names no
# `nuget_config`, and agent mode for the copy of the package in NuGet's
# global packages folder, on each Bazel release below.
# bazel-compatibility.yml holds the legs and what every ecosystem shares;
# this file says when the NuGet legs run and on which releases.
#
# A NuGet leg downloads no .NET SDK and needs none on the runner: the
# fixture's consumer is a `genrule` over the assembly that the hub hands to
# a C# rule, and no C# rule is built. Beyond what every leg needs, a leg
# downloads the rules_csharp archive (about 140 kB) and nothing else, so
# its repository cache holds little more than what Bazel resolves for
# itself: about 1 MB on Bazel 9, half of that on Bazel 7, and about 13 MB
# on Bazel 8, which fetches protobuf for its own modules, as it does in a
# workspace without rules_csharp. No leg asks nuget.org: the test's
# downloader config sends every URL of that host to the loopback stand-in
# and blocks the host. A package under test never comes from the
# repository cache: the test builds the packages of a run with an id of
# that run in their names and in their bytes, so no earlier run saved a
# file with their checksums.
#
# Not required for merge: no `merge_group` trigger, and no job here is a
# `needs` of ci.yml's `ci-ok`.
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
# What a pull request run covers: the NuGet flows and their fixture, the
# harness and the workflows that run it, the Bazel installer and its
# pins, and the NuGet files of the product that `scan --mode hosted`,
# `scan --mode agent`, `vex` and `rollback` run through in the fixture,
# each by its own path: the readers of `packages.lock.json` and
# `nuget.config` and the `contentHash` of a package (formats/nuget), the
# NuGet crawler, which finds a package in the global packages folder,
# the reader of the NuGet settings a project inherits
# (vendor/nuget_config.rs), the discovery of a hosted pin in the two
# files, the upstream restore of `rollback`, and the hosted scan's check
# of that folder. Then what reads the tag in `MODULE.bazel`: the reader
# of the workspace files, which every ecosystem's flow shares
# (bazel/mod.rs, starlark.rs and workspace.rs), and what hosted mode
# makes of the tag (bazel/nuget.rs).
# vendor/nuget_feed.rs is the vendored backend; it is here for the
# version and folder helpers that every one of those files calls.
# patch/sidecars/nuget.rs is what agent mode does to a package in
# NuGet's folder beyond its files. Last, the VEX code: `vex/` of the
# core, the files of the `vex` command, and what `vex` makes of the tag
# (bazel/built.rs, which says what the hub of each ecosystem builds).
# The agent flow holds the exact document socket-patch writes about its
# build, so a change to how a document is built or worded starts the
# legs of every ecosystem. Nothing else that another ecosystem's flow
# owns is here: any other change to one ecosystem starts that
# ecosystem's legs only.
#
# What it does not cover: shared engine code. The hosted rewrite itself
# is there (`rewrite_nuget` in patch/redirect/mod.rs, the file of every
# ecosystem's rewriter), and so are patch/redirect/grant.rs,
# hosted/engine.rs, commands/scan/hosted.rs, the apply engine of agent
# mode, the shared test helpers and the toolchain files. A change to
# one of those gets its run on the push to main (when the file is in
# the list below) or in the nightly run, not on the pull request: that
# is the price of not running every ecosystem's legs on every shared
# change. On demand, workflow_dispatch runs the legs on any branch.
paths:
- '.github/workflows/bazel-nuget.yml'
- '.github/workflows/bazel-compatibility.yml'
- 'scripts/install-bazel.sh'
- 'scripts/bazel-pins.txt'
- 'crates/socket-patch-cli/tests/e2e_bazel_build/nuget.rs'
- 'crates/socket-patch-cli/tests/e2e_bazel_build/harness.rs'
- 'crates/socket-patch-cli/tests/fixtures/bazel/rules_csharp/**'
- 'crates/socket-patch-core/src/formats/nuget/**'
- 'crates/socket-patch-core/src/crawlers/nuget_crawler.rs'
- 'crates/socket-patch-core/src/vendor/nuget_config.rs'
- 'crates/socket-patch-core/src/vendor/nuget_feed.rs'
- 'crates/socket-patch-core/src/vex/discover/nuget.rs'
- 'crates/socket-patch-core/src/patch/redirect/upstream/nuget.rs'
- 'crates/socket-patch-cli/src/commands/scan/hosted/nuget.rs'
- 'crates/socket-patch-core/src/bazel/built.rs'
- 'crates/socket-patch-core/src/bazel/mod.rs'
- 'crates/socket-patch-core/src/bazel/nuget.rs'
- 'crates/socket-patch-core/src/bazel/starlark.rs'
- 'crates/socket-patch-core/src/bazel/workspace.rs'
- 'crates/socket-patch-core/src/patch/sidecars/nuget.rs'
- 'crates/socket-patch-core/src/vex/**'
- 'crates/socket-patch-cli/src/commands/vex*.rs'
push:
branches: [main]
# The pull request paths, and what only a push to main covers: the
# root of the test target (it changes when an ecosystem's module is
# added; ci.yml builds the target and runs its hermetic tests on every
# pull request), the shared engine code and test helpers the flows run
# through, and the toolchain files. A main push outside this list waits
# for the nightly run below.
paths:
- '.github/workflows/bazel-nuget.yml'
- '.github/workflows/bazel-compatibility.yml'
- 'scripts/install-bazel.sh'
- 'scripts/bazel-pins.txt'
- 'crates/socket-patch-cli/tests/e2e_bazel_build/nuget.rs'
- 'crates/socket-patch-cli/tests/e2e_bazel_build/harness.rs'
- 'crates/socket-patch-cli/tests/fixtures/bazel/rules_csharp/**'
- 'crates/socket-patch-core/src/formats/nuget/**'
- 'crates/socket-patch-core/src/crawlers/nuget_crawler.rs'
- 'crates/socket-patch-core/src/vendor/nuget_config.rs'
- 'crates/socket-patch-core/src/vendor/nuget_feed.rs'
- 'crates/socket-patch-core/src/vex/discover/nuget.rs'
- 'crates/socket-patch-core/src/patch/redirect/upstream/nuget.rs'
- 'crates/socket-patch-cli/src/commands/scan/hosted/nuget.rs'
- 'crates/socket-patch-core/src/bazel/built.rs'
- 'crates/socket-patch-core/src/bazel/mod.rs'
- 'crates/socket-patch-core/src/bazel/nuget.rs'
- 'crates/socket-patch-core/src/bazel/starlark.rs'
- 'crates/socket-patch-core/src/bazel/workspace.rs'
- 'crates/socket-patch-core/src/patch/sidecars/nuget.rs'
- 'crates/socket-patch-core/src/vex/**'
- 'crates/socket-patch-cli/src/commands/vex*.rs'
- 'crates/socket-patch-cli/tests/e2e_bazel_build/main.rs'
- 'crates/socket-patch-core/src/patch/redirect/**'
- 'crates/socket-patch-core/src/hosted/**'
- 'crates/socket-patch-cli/src/commands/**'
- 'crates/socket-patch-cli/tests/common/**'
- 'crates/socket-patch-cli/tests/hosted_memory_common/**'
- 'Cargo.lock'
- 'Cargo.toml'
- 'crates/*/Cargo.toml'
- 'rust-toolchain.toml'
- '.cargo/**'
schedule:
# Nightly, so a main change outside the push list still gets a run
# within a day. The macOS leg runs here and on demand only.
- cron: '7 5 * * *'
workflow_dispatch:
permissions:
contents: read
# The nightly run has a group of its own. A group holds one pending run, so
# in the group of main's pushes a second push would replace a nightly that
# waits behind the first, and the nightly is the only run with the macOS leg.
concurrency:
group: bazel-nuget-${{ github.event.pull_request.number || github.ref }}${{ github.event_name == 'schedule' && '-nightly' || '' }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
nuget:
uses: ./.github/workflows/bazel-compatibility.yml
with:
eco: nuget
fixtures: rules_csharp/bzlmod
# One leg per line: a Bazel release, and the era of the fixture that
# `nuget::FIXTURE` gives it.
releases: >-
[
{"bazel": "9.3.2", "era": "e9"},
{"bazel": "8.8.2", "era": "e9"},
{"bazel": "7.7.2", "era": "e9"}
]
macos: >-
[
{"bazel": "9.3.2", "era": "e9"}
]