feat: ✨ add seeds #30
This file contains hidden or 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: Run Tests | |
on: [push, pull_request] | |
jobs: | |
run-tests: | |
name: Run Tests | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_DB: ruby-grape-clean-api | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
strategy: | |
matrix: | |
node-version: [21] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Use Ruby 3.3.0 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.3.0 | |
bundler-cache: true | |
- name: Clean Bundler cache | |
run: bundle clean --force | |
- name: Install dependencies | |
run: | | |
bundle install | |
npm ci # usa o package-lock.json para evitar problemas de cache | |
env: | |
NODE_ENV: test | |
- name: Run Migrations | |
run: bundle exec ruby ./src/main/config/migrations.rb | |
env: | |
DRIVER: postgres | |
POSTGRES_DB: ruby-grape-clean-api | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_HOST: localhost | |
POSTGRES_PORT: 5432 | |
- name: Run Seeds | |
run: bundle exec ruby ./src/infrastructure/db/seeds.rb | |
env: | |
DRIVER: postgres | |
POSTGRES_DB: ruby-grape-clean-api | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_HOST: localhost | |
POSTGRES_PORT: 5432 | |
- name: Run RSpec tests with coverage | |
run: COVERAGE=true bundle exec rspec --format documentation --color | |
env: | |
DRIVER: postgres | |
POSTGRES_DB: ruby-grape-clean-api | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_HOST: localhost | |
POSTGRES_PORT: 5432 | |
- name: Run Coveralls | |
uses: coverallsapp/github-action@v2 |