Skip to content

Fix gem remedy unit tests for paths that need quoting (#2276) #313

Fix gem remedy unit tests for paths that need quoting (#2276)

Fix gem remedy unit tests for paths that need quoting (#2276) #313

Workflow file for this run

name: Bazel patch compatibility (RubyGems)
# The RubyGems flows of the real-Bazel tests (`ruby::` in `e2e_bazel_build`):
# hosted and vendored mode for a gem that rules_ruby's `ruby.bundle_fetch`
# reads from `Gemfile` and `Gemfile.lock`, on each Bazel release below.
# bazel-compatibility.yml holds the legs and what every ecosystem shares;
# this file says when the Ruby legs run and on which releases.
#
# Beyond what every leg needs, a Ruby leg downloads the prebuilt Ruby of
# bazel-contrib/portable-ruby from GitHub (about 90 MB on Linux) and the
# bundler gem from rubygems.org, both held by its repository cache. It
# downloads no JDK and needs none on the runner: rules_ruby's rules name a
# Java runtime toolchain that only JRuby uses, and the fixture registers
# one with nothing behind it. A gem under test never comes from the
# repository cache of an earlier run: the fixture names no `gem_checksums`,
# so rules_ruby gives Bazel no checksum for a gem, and Bazel looks a file
# up in that cache by its checksum only. The flow that writes a
# `gem_checksums` into its workspace copy names gems it built for its own
# run, which no earlier run has.
#
# 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 RubyGems flows and their fixture,
# the harness and the workflows that run it, the Bazel installer and its
# pins, and the RubyGems files that `scan --mode hosted`, `rollback`,
# `scan --mode vendored` and `vendor --revert` run through in the
# fixture, each by its own path: the readers of a Bundler lock and a
# Gemfile with the lock half of the hosted rewrite (formats/gem), lock
# discovery, the lock inventory, the Ruby crawler (it says which lock
# Bundler loads), the upstream restore of `rollback`, the stale-install
# guard that those commands end with, the vendored backend
# (vendor/gem.rs, and vendor/gem/ for the gem it commits for a hub),
# and the refusal of vendored mode beside a hub that reads the lock
# (vendor/bazel_hub.rs), which vendor/refusals.rs hands to every
# command.
# Last, the VEX code: `vex/` of the core, the files of the `vex`
# command, and `bazel/` of the core, which reads the workspace files and
# decides whether Bazel builds what was patched. Every flow holds the
# exact document socket-patch writes about its patched 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, so any other change to one ecosystem
# starts that ecosystem's legs only.
#
# What it does not cover: shared engine code. The other half of the
# hosted rewrite is there (`rewrite_gem` and its planner in
# patch/redirect/mod.rs, the file of every ecosystem's rewriter), and
# so are patch/redirect/grant.rs, hosted/engine.rs and
# commands/scan/hosted.rs, the rest of vendored mode (the download from
# the patch service, the ledger, the `vendor` command), 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. No flow
# runs the native extension rebuild of agent mode
# (patch/gem_ext.rs, patch/gem_source.rs), which is in neither list. On
# demand, workflow_dispatch runs the legs on any branch.
paths:
- '.github/workflows/bazel-ruby.yml'
- '.github/workflows/bazel-compatibility.yml'
- 'scripts/install-bazel.sh'
- 'scripts/bazel-pins.txt'
- 'crates/socket-patch-cli/tests/e2e_bazel_build/ruby.rs'
- 'crates/socket-patch-cli/tests/e2e_bazel_build/harness.rs'
- 'crates/socket-patch-cli/tests/fixtures/bazel/rules_ruby/**'
- 'crates/socket-patch-core/src/formats/gem/**'
- 'crates/socket-patch-core/src/vex/discover/gem.rs'
- 'crates/socket-patch-core/src/vendor/lock_inventory/gem.rs'
- 'crates/socket-patch-core/src/crawlers/ruby_crawler.rs'
- 'crates/socket-patch-core/src/patch/redirect/upstream/gem.rs'
- 'crates/*/src/**/gem_refresh.rs'
- 'crates/socket-patch-core/src/vendor/gem.rs'
- 'crates/socket-patch-core/src/vendor/gem/**'
- 'crates/socket-patch-core/src/vendor/bazel_hub.rs'
- 'crates/socket-patch-core/src/vendor/refusals.rs'
- 'crates/socket-patch-core/src/bazel/**'
- '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-ruby.yml'
- '.github/workflows/bazel-compatibility.yml'
- 'scripts/install-bazel.sh'
- 'scripts/bazel-pins.txt'
- 'crates/socket-patch-cli/tests/e2e_bazel_build/ruby.rs'
- 'crates/socket-patch-cli/tests/e2e_bazel_build/harness.rs'
- 'crates/socket-patch-cli/tests/fixtures/bazel/rules_ruby/**'
- 'crates/socket-patch-core/src/formats/gem/**'
- 'crates/socket-patch-core/src/vex/discover/gem.rs'
- 'crates/socket-patch-core/src/vendor/lock_inventory/gem.rs'
- 'crates/socket-patch-core/src/crawlers/ruby_crawler.rs'
- 'crates/socket-patch-core/src/patch/redirect/upstream/gem.rs'
- 'crates/*/src/**/gem_refresh.rs'
- 'crates/socket-patch-core/src/vendor/gem.rs'
- 'crates/socket-patch-core/src/vendor/gem/**'
- 'crates/socket-patch-core/src/vendor/bazel_hub.rs'
- 'crates/socket-patch-core/src/vendor/refusals.rs'
- 'crates/socket-patch-core/src/bazel/**'
- '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: '47 4 * * *'
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-ruby-${{ github.event.pull_request.number || github.ref }}${{ github.event_name == 'schedule' && '-nightly' || '' }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
ruby:
uses: ./.github/workflows/bazel-compatibility.yml
with:
eco: ruby
fixtures: rules_ruby/bzlmod
# One leg per line: a Bazel release, and the era of the fixture that
# `ruby::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"}
]