Skip to content

Commit fc6ab34

Browse files
committed
Add .tool-versions containing Ruby 3.3
Add a `.tool-versions` so that the project works out of the box with version managers like asdf and mise. Add a CI check that makes sure our Ruby version in use there matches what's in `.tool-versions` so the two don't drift.
1 parent f3a07db commit fc6ab34

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,27 @@ jobs:
8484
run: bundle exec standardrb
8585
working-directory: ./driver/riverqueue-sequel
8686

87+
tool_versions_check:
88+
runs-on: ubuntu-latest
89+
90+
steps:
91+
- name: Checkout
92+
uses: actions/checkout@v4
93+
94+
- name: Check RUBY_VERSION matches .tool-versions Ruby version
95+
run: |
96+
cat <<- "EOF" | ruby
97+
ruby_env = ENV["RUBY_VERSION"] || abort("need RUBY_VERSION")
98+
ruby_tool_versions = File.read('.tool-versions').split('\n')[0].split[1]
99+
100+
if ruby_version_env != ruby_version_tool_versions
101+
abort("CI version $RUBY_VERSION ${ruby_env } should match .tool-versions Ruby ${ruby_tool_versions }")
102+
end
103+
EOF
104+
105+
# run: |
106+
# [[ "$RUBY_VERSION" == "$(cat .tool-versions | grep ruby | cut -w -f 2)" ]] || echo "CI version \$RUBY_VERSION should match .tool-versions Ruby `cat .tool-versions | grep ruby | cut -w -f 2`" && (exit 1)
107+
87108
type_check:
88109
runs-on: ubuntu-latest
89110
timeout-minutes: 3

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruby 3.3

0 commit comments

Comments
 (0)