-
Notifications
You must be signed in to change notification settings - Fork 6
111 lines (101 loc) · 3.18 KB
/
rails_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Rails Tests
on:
push:
branches:
- '*'
- '**/*'
concurrency:
group: ${{ github.ref }}-tests
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-22.04
# Docker Hub image that the job executes in
container: ruby:3.4.1-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