first steps to add before action #1442
Workflow file for this run
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: Rails | |
on: [push, pull_request] | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
env: | |
PGHOST: localhost | |
POSTGRES_DB: skills_test | |
POSTGRES_USER: skills | |
POSTGRES_PASSWORD: skills | |
services: | |
postgres: | |
image: postgres:16 | |
ports: ["5432:5432"] | |
env: | |
POSTGRES_DB: ${{ env.POSTGRES_DB }} | |
POSTGRES_USER: ${{ env.POSTGRES_USER }} | |
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: 'Run database migrations' | |
env: | |
RAILS_ENV: test | |
PGHOST: ${{ env.PGHOST }} | |
POSTGRES_DB: ${{ env.POSTGRES_DB }} | |
POSTGRES_USER: ${{ env.POSTGRES_USER }} | |
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
run: | | |
bundle exec rake db:create db:migrate | |
- name: 'Run tests' | |
env: | |
PGHOST: ${{ env.PGHOST }} | |
POSTGRES_DB: ${{ env.POSTGRES_DB }} | |
POSTGRES_USER: ${{ env.POSTGRES_USER }} | |
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
IS_CI: true | |
run: bundle exec rake | |
- name: 'Run RuboCop' | |
run: bundle exec rubocop --parallel |