Skip to content

Commit 7f3372d

Browse files
authored
ci: Move all rubies to a separate mise ci env (#2988)
* revert devcontainer mise to previous state * `bin/relock` now needs `mise --env ci install` * normal dev env just needs one ruby unless others are needed
1 parent 21aaa4d commit 7f3372d

7 files changed

Lines changed: 35 additions & 34 deletions

File tree

‎.devcontainer/run‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ if [[ ! -x "$MISE_BIN" ]]; then
2222
exit 1
2323
fi
2424

25-
# .mise.toml lists the whole Ruby matrix for bin/relock; the devcontainer profile
26-
# overrides it to pin the single Ruby baked into the image.
27-
export MISE_ENV=devcontainer
28-
2925
# Activate mise for this shell so PATH/shims are resolved correctly.
3026
eval "$("$MISE_BIN" activate bash)"
3127

‎.github/workflows/update_lockfiles.yml‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ name: Update lockfiles
44
# installs are fully pinned (supply-chain hardening). Run manually to create the
55
# initial lockfiles, and on a schedule to refresh them deliberately.
66
#
7-
# The mise-action step installs every Ruby declared in .mise.toml; bin/relock
8-
# then sweeps every gem's test-matrix.json — the single source of truth, shared
9-
# with the *_test.yml workflows — resolving each cell against its matching Ruby
10-
# via `mise exec`. One invocation regenerates the whole lock set.
7+
# Under MISE_ENV=ci the mise-action step installs every Ruby declared in
8+
# .mise.ci.toml; bin/relock then sweeps every gem's test-matrix.json — the
9+
# single source of truth, shared with the *_test.yml workflows — resolving each
10+
# cell against its matching Ruby via `mise exec`. One invocation regenerates the
11+
# whole lock set.
1112

1213
on:
1314
workflow_dispatch:
@@ -31,11 +32,14 @@ jobs:
3132
with:
3233
token: ${{ secrets.GITHUB_TOKEN }}
3334

34-
# mise installs every Ruby declared in .mise.toml (ruby.compile=false ->
35+
# mise installs every Ruby declared in .mise.ci.toml (ruby.compile=false ->
3536
# prebuilt binaries where available); bin/relock then resolves each cell
36-
# against its matching Ruby.
37+
# against its matching Ruby. MISE_ENV scopes the install to the ci profile;
38+
# it also keys the action's tool cache, so the matrix Rubies are cached and
39+
# restored across runs.
3740
- uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0
3841
env:
42+
MISE_ENV: ci
3943
MISE_JOBS: "2"
4044
with:
4145
install: true

‎.mise.ci.toml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Loaded only when MISE_ENV=ci. The full per-matrix Ruby set the lockfile CI job
2+
# and bin/relock resolve against; overrides the single Ruby in .mise.toml.
3+
[tools]
4+
# postinstall ensures latest bundlers possible on each version
5+
ruby = [
6+
{ version = "4.0", postinstall = "gem install bundler" },
7+
{ version = "3.4", postinstall = "gem install bundler" },
8+
{ version = "3.3", postinstall = "gem install bundler" },
9+
{ version = "3.2", postinstall = "gem install bundler" },
10+
{ version = "3.1", postinstall = "gem install bundler" },
11+
{ version = "3.0", postinstall = "gem install bundler" },
12+
# 2.7 is pinned because latest bundler fails to resolve
13+
{ version = "2.7", postinstall = "gem install bundler -v 2.4.22" },
14+
{ version = "jruby-9.4.14.0", postinstall = "gem install bundler" },
15+
]

‎.mise.devcontainer.toml‎

Lines changed: 0 additions & 4 deletions
This file was deleted.

‎.mise.toml‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,7 @@
22
ruby.compile = false
33

44
[tools]
5-
# postinstall ensures latest bundlers possible on each version
6-
ruby = [
7-
{ version = "4.0", postinstall = "gem install bundler" },
8-
{ version = "3.4", postinstall = "gem install bundler" },
9-
{ version = "3.3", postinstall = "gem install bundler" },
10-
{ version = "3.2", postinstall = "gem install bundler" },
11-
{ version = "3.1", postinstall = "gem install bundler" },
12-
{ version = "3.0", postinstall = "gem install bundler" },
13-
# 2.7 is pinned because latest bundler fails to resolve
14-
{ version = "2.7", postinstall = "gem install bundler -v 2.4.22" },
15-
{ version = "jruby-9.4.14.0", postinstall = "gem install bundler" },
16-
]
5+
ruby = "latest"
176
node = "lts"
187
java = "temurin-21"
198

‎CONTRIBUTING.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ This file defines which specific image and Ruby version will be used to run the
5252

5353
CI installs against a committed, checksummed lockfile per test-matrix cell (`<gem>/gemfiles/<cell>.gemfile.lock`) to keep dependencies fully pinned against supply chain attacks. Each gem's `test-matrix.json` is the source of truth; `bin/relock` materializes the gemfiles and locks from it.
5454

55-
We use [mise](https://mise.jdx.dev) for managing the ruby versions, so first install that by following official instructions. The required Rubies are declared in `.mise.toml`, so provision them once:
55+
We use [mise](https://mise.jdx.dev) for managing the ruby versions, so first install that by following official instructions. The required Rubies are declared in `.mise.ci.toml`, so provision them once:
5656

5757
```bash
58-
mise install # installs every Ruby the matrix needs
58+
mise --env ci install # installs every Ruby the matrix needs
5959
```
6060

6161
Then regenerate locks:

‎bin/relock‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
#
1414
# Each cell must resolve against its own Ruby (gemspecs gate on
1515
# required_ruby_version), so every cell runs under a matching Ruby provided by
16-
# mise (https://mise.jdx.dev). The required Rubies are declared in .mise.toml;
17-
# install them once with `mise install`. This script resolves against those
18-
# already-installed Rubies and aborts if any are missing.
16+
# mise (https://mise.jdx.dev). The required Rubies are declared in
17+
# .mise.ci.toml; install them once with `mise --env ci install`. This
18+
# script resolves against those already-installed Rubies and aborts if any are
19+
# missing.
1920
#
2021
# bin/relock # refresh every cell
2122
# bin/relock --gem sentry-ruby # one gem
@@ -162,15 +163,15 @@ RESOLVE = <<~SH
162163
SH
163164

164165
# Abort (don't auto-install) if any cell's Ruby is missing — the Rubies are
165-
# declared in .mise.toml and provisioned once via `mise install`.
166+
# declared in .mise.ci.toml and provisioned once via `mise --env ci install`.
166167
def ensure_installed(cells)
167168
missing = cells.map(&:ruby).uniq.reject do |spec|
168169
system(mise_bin, "where", "ruby@#{spec}", out: File::NULL, err: File::NULL)
169170
end
170171
return if missing.empty?
171172

172173
warn "Ruby not installed: #{missing.map { |s| "ruby@#{s}" }.join(', ')}."
173-
abort "Run `mise install` first."
174+
abort "Run `mise --env ci install` first."
174175
end
175176

176177
def cell_env(cell, force: false)
@@ -236,7 +237,7 @@ if opts[:list]
236237
exit 0
237238
end
238239

239-
# Resolve against already-installed Rubies (declared in .mise.toml) — never
240+
# Resolve against already-installed Rubies (declared in .mise.ci.toml) — never
240241
# auto-installs.
241242
ensure_installed(cells)
242243

0 commit comments

Comments
 (0)