From ee46e0fc9c29783fbdb4bad1bd026c61ff274c5f Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Fri, 12 Jul 2024 15:11:24 +0200 Subject: [PATCH] Configure unit tests in CICD --- .github/workflows/tests.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..30b9997 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,34 @@ +name: Run unit tests +on: + push: + branches: + - main + pull_request: +jobs: + unit_tests: + runs-on: ubuntu-latest + services: + postgres: + image: postgres + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432 + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - uses: ruby/setup-ruby@v1 + - run: bundle install + - run: | + bundle exec rake db:create db:schema:load + bundle exec rspec + env: + RAILS_ENV: test + DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres