Skip to content

Merge branch 'release-70' into release-71 #2141

Merge branch 'release-70' into release-71

Merge branch 'release-70' into release-71 #2141

Workflow file for this run

name: Rails Tests
on:
push:
branches:
- '*'
- '**/*'
concurrency:
group: ${{ github.ref }}-tests
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-20.04
# Docker Hub image that the job executes in
container: ruby:3.1.6-alpine3.20
# Service containers to run with job
services:
postgres:
image: postgres:13-alpine
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_PASS: postgres
POSTGRES_MULTIPLE_EXTENSIONS: hstore
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:alpine
ports:
- 6379:6379
env:
DATABASE_WAREHOUSE_DB_TEST: test_hmis_warehouse
DATABASE_DB_TEST: boston_cas_test
steps:
- name: Install git
run: |
apk add --no-cache git
- name: Checkout
uses: actions/checkout@v4
- name: Set up dependencies
run: |
apk add --no-cache $(cat .github/dependencies.txt)
echo "postgres:5432:*:postgres:postgres" > ~/.pgpass
chmod 600 ~/.pgpass
yarn install --frozen-lockfile
- name: cache gems
uses: actions/cache@v4
id: gemcache
with:
path: |
vendor/bundle
/usr/local/bundle/
key: ${{ runner.os }}-gemcache-${{ hashFiles('**/Gemfile.lock') }}-${{ hashFiles('**/.ruby-version') }}
- name: Install gems
run: |
gem install bundler --version=2.5.17
bundle config set --local without 'production staging development'
bundle install --jobs 4 --retry 3
- name: 'App setup'
run: |
cp config/secrets.yml.sample config/secrets.yml
mkdir app/assets/stylesheets/theme/styles
touch app/assets/stylesheets/theme/styles/_variables.scss
cp .rspec.travis .rspec
- name: Prepare test db
env:
RAILS_ENV: test
DATABASE_ADAPTER: postgresql
DATABASE_DB_TEST: boston_cas_test
DATABASE_HOST: postgres
DATABASE_PASS: postgres
DATABASE_USER: postgres
PGPASSWORD: postgres
DEFAULT_FROM: [email protected]
DATABASE_WAREHOUSE_DB_TEST: test_hmis_warehouse
HOSTNAME: openpath.host
PORT: 80
run: |
bundle exec rake db:drop db:create db:schema:load
createdb -h $DATABASE_HOST -U $DATABASE_USER $DATABASE_WAREHOUSE_DB_TEST
bundle exec rake assets:precompile
- name: Run tests
env:
RAILS_ENV: test
DATABASE_ADAPTER: postgresql
DATABASE_HOST: postgres
DATABASE_PASS: postgres
DATABASE_USER: postgres
DATABASE_DB_TEST: boston_cas_test
DEFAULT_FROM: [email protected]
DATABASE_WAREHOUSE_DB_TEST: test_hmis_warehouse
HOSTNAME: openpath.host
FQDN: openpath.host
PORT: 80
run: |
bundle exec rspec