cassiosantana / pages_ahead

Pages Ahead é uma editora de livros. Com ela podemos gerenciar as partes envolvidas no processo de criação de livros onde temos Autores, Livros, Montagens, Partes, Fornecedores e Contas.
https://pages-ahead.onrender.com
MIT License
1 stars 0 forks source link

Update GitHub Workflow #185

Closed cassiosantana closed 1 year ago

cassiosantana commented 1 year ago

The current GitHub Workflow configuration file (.yml) is set up for SQLite3. After changing our database to PostgreSQL, we need to update this configuration file so the test run will work correctly. This will involve modifying the database setup step and adding any necessary PostgreSQL dependencies.

cassiosantana commented 1 year ago
name: Run tests

on: [push, pull_request]

jobs:
  build:

    runs-on: ubuntu-latest

    services:
      postgres:
        image: postgres:14
        env:
          POSTGRES_PASSWORD: postgres
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s 
          --health-retries 5
        ports:
          - 5432:5432

    steps:
      - uses: actions/checkout@v2
      - name: Set up Ruby 3.2.2
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.2.2

      - name: Install dependencies
        run: |
          gem install bundler
          bundle install --jobs 4 --retry 3

      - name: Setup test database
        env:
          RAILS_ENV: test
          DATABASE_URL: postgres://postgres:postgres@localhost:5432/test
        run: |
          bundle exec rails db:create
          bundle exec rails db:schema:load

      - name: Run tests
        env:
          RAILS_ENV: test
        run: bundle exec rspec