From 054757f90802143a3ce7dca0c6543bb65571992c Mon Sep 17 00:00:00 2001 From: Felipe Andrade Date: Tue, 19 Nov 2024 00:58:06 -0300 Subject: [PATCH] ci: fix cucumber tests --- .github/workflows/ci.yml | 55 +++++++++++++++++++++--------- config/.gitkeep | 0 config/database.yml.github-actions | 8 ----- 3 files changed, 39 insertions(+), 24 deletions(-) create mode 100644 config/.gitkeep delete mode 100644 config/database.yml.github-actions diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00a3072..60087c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,41 +15,64 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: [2.6, 2.7, 3.0] + ruby-version: [2.6, 2.7] services: postgres: - image: postgres:12.1-alpine + image: postgres:15 ports: - 5432:5432 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + POSTGRES_HOST_AUTH_METHOD: trust + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 steps: - name: Checkout Project - uses: actions/checkout@v3 - + uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true - + cache-version: 1 - name: Install Library Dependencies run: sudo apt-get install libpq-dev - - name: Setup Database - run: | - cp config/database.yml.github-actions config/database.yml env: - RAILS_ENV: test - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - + PGHOST: localhost + PGPORT: 5432 + PGDATABASE: prodder__blog_prod + PGUSER: postgres + PGPASSWORD: postgres + run: | + cat < config/database.yml + test: + adapter: postgresql + encoding: unicode + pool: 20 + database: prodder__blog_prod + migration_user: prodder + EOF + createuser --createrole --createdb prodder - name: Test with RSpec env: - RAILS_ENV: "test" - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres + PGHOST: localhost + PGPORT: 5432 + PGDATABASE: prodder__blog_prod + PGUSER: postgres + PGPASSWORD: postgres run: | bundle exec rspec + - name: Test with Cucumber + env: + PGHOST: localhost + PGPORT: 5432 + PGDATABASE: prodder__blog_prod + PGUSER: postgres + PGPASSWORD: postgres + run: | + bundle exec cucumber diff --git a/config/.gitkeep b/config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/config/database.yml.github-actions b/config/database.yml.github-actions deleted file mode 100644 index 0724691..0000000 --- a/config/database.yml.github-actions +++ /dev/null @@ -1,8 +0,0 @@ -test: - adapter: postgresql - host: localhost - encoding: unicode - database: github-actions - pool: 20 - username: <%= ENV["POSTGRES_USER"] %> - password: <%= ENV["POSTGRES_PASSWORD"] %>