Add env var to run specs only for one database #1
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: RSpec | |
on: | |
push: | |
branches: | |
- development | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened] | |
release: | |
types: [published] | |
jobs: | |
test: | |
name: rails / rspec | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
ruby_version: | |
- 3.1 | |
- 3.2 | |
- 3.3 | |
- jruby | |
rails_version: | |
- 6_1 | |
- 7_0 | |
- 7_1 | |
- 7_2 | |
# - master # versions failing | |
exclude: | |
- ruby_version: jruby | |
rails_version: 7_1 | |
- ruby_version: jruby | |
rails_version: 7_2 | |
env: | |
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.rails_version }}.gemfile | |
CI: true | |
services: | |
postgres: | |
image: postgres:14 # pg_dump tests currently depend on this version | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_HOST_AUTH_METHOD: trust | |
POSTGRES_DB: apartment_postgresql_test | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: true | |
MYSQL_DATABASE: apartment_mysql_test | |
options: >- | |
--health-cmd "mysqladmin ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 3306:3306 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Ruby ${{ matrix.ruby-version }} | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby_version }} | |
bundler-cache: true | |
- name: Configure config database.yml | |
run: bundle exec rake db:copy_credentials | |
- name: Database Setup | |
run: bundle exec rake db:test:prepare | |
- name: Run tests | |
run: bundle exec rspec --format progress --format RspecJunitFormatter -o ~/test-results/rspec/rspec.xml |