Skip to content

(B) QTY-14939 Fix flaky specs #610

(B) QTY-14939 Fix flaky specs

(B) QTY-14939 Fix flaky specs #610

Workflow file for this run

# This workflow uses actions that are not certified by GitHub. They are
# provided by a third-party and are governed by separate terms of service,
# privacy policy, and support documentation.
#
# This workflow will install a prebuilt Ruby version, install dependencies, and
# run tests and linters.
name: "rspec"
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "main" ]
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:9-alpine
ports: ['5432:5432']
env:
POSTGRES_DATABASE: postgres
POSTGRES_HOST: localhost
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
RAILS_ENV: test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
# needed because the postgres container does not provide a healthcheck
# tmpfs makes DB faster by using RAM
steps:
# Install local deps if this action is being run locally
- name: Install local dependencies
if: ${{ env.ACT }}
run: |
npm i -g yarn
sudo apt-get update
sudo apt-get -yqq install libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev libasound2 libxshmfence-dev postgresql postgresql-contrib redis-server
- name: Boot local dependencies
if: ${{ env.ACT }}
run: |
sudo service postgresql start
sudo service redis-server start
- name: Configure local dependencies
if: ${{ env.ACT }}
run: |
sudo -u postgres psql -U postgres -d postgres -c "alter user postgres with password 'postgres';"
- uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5.0
bundler-cache: false
- name: Setup DB, Run tests
env:
DATABASE_URL: postgres://postgres:@localhost:5432/test
POSTGRES_HOST: localhost
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
RAILS_ENV: test
SETTINGS_TABLE_PREFIX: settings
run: |
sudo apt-get -yqq install libpq-dev
gem install bundler:2.3.25
bundle install --jobs 4 --retry 3
RAILS_ENV=test bundle exec rails db:setup
RAILS_ENV=test bundle exec rspec