From 02ec2c7be7390917f2db1a3d5816488baad8e306 Mon Sep 17 00:00:00 2001 From: Fabiano Santos Florentino Date: Sun, 3 Mar 2024 12:28:06 -0300 Subject: [PATCH] Add unit test workflow configuration --- .github/workflows/unit_tests.yml | 64 ++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/unit_tests.yml diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml new file mode 100644 index 0000000..d782030 --- /dev/null +++ b/.github/workflows/unit_tests.yml @@ -0,0 +1,64 @@ +--- +name: Unit Tests + +on: + push: + branches: + - main + - development + pull_request: + branches: + - main + - development + +jobs: + rspec: + name: Unit Tests with RSepc + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + env: + RAILS_ENV: development + RAILS_MAX_THREADS: 2 + WEB_CONCURRENCY: 2 + PGPASSFILE: /app/.pgpass + POSTGRES_PASSWORD: ephermeral_exists_during_tests + POSTGRES_USER: admin + POSTGRES_DB: blackpearl + POSTGRES_PORT: '5432' + POSTGRES_MAX_CONNECTIONS: '30' + POSTGRES_RANDOM_PAGE_COST: '1.1' + POSTGRES_EFFECTIVE_IO_CONCURRENCY: '30' + services: + postgres: + image: postgres:latest + env: + POSTGRES_USER: admin + POSTGRES_PASSWORD: ephermeral_exists_during_tests + POSTGRES_DB: blackpearl + ports: + - 5432:5432 + options: --health-cmd pg_isready --health-interval 5s --health-timeout 5s --health-retries 3 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Dependences + run: | + sudo apt-get update -y + sudo apt-get install -y libpq-dev postgresql-client build-essential libssl-dev + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.0.0 + + - name: Bundle Install + run: bundle install + + - name: Database Setup + run: bundle exec rails db:migrate + + - name: Run RSpec + run: bundle exec rspec