add supported rails versions to ci #65
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 | |
| concurrency: | |
| group: ${{github.workflow}}-${{github.event.pull_request.number || github.ref}} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| database: ['sqlite', 'postgres', 'mysql', 'mariadb'] | |
| gemfile: ['rails_7_0', 'rails_7_1', 'rails_7_2', 'rails_8_0', 'rails_edge'] | |
| ruby: ['3.4', '3.3', '3.2'] | |
| services: | |
| postgres: | |
| image: postgres:15 | |
| ports: | |
| - 5432:5432 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: test | |
| mysql: | |
| image: mysql:8.0 | |
| ports: | |
| - 3306:3306 | |
| env: | |
| MYSQL_ROOT_PASSWORD: root | |
| MYSQL_DATABASE: test | |
| mariadb: | |
| image: 'mariadb:11' | |
| env: | |
| MARIADB_ROOT_PASSWORD: root | |
| MARIADB_DATABASE: test | |
| # https://github.com/MariaDB/mariadb-docker/issues/497 | |
| options: >- | |
| --health-cmd="mariadb-admin ping" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=5 | |
| ports: | |
| - 3307:3306 # avoid conflict w/ mysql | |
| env: | |
| BUNDLE_GEMFILE: ${{github.workspace}}/gemfiles/${{matrix.gemfile}}.gemfile | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{matrix.ruby}} | |
| bundler-cache: true | |
| - name: Setup database | |
| run: | | |
| case ${{matrix.database}} in | |
| sqlite) | |
| echo "DATABASE_URL=sqlite3::memory:" >> $GITHUB_ENV | |
| ;; | |
| postgres) | |
| echo "DATABASE_URL=postgres://postgres:postgres@localhost/test" >> $GITHUB_ENV | |
| ;; | |
| mysql) | |
| echo "DATABASE_URL=mysql2://root:[email protected]/test" >> $GITHUB_ENV | |
| ;; | |
| mariadb) | |
| echo "DATABASE_URL=mysql2://root:[email protected]:3307/test" >> $GITHUB_ENV | |
| ;; | |
| esac | |
| - name: Test | |
| run: bundle exec rake test | |
| # sqlite is not supported yet because it doesn't support | |
| # the union syntax we're using (and we don't consider | |
| # failures for unreleased rails versions a blocker) | |
| continue-on-error: ${{matrix.database == 'sqlite' || matrix.gemfile == 'rails_edge'}} |