Merge pull request #23 from shkm/ruby-versions #44
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: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Ruby and install gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
ruby-version: 3.3 | |
- name: Run linters | |
continue-on-error: true | |
run: bundle exec rubocop --parallel | |
- name: Run security checks | |
continue-on-error: true | |
run: bundle exec bundle-audit --update | |
sqlite: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
ruby: [ 3.1, 3.2, 3.3 ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Ruby and install gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
ruby-version: ${{ matrix.ruby }} | |
- name: Run tests | |
run: | | |
(cd test/dummy && bin/rails db:setup) | |
bin/test | |
env: | |
DATABASE_URL: sqlite3:dummy_test | |
RAILS_ENV: test | |
mariadb: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
ruby: [ 3.1, 3.2, 3.3 ] | |
services: | |
mariadb: | |
image: mariadb:10.7 | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: dummy_test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Ruby and install gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
ruby-version: ${{ matrix.ruby }} | |
- name: Run tests | |
run: | | |
(cd test/dummy && bin/rails db:setup) | |
bin/test | |
env: | |
DATABASE_URL: mysql2://root:[email protected]:3306/dummy_test | |
RAILS_ENV: test | |
postgresql: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
ruby: [3.1, 3.2, 3.3] | |
services: | |
postgres: | |
image: postgres:14 | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
env: | |
POSTGRES_DB: dummy_test | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: password | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Ruby and install gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
ruby-version: ${{ matrix.ruby }} | |
- name: Run tests | |
run: | | |
(cd test/dummy && bin/rails db:setup) | |
bin/test | |
env: | |
DATABASE_URL: postgres://postgres:password@localhost:5432/dummy_test | |
RAILS_ENV: test | |
- name: Upload coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
verbose: true |