Skip to content

Working add and delete methods variant id. #361

Working add and delete methods variant id.

Working add and delete methods variant id. #361

Workflow file for this run

name: Test
# triggers on
on: [push]
jobs:
test:
env:
RAILS_ENV: test
NODE_ENV: test
EMAIL: ${{ secrets.EMAIL }}
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}
runs-on: ubuntu-latest # runner
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout repository # copies repo in runner
uses: actions/checkout@v2 # short for https://github.com/actions/checkout
- name: Set up Ruby
uses: ruby/setup-ruby@v1 # short for https://github.com/ruby/setup-ruby
with:
# runs 'bundle install' and caches installed gems automatically
bundler-cache: true
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: "16"
- name: Get Yarn cache directory path
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup cache key and directory for node_modules cache
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Yarn install
run: yarn install --frozen-lockfile
- name: Prepare DB
run: cp config/database.github.yml config/database.yml
- name: List config directory
run: ls config
- name: Print copied database.yml
run: cat config/database.yml
- name: Check PostgreSQL health
run: |
until pg_isready -h localhost -p 5432; do
sleep 2
done
- name: Teardown old database
run: bundle exec rails db:test:purge
- name: Create test database
run: bundle exec rails db:create
- name: Migrate test database
run: bundle exec rails db:migrate
# run: |
# cp config/database.github.yml config/database.yml
# bundle exec rails db:create db:migrate
# - name: Seed test database
# run: bundle exec rails db:seed
# - name: Run model tests
# run: bundle exec rails test:models
- name: Run tests model and controllers
run: bundle exec rails test
- name: Teardown old database for system tests
run: bundle exec rails db:test:purge
- name: Run system tests
run: bundle exec rails test:system
- name: Upload screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
path: tmp/capybara/
- name: Teardown old database at end
run: bundle exec rails db:test:purge