Bump actions/checkout from 3 to 4 #11
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 | |
on: | |
push: | |
branches: | |
- 'master' | |
pull_request: | |
jobs: | |
test: | |
strategy: | |
matrix: | |
database: [ mysql, postgresql ] | |
gemfile: [ '7.0', '6.1', '6.0' ] | |
ruby: [ '2.6', '2.7', '3.0', '3.1' ] | |
exclude: | |
- ruby: '2.6' | |
gemfile: '7.0' | |
fail-fast: false | |
runs-on: ubuntu-latest | |
env: | |
BUNDLE_GEMFILE: gemfiles/Gemfile.rails-${{ matrix.gemfile }}.rb | |
CI: true | |
COVERALLS: true | |
DB: ${{ matrix.database }} | |
MYSQL_PASSWORD: root | |
PGHOST: localhost | |
PGPASSWORD: runner | |
PGUSER: runner | |
RAILS_ENV: test | |
name: ${{ matrix.ruby }} ${{ matrix.database }} rails-${{ matrix.gemfile }} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: sudo apt-get update && sudo apt-get install libsqlite3-dev -y | |
- name: "Set up MySQL using VM's server" | |
if: ${{ env.DB == 'mysql' }} | |
run: | | |
sudo apt-get install libmysqlclient-dev -y | |
sudo systemctl start mysql.service | |
- name: "Set up PostgreSQL using VM's server" | |
if: ${{ env.DB == 'postgresql' }} | |
run: | | |
sudo apt-get install libpq-dev -y | |
sudo systemctl start postgresql.service | |
sudo -u postgres psql -c "CREATE USER runner WITH SUPERUSER PASSWORD 'runner'" | |
sudo -u postgres createdb runner | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
ruby-version: ${{ matrix.ruby }} | |
- run: bundle exec rake db:{create,up} | |
- run: bundle exec rake test |