feat: Add runtime advisory lock name customization and multi-database… #187
This file contains hidden or 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 | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:17-alpine | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: closure_tree_test | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
mysql: | |
image: mysql:8 | |
ports: | |
- 3306:3306 | |
env: | |
MYSQL_DATABASE: closure_tree_test | |
MYSQL_ROOT_PASSWORD: root | |
options: >- | |
--health-cmd="mysqladmin ping" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
strategy: | |
fail-fast: false | |
matrix: | |
ruby: | |
- '3.4' | |
rails: | |
- '8.0' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
bundler-cache: true | |
rubygems: latest | |
env: | |
RAILS_VERSION: ${{ matrix.rails }} | |
BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile | |
- name: Setup databases | |
env: | |
RAILS_ENV: test | |
DATABASE_URL_PG: postgres://postgres:[email protected]:5432/closure_tree_test | |
DATABASE_URL_MYSQL: mysql2://root:[email protected]:3306/closure_tree_test | |
DATABASE_URL_SQLITE3: 'sqlite3::memory:' | |
run: | | |
cd test/dummy | |
bundle exec rails db:setup_all | |
- name: Run tests | |
env: | |
RAILS_ENV: test | |
DATABASE_URL_PG: postgres://postgres:[email protected]:5432/closure_tree_test | |
DATABASE_URL_MYSQL: mysql2://root:[email protected]:3306/closure_tree_test | |
DATABASE_URL_SQLITE3: 'sqlite3::memory:' | |
WITH_ADVISORY_LOCK_PREFIX: ${{ github.run_id }} | |
run: | | |
bundle exec rake test |