|
| 1 | +name: Bazel patch compatibility (npm) |
| 2 | + |
| 3 | +# The npm flows of the real-Bazel tests (`npm::` in `e2e_bazel_build`): |
| 4 | +# hosted and vendored mode for a package that aspect_rules_js links from a |
| 5 | +# pnpm lock, on each Bazel release below. bazel-compatibility.yml holds the |
| 6 | +# legs and what every ecosystem shares; this file says when the npm legs run |
| 7 | +# and on which releases. |
| 8 | +# |
| 9 | +# Beyond what every leg needs, an npm leg downloads Node from nodejs.org and |
| 10 | +# ruleset archives from codeload.github.com; its repository cache holds them |
| 11 | +# and comes to about 100 MB. An npm tarball under test passes through that |
| 12 | +# cache as well: Bazel's downloader fetches it and keeps it under its |
| 13 | +# sha512. So a test builds the upstream tarball and each patched one anew, |
| 14 | +# with an id of the run in the entry file, and writes the upstream sum into |
| 15 | +# the lock of its workspace copy. No cache holds a tarball of the run, and |
| 16 | +# the test counts the requests for the upstream one. |
| 17 | +# |
| 18 | +# Not required for merge: no `merge_group` trigger, and no job here is a |
| 19 | +# `needs` of ci.yml's `ci-ok`. |
| 20 | + |
| 21 | +on: |
| 22 | + pull_request: |
| 23 | + types: [opened, synchronize, reopened, ready_for_review] |
| 24 | + # What a pull request run covers: the npm flows and their fixture, the |
| 25 | + # harness and the workflows that run it, the Bazel installer and its |
| 26 | + # pins, and the npm-family files of socket-patch-core that the two |
| 27 | + # flows run through (a coverage build of the binary showed which): the |
| 28 | + # pnpm lock's model and hosted planner (formats/pnpm/), the pnpm |
| 29 | + # vendored backend with the npm code beside it (vendor/pnpm_*, |
| 30 | + # vendor/npm_*, the lock inventory), the `pnpm-workspace.yaml` lookup, |
| 31 | + # the npm-family lock and config readers (vex/discover/npm.rs, |
| 32 | + # patch/redirect/npmrc.rs), the upstream restore of `rollback`, the |
| 33 | + # crawler every `scan` starts, and the `package.json` reader. The |
| 34 | + # globs name that one crate, so no bench fixture is here, and nothing |
| 35 | + # another ecosystem's flow owns: a change to one ecosystem starts that |
| 36 | + # ecosystem's legs only. |
| 37 | + # |
| 38 | + # What it does not cover: shared engine code (patch/redirect/mod.rs, |
| 39 | + # the rest of vendor/, hosted/, commands/), the shared test helpers and |
| 40 | + # the toolchain files. A change there gets its run on the push to main |
| 41 | + # (when the file is in the list below) or in the nightly run, not on the |
| 42 | + # pull request: that is the price of not running every ecosystem's legs |
| 43 | + # on every shared change. On demand, workflow_dispatch runs the legs on |
| 44 | + # any branch. |
| 45 | + paths: |
| 46 | + - '.github/workflows/bazel-npm.yml' |
| 47 | + - '.github/workflows/bazel-compatibility.yml' |
| 48 | + - 'scripts/install-bazel.sh' |
| 49 | + - 'scripts/bazel-pins.txt' |
| 50 | + - 'crates/socket-patch-cli/tests/e2e_bazel_build/npm.rs' |
| 51 | + - 'crates/socket-patch-cli/tests/e2e_bazel_build/harness.rs' |
| 52 | + - 'crates/socket-patch-cli/tests/fixtures/bazel/rules_js/**' |
| 53 | + - 'crates/socket-patch-core/src/**/*pnpm*' |
| 54 | + - 'crates/socket-patch-core/src/**/*pnpm*/**' |
| 55 | + - 'crates/socket-patch-core/src/vendor/npm_*' |
| 56 | + - 'crates/socket-patch-core/src/vendor/lock_inventory/npm_family.rs' |
| 57 | + - 'crates/socket-patch-core/src/patch/redirect/npmrc.rs' |
| 58 | + - 'crates/socket-patch-core/src/patch/redirect/upstream/npm.rs' |
| 59 | + - 'crates/socket-patch-core/src/vex/discover/npm.rs' |
| 60 | + - 'crates/socket-patch-core/src/crawlers/npm_crawler.rs' |
| 61 | + - 'crates/socket-patch-core/src/formats/package_json.rs' |
| 62 | + push: |
| 63 | + branches: [main] |
| 64 | + # The pull request paths, and what only a push to main covers: the |
| 65 | + # root of the test target (it changes when an ecosystem's module is |
| 66 | + # added; ci.yml builds the target and runs its hermetic tests on every |
| 67 | + # pull request), the shared engine code and test helpers the flows run |
| 68 | + # through, and the toolchain files. A main push outside this list waits |
| 69 | + # for the nightly run below. |
| 70 | + paths: |
| 71 | + - '.github/workflows/bazel-npm.yml' |
| 72 | + - '.github/workflows/bazel-compatibility.yml' |
| 73 | + - 'scripts/install-bazel.sh' |
| 74 | + - 'scripts/bazel-pins.txt' |
| 75 | + - 'crates/socket-patch-cli/tests/e2e_bazel_build/npm.rs' |
| 76 | + - 'crates/socket-patch-cli/tests/e2e_bazel_build/harness.rs' |
| 77 | + - 'crates/socket-patch-cli/tests/fixtures/bazel/rules_js/**' |
| 78 | + - 'crates/socket-patch-core/src/**/*pnpm*' |
| 79 | + - 'crates/socket-patch-core/src/**/*pnpm*/**' |
| 80 | + - 'crates/socket-patch-core/src/vendor/npm_*' |
| 81 | + - 'crates/socket-patch-core/src/vendor/lock_inventory/npm_family.rs' |
| 82 | + - 'crates/socket-patch-core/src/patch/redirect/npmrc.rs' |
| 83 | + - 'crates/socket-patch-core/src/patch/redirect/upstream/npm.rs' |
| 84 | + - 'crates/socket-patch-core/src/vex/discover/npm.rs' |
| 85 | + - 'crates/socket-patch-core/src/crawlers/npm_crawler.rs' |
| 86 | + - 'crates/socket-patch-core/src/formats/package_json.rs' |
| 87 | + - 'crates/socket-patch-cli/tests/e2e_bazel_build/main.rs' |
| 88 | + - 'crates/socket-patch-core/src/patch/redirect/**' |
| 89 | + - 'crates/socket-patch-core/src/vendor/**' |
| 90 | + - 'crates/socket-patch-core/src/hosted/**' |
| 91 | + - 'crates/socket-patch-cli/src/commands/**' |
| 92 | + - 'crates/socket-patch-cli/tests/common/**' |
| 93 | + - 'crates/socket-patch-cli/tests/hosted_memory_common/**' |
| 94 | + - 'Cargo.lock' |
| 95 | + - 'Cargo.toml' |
| 96 | + - 'crates/*/Cargo.toml' |
| 97 | + - 'rust-toolchain.toml' |
| 98 | + - '.cargo/**' |
| 99 | + schedule: |
| 100 | + # Nightly, so a main change outside the push list still gets a run |
| 101 | + # within a day. The macOS leg runs here and on demand only. |
| 102 | + - cron: '27 4 * * *' |
| 103 | + workflow_dispatch: |
| 104 | + |
| 105 | +permissions: |
| 106 | + contents: read |
| 107 | + |
| 108 | +# The nightly run has a group of its own. A group holds one pending run, so |
| 109 | +# in the group of main's pushes a second push would replace a nightly that |
| 110 | +# waits behind the first, and the nightly is the only run with the macOS leg. |
| 111 | +concurrency: |
| 112 | + group: bazel-npm-${{ github.event.pull_request.number || github.ref }}${{ github.event_name == 'schedule' && '-nightly' || '' }} |
| 113 | + cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 114 | + |
| 115 | +jobs: |
| 116 | + npm: |
| 117 | + uses: ./.github/workflows/bazel-compatibility.yml |
| 118 | + with: |
| 119 | + eco: npm |
| 120 | + fixtures: rules_js/bzlmod |
| 121 | + # One leg per line: a Bazel release, and the era of the fixture that |
| 122 | + # `npm::FIXTURE` gives it. |
| 123 | + releases: >- |
| 124 | + [ |
| 125 | + {"bazel": "9.3.2", "era": "e9"}, |
| 126 | + {"bazel": "8.8.2", "era": "e9"}, |
| 127 | + {"bazel": "7.7.2", "era": "e9"} |
| 128 | + ] |
| 129 | + macos: >- |
| 130 | + [ |
| 131 | + {"bazel": "9.3.2", "era": "e9"} |
| 132 | + ] |
0 commit comments