-
Notifications
You must be signed in to change notification settings - Fork 79
193 lines (188 loc) · 5.16 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
---
name: Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
concurrency:
group: ${{ github.ref }}-test
cancel-in-progress: true
jobs:
semian:
name: Ruby ${{ matrix.ruby }} / semian
runs-on: ubuntu-latest
container:
image: ruby:${{ matrix.ruby }}
ports:
- 31150:31050
- 31050:31050
# NOTE: Container required be accessed by hostname semian,
# because upstream to toxiproxy should have access
# to the same container
options: --hostname semian
env:
CI: "1"
BUNDLE_GEMFILE: Gemfile
strategy:
fail-fast: true
matrix:
ruby:
- "3.2"
- "3.1"
- "3.0"
- "2.7"
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5
redis:
image: redis
options: >-
--health-cmd="redis-cli ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5
toxiproxy:
image: ghcr.io/shopify/toxiproxy:2.5.0
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Cache
uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-ruby-${{ matrix.ruby }}-gems-${{ hashFiles( format('{0}.lock', env.BUNDLE_GEMFILE) ) }}
restore-keys: |
${{ runner.os }}-ruby-${{ matrix.ruby }}-gems-
-
name: Bundle
run: |
bundle config path vendor/bundle
bundle install
-
name: Build C extension
run: bundle exec rake build
-
name: Tests
run: |
bundle exec rake test:semian ||
(echo "===== Retry Attempt: 2 ====" && bundle exec rake test:semian) || \
(echo "===== Retry Attempt: 3 ====" && bundle exec rake test:semian)
-
name: Examples
env:
MYSQL_HOST: mysql
run: |
bundle exec rake examples
adapters:
name: Ruby ${{ matrix.ruby }} / ${{ matrix.gemfile }}
runs-on: ubuntu-latest
container:
image: ruby:${{ matrix.ruby }}
ports:
- 31150:31050
- 31050:31050
# NOTE: Container required be accessed by hostname semian,
# because upstream to toxiproxy should have access
# to the same container
options: --hostname semian
env:
CI: "1"
SEED: 58485
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategy
strategy:
fail-fast: false
matrix:
ruby:
- "3.2"
- "3.1"
- "3.0"
- "2.7"
gemfile:
- grpc
- mysql2
- net_http
- rails_mysql2
- rails_trilogy
- redis_4
- redis_5
- redis_client
- activerecord_trilogy_adapter
include:
- gemfile: grpc
adapter: grpc
- gemfile: mysql2
adapter: mysql2
- gemfile: net_http
adapter: net_http
- gemfile: rails_mysql2
adapter: rails_mysql2
- gemfile: rails_trilogy
adapter: rails_trilogy
- gemfile: redis_4
adapter: redis
- gemfile: redis_5
adapter: redis
- gemfile: redis_client
adapter: redis_client
- gemfile: activerecord_trilogy_adapter
adapter: activerecord_trilogy_adapter
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5
redis:
image: redis
options: >-
--health-cmd="redis-cli ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5
toxiproxy:
image: ghcr.io/shopify/toxiproxy:2.5.0
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Cache
uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-ruby-${{ matrix.ruby }}-adapter-${{ matrix.gemfile }}-gems-${{ hashFiles( format('{0}.lock', env.BUNDLE_GEMFILE) ) }}
restore-keys: |
${{ runner.os }}-ruby-${{ matrix.ruby }}-adapter-${{ matrix.gemfile }}-gems-
-
name: Bundle
run: |
bundle config path vendor/bundle
bundle install
-
name: Build C extension
run: |
bundle config path vendor/bundle
bundle exec rake build
-
name: Tests
env:
TEST: test/adapters/${{ matrix.adapter }}_test.rb
run: |
bundle exec rake test || \
(echo "===== Retry Attempt: 2 ====" && bundle exec rake test) || \
(echo "===== Retry Attempt: 3 ====" && bundle exec rake test)