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@v2 - name: Setup Ruby and install gems uses: ruby/setup-ruby@v1 with: bundler-cache: true ruby-version: 3.1 - name: Run linters continue-on-error: true run: bin/rubocop --parallel - name: Run security checks continue-on-error: true run: bin/bundle-audit --update sqlite: runs-on: ubuntu-latest strategy: matrix: ruby: [ 2.7, 3.0, 3.1 ] steps: - name: Checkout uses: actions/checkout@v2 - 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: [ 2.7, 3.0, 3.1 ] 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@v2 - 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:password@127.0.0.1:3306/dummy_test RAILS_ENV: test postgresql: runs-on: ubuntu-latest strategy: matrix: ruby: [2.7, 3.0, 3.1] 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@v2 - 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