-
Notifications
You must be signed in to change notification settings - Fork 46
71 lines (57 loc) · 1.56 KB
/
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
name: Tests
on:
push:
branches:
- main
- tc-gh-actions
pull_request:
jobs:
default:
name: Unit and Integration
if: '! github.event.pull_request.draft'
runs-on: ubuntu-latest
env:
RAILS_ENV: test
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: idiario_test
ports:
- 5432:5432
options:
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 3
redis:
image: redis
ports:
- 6379:6379
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 3
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.4.10'
bundler: '1.17.3'
bundler-cache: true
env:
ImageOS: ubuntu20
- name: Configure database
run: cp config/database.sample.yml config/database.yml
- name: Configure secrets
run: |
echo -e "
test:
secret_key_base: `bundle exec rake secret`
redis_url: redis://localhost:6379
" > config/secrets.yml
- name: Migrate
run: RAILS_ENV=test bundle exec rake db:migrate
- name: Tests
run: bundle exec rspec --exclude-pattern 'spec/acceptance/*.feature'