Skip to content

Commit

Permalink
Add .tool-versions containing Ruby 3.3
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brandur committed Dec 20, 2024
1 parent f3a07db commit fc6ab34
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,27 @@ jobs:
run: bundle exec standardrb
working-directory: ./driver/riverqueue-sequel

tool_versions_check:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check RUBY_VERSION matches .tool-versions Ruby version
run: |
cat <<- "EOF" | ruby
ruby_env = ENV["RUBY_VERSION"] || abort("need RUBY_VERSION")
ruby_tool_versions = File.read('.tool-versions').split('\n')[0].split[1]
if ruby_version_env != ruby_version_tool_versions
abort("CI version $RUBY_VERSION ${ruby_env } should match .tool-versions Ruby ${ruby_tool_versions }")
end
EOF
# run: |
# [[ "$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)

type_check:
runs-on: ubuntu-latest
timeout-minutes: 3
Expand Down
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 3.3

0 comments on commit fc6ab34

Please sign in to comment.