Set RAILS_ENV
variable to test
in CI
#12
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, pull_request] | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
# Service containers to run | |
services: | |
# Label used to access the service container | |
postgres: | |
image: postgres:16.1 | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_USER: app | |
POSTGRES_PASSWORD: dev | |
POSTGRES_DB: test | |
env: | |
DATABASE_URL: postgresql://app:dev@localhost:5432/development?pool=5 | |
RAILS_ENV: test | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
# Run `bundle install` and cache all installed gems automatically | |
bundler-cache: true | |
- name: Install package dependencies using Bundler | |
run: bundle install | |
- name: Run RuboCop | |
run: bundle exec rubocop --parallel | |
continue-on-error: true | |
- name: Create database and run seed code | |
run: bundle exec rails db:create db:migrate db:seed | |
env: | |
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} | |
- name: Run tests | |
run: bundle exec rake | |
env: | |
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} |