-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (76 loc) · 2.08 KB
/
test.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
name: Test
on:
push:
branches:
- develop
jobs:
test:
runs-on: ubuntu-latest
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2
env:
STACK_VERSION: 7.17.1
xpack.security.enabled: false
cluster.name: beckett-elasticsearch
http.port: 9200
discovery.type: single-node
options: >-
--health-cmd "curl http://localhost:9200/_cluster/health"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 9200:9200
postgres:
image: postgres:10
env:
POSTGRES_PASSWORD: password
POSTGRES_USER: user
POSTGRES_DB: beckett_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
- name: Setup cache key and directory for gems cache
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-use-ruby-${{ hashFiles('**/Gemfile.lock') }}
- name: Install system requirements
run: |
sudo apt update
sudo apt install -y postgresql-client
- name: Bundle Install
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Test with RSpec
id: rspec
env:
RAILS_ENV: test
DB_USERNAME: user
DB_HOSTNAME: localhost
DB_PASSWORD: password
DB_NAME: beckett_test
run: |
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rspec spec/