diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 61f712d..af69ac7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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_env != ruby_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 diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..053cba7 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +ruby 3.3