From a15fd0d9041091b552652c2668c1f0fa4c79a5b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serge=20H=C3=A4nni?= Date: Fri, 30 Sep 2022 18:55:03 +0200 Subject: [PATCH] Add test runner on CI --- .github/workflows/run_tests.yml | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/run_tests.yml diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml new file mode 100644 index 0000000..c5ac289 --- /dev/null +++ b/.github/workflows/run_tests.yml @@ -0,0 +1,49 @@ +name: Run all tests + +on: [push] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + backend-services: + runs-on: ubuntu-latest + services: + postgres: + image: postgres:14-alpine + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + env: + POSTGRES_PASSWORD: postgres + ports: + - 5432:5432 + steps: + - name: Pull repository + uses: actions/checkout@v3 + + - name: Bundle install and cache result + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Run Ruby lint + run: bundle exec standardrb + + - name: Run rspec + run: | + bundle exec rails db:create + bundle exec rails db:schema:load >/dev/null + RAILS_ENV=test bundle exec rails assets:precompile + bundle exec rails spec + + - name: Upload screenshots of failures + uses: actions/upload-artifact@v3.1.0 + if: ${{ failure() }} + with: + name: capybara-screenshots-${{ github.sha }} + path: tmp/capybara/screenshot_* + retention-days: 30