Add Ruby 3.4 to CI matrix and make it default #73
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
env: | |
# Database to connect to that can create other databases with `CREATE DATABASE`. | |
ADMIN_DATABASE_URL: postgres://postgres:postgres@localhost:5432 | |
# Just a common place for steps to put binaries they need and which is added | |
# to GITHUB_PATH/PATH. | |
BIN_PATH: /home/runner/bin | |
# The version of Ruby that non-spec tasks like the build check or lint run | |
# against. The setup-ruby step must have a version specified, which is why | |
# this is necessary. | |
# | |
# If updating this value, you probably also want to add a new version to the | |
# spec version matrix below. | |
RUBY_VERSION: "3.4" | |
# A suitable URL for a test database. | |
TEST_DATABASE_NAME: river_test | |
TEST_DATABASE_URL: postgres://postgres:[email protected]:5432/river_test?sslmode=disable | |
on: | |
- push | |
jobs: | |
gem_build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Ruby + `bundle install` | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ env.RUBY_VERSION }} | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
- name: Build gem (riverqueue-ruby) | |
run: gem build riverqueue.gemspec | |
working-directory: . | |
- name: Build gem (riverqueue-activerecord) | |
run: gem build riverqueue-activerecord.gemspec | |
working-directory: ./driver/riverqueue-activerecord | |
- name: Build gem (riverqueue-sequel) | |
run: gem build riverqueue-sequel.gemspec | |
working-directory: ./driver/riverqueue-sequel | |
lint: | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Ruby + `bundle install` | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ env.RUBY_VERSION }} | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
- name: Standard Ruby (riverqueue-ruby) | |
run: bundle exec standardrb | |
working-directory: . | |
- name: bundle install (riverqueue-activerecord) | |
run: bundle install | |
working-directory: ./driver/riverqueue-activerecord | |
- name: Standard Ruby (riverqueue-activerecord) | |
run: bundle exec standardrb | |
working-directory: ./driver/riverqueue-activerecord | |
- name: bundle install (riverqueue-sequel) | |
run: bundle install | |
working-directory: ./driver/riverqueue-sequel | |
- name: Standard Ruby (riverqueue-sequel) | |
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 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Ruby + `bundle install` | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ env.RUBY_VERSION }} | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
- name: Steep (riverqueue-ruby) | |
run: bundle exec steep check | |
working-directory: . | |
spec: | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
strategy: | |
matrix: | |
# If adding a value, you probably also want to update the default | |
# RUBY_VERSION for non-spec jobs above. | |
ruby_version: | |
- "3.1" | |
- "3.2" | |
- "3.3" | |
- "3.4" | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 2s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Ruby + `bundle install` | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby_version }} | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
# Needed for River's CLI. There is a version of Go on Actions' base image, | |
# but it's old and can't read modern `go.mod` annotations correctly. | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "stable" | |
check-latest: true | |
- name: Create database | |
run: psql --echo-errors --quiet -c '\timing off' -c "CREATE DATABASE ${TEST_DATABASE_NAME};" ${ADMIN_DATABASE_URL} | |
- name: Install River CLI | |
run: go install github.com/riverqueue/river/cmd/river@latest | |
- name: river migrate-up | |
run: river migrate-up --database-url "$TEST_DATABASE_URL" | |
- name: Rspec (riverqueue-ruby) | |
run: bundle exec rspec | |
working-directory: . | |
- name: bundle install (riverqueue-activerecord) | |
run: bundle install | |
working-directory: ./driver/riverqueue-activerecord | |
- name: Rspec (riverqueue-activerecord) | |
run: bundle exec rspec | |
working-directory: ./driver/riverqueue-activerecord | |
- name: bundle install (riverqueue-sequel) | |
run: bundle install | |
working-directory: ./driver/riverqueue-sequel | |
- name: Rspec (riverqueue-sequel) | |
run: bundle exec rspec | |
working-directory: ./driver/riverqueue-sequel |