name: Tests on: pull_request: branches: - '*' push: branches: - master - rails-7 jobs: sqlite: runs-on: ubuntu-latest strategy: matrix: ruby: ['2.7', '3.0', '3.1'] gemfile: - rails6.0 - rails6.1 - rails7 - rails_main env: BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile BUNDLE_PATH_RELATIVE_TO_CWD: true steps: - uses: actions/checkout@v3 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler: default bundler-cache: true rubygems: latest - name: Run tests env: DATABASE_URL: "sqlite3:test" RAILS_ENV: test run: | bundle exec rspec postgres: runs-on: ubuntu-latest strategy: matrix: ruby: ['2.7', '3.0', '3.1'] gemfile: - rails6.0 - rails6.1 - rails7 - rails_main env: BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile BUNDLE_PATH_RELATIVE_TO_CWD: true services: postgres: image: postgres:12 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: password POSTGRES_DB: test ports: ['5432:5432'] steps: - uses: actions/checkout@v3 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler: default bundler-cache: true rubygems: latest - name: Run tests env: DATABASE_URL: postgres://postgres:password@localhost:5432/test RAILS_ENV: test run: | bundle exec rails db:test:prepare bundle exec rails test