From 3a6091b04053f423af3d9d3672e5ee0d95f9238a Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Fri, 6 Dec 2024 10:51:07 +0000 Subject: [PATCH] Revert "Try keeping services in Tests" This reverts commit ef2e1bf4d255ed9a4bf87abda2b4d2b33787d406. --- .github/workflows/run_tests.yml | 60 ++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 10dd83d6c..b958b5fa9 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -71,7 +71,7 @@ jobs: - name: Run tests run: | - bundle exec rake parallel:spec['spec\/(?!features|models|requests)'] + bundle exec rake parallel:spec['spec\/(?!features|models|requests|services)'] feature_test: name: Feature Tests @@ -248,6 +248,64 @@ jobs: run: | bundle exec rake parallel:spec['spec/requests'] + services_test: + name: Services Tests + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:13.5 + env: + POSTGRES_PASSWORD: password + POSTGRES_USER: postgres + POSTGRES_DB: data_collector + ports: + - 5432:5432 + # Needed because the Postgres container does not provide a health check + # tmpfs makes database faster by using RAM + options: >- + --mount type=tmpfs,destination=/var/lib/postgresql/data + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + env: + RAILS_ENV: test + GEMFILE_RUBY_VERSION: 3.1.1 + DB_HOST: localhost + DB_DATABASE: data_collector + DB_USERNAME: postgres + DB_PASSWORD: password + RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + cache: yarn + node-version: 20 + + - name: Create database + run: | + bundle exec rake db:prepare + + - name: Compile assets + run: | + bundle exec rake assets:precompile + + - name: Run tests + run: | + bundle exec rake parallel:spec['spec\/services'] + accessibility_test: name: Accessibility tests runs-on: ubuntu-latest