Merge pull request #21 from Meri-MG/rubocop-ci #2
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: Models and Controllers | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:11 | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_DB: rails_test | |
POSTGRES_USER: rails | |
POSTGRES_PASSWORD: password | |
env: | |
RAILS_ENV: test | |
DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test" | |
POSTGRES_USER: rails | |
POSTGRES_PASSWORD: password | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Ruby and gems | |
uses: ruby/setup-ruby@78c01b705fd9d5ad960d432d3a0cfa341d50e410 # v1.179.1 | |
with: | |
bundler-cache: true | |
- name: Setup Database | |
run: | | |
bundle exec rake db:create | |
bundle exec rake db:schema:load | |
- name: Model tests | |
run: COVERAGE=models bundle exec rails test:models | |
- name: Controller tests | |
run: COVERAGE=controllers bundle exec rails test:controllers |