-
Notifications
You must be signed in to change notification settings - Fork 3
317 lines (268 loc) · 9.58 KB
/
Copy pathci.yaml
File metadata and controls
317 lines (268 loc) · 9.58 KB
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
name: CI
env:
# Database to connect to that can create other databases with `CREATE DATABASE`.
ADMIN_DATABASE_URL: postgres://postgres:postgres@localhost:5432
# Just a common place for steps to put binaries they need and which is added
# to GITHUB_PATH/PATH.
BIN_PATH: /home/runner/bin
# The version of Ruby that non-spec tasks like the build check or lint run
# against. The setup-ruby step must have a version specified, which is why
# this is necessary.
#
# If updating this value, you probably also want to add a new version to the
# spec version matrix below.
RUBY_VERSION: "4.0"
# A suitable URL for a test database.
TEST_DATABASE_NAME: river_test
TEST_DATABASE_URL: postgres://postgres:postgres@127.0.0.1:5432/river_test?sslmode=disable
on:
- push
permissions:
contents: read
jobs:
conformance:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
driver: [sequel, activerecord]
env:
RIVER_CONFORMANCE_DATABASE_URL: postgres://postgres:postgres@127.0.0.1:5432/river_conformance?sslmode=disable
RIVER_CONFORMANCE_DRIVER: ${{ matrix.driver }}
services:
postgres:
image: postgres:17
env:
POSTGRES_DB: river_conformance
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 2s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
- name: Read conformance reference revision
id: reference
run: |
ruby -rjson -e '
revision = JSON.parse(File.read("conformance/reference.json")).fetch("revision")
abort "Invalid River revision" unless /\A[0-9a-f]{40}\z/.match?(revision)
File.open(ENV.fetch("GITHUB_OUTPUT"), "a") { |file| file.puts("revision=#{revision}") }
'
- uses: actions/checkout@v4
with:
repository: riverqueue/river
ref: ${{ steps.reference.outputs.revision }}
path: upstream/river
persist-credentials: false
- uses: actions/setup-go@v5
with:
go-version-file: upstream/river/go.mod
cache-dependency-path: upstream/river/**/go.sum
- name: Required insert-only conformance
run: make test/conformance/insert-only RIVER_PATH="$GITHUB_WORKSPACE/upstream/river"
verify:
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
- name: Read upstream River revision
id: river_revision
run: |
ruby -rjson -e '
revision = JSON.parse(File.read("migration/manifest.json")).fetch("revision")
abort "Invalid River revision" unless /\A[0-9a-f]{40}\z/.match?(revision)
File.open(ENV.fetch("GITHUB_OUTPUT"), "a") { |file| file.puts("revision=#{revision}") }
'
- name: Checkout upstream River
uses: actions/checkout@v4
with:
path: upstream/river
persist-credentials: false
ref: ${{ steps.river_revision.outputs.revision }}
repository: riverqueue/river
- name: Verify migrations
run: make verify RIVER_PATH="$GITHUB_WORKSPACE/upstream/river"
gem_build:
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Ruby + `bundle install`
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Build gem (riverqueue-ruby)
run: gem build riverqueue.gemspec
working-directory: .
- name: Build gem (riverqueue-activerecord)
run: gem build riverqueue-activerecord.gemspec
working-directory: ./driver/riverqueue-activerecord
- name: Build gem (riverqueue-sequel)
run: gem build riverqueue-sequel.gemspec
working-directory: ./driver/riverqueue-sequel
- name: Build gem (riverqueue-rails)
run: gem build riverqueue-rails.gemspec
working-directory: ./rails/riverqueue-rails
lint:
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Ruby + `bundle install`
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Standard Ruby (riverqueue-ruby)
run: bundle exec standardrb
working-directory: .
- name: Frozen string literal comments
run: bundle exec rubocop --config .rubocop-frozen-string-literal.yaml --only Style/FrozenStringLiteralComment
working-directory: .
- name: bundle install (riverqueue-activerecord)
run: bundle install
working-directory: ./driver/riverqueue-activerecord
- name: Standard Ruby (riverqueue-activerecord)
run: bundle exec standardrb
working-directory: ./driver/riverqueue-activerecord
- name: bundle install (riverqueue-sequel)
run: bundle install
working-directory: ./driver/riverqueue-sequel
- name: Standard Ruby (riverqueue-sequel)
run: bundle exec standardrb
working-directory: ./driver/riverqueue-sequel
tool_versions_check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check RUBY_VERSION matches .tool-versions Ruby version
run: |
cat <<- "EOF" | ruby
ruby_env = ENV["RUBY_VERSION"] || abort("need RUBY_VERSION")
ruby_tool_versions = File.read('.tool-versions').split('\n')[0].split[1]
if ruby_env != ruby_tool_versions
abort("CI version $RUBY_VERSION ${ruby_env } should match .tool-versions Ruby ${ruby_tool_versions }")
end
EOF
# run: |
# [[ "$RUBY_VERSION" == "$(cat .tool-versions | grep ruby | cut -w -f 2)" ]] || echo "CI version \$RUBY_VERSION should match .tool-versions Ruby `cat .tool-versions | grep ruby | cut -w -f 2`" && (exit 1)
type_check:
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Ruby + `bundle install`
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Steep (riverqueue-ruby)
run: bundle exec steep check
working-directory: .
spec:
runs-on: ubuntu-latest
timeout-minutes: 3
strategy:
matrix:
# If adding a value, you probably also want to update the default
# RUBY_VERSION for non-spec jobs above.
ruby_version:
- "3.2"
- "3.3"
- "3.4"
- "4.0"
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 2s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Ruby + `bundle install`
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Create database
run: psql --echo-errors --quiet -c '\timing off' -c "CREATE DATABASE ${TEST_DATABASE_NAME};" ${ADMIN_DATABASE_URL}
- name: Rspec (riverqueue-ruby)
run: bundle exec rspec
working-directory: .
- name: bundle install (riverqueue-activerecord)
run: bundle install
working-directory: ./driver/riverqueue-activerecord
- name: Rspec (riverqueue-activerecord)
run: bundle exec rspec
working-directory: ./driver/riverqueue-activerecord
- name: bundle install (riverqueue-sequel)
run: bundle install
working-directory: ./driver/riverqueue-sequel
- name: Rspec (riverqueue-sequel)
run: bundle exec rspec
working-directory: ./driver/riverqueue-sequel
rails:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
include:
- rails: "~> 7.2.0"
ruby: "3.2"
- rails: "~> 8.0.0"
ruby: "3.3"
- rails: "~> 8.1.0"
ruby: "4.0"
env:
BUNDLE_FROZEN: "false"
RAILS_VERSION: ${{ matrix.rails }}
RIVER_REQUIRE_DATABASES: "1"
services:
postgres:
image: postgres:17
env:
POSTGRES_DB: river_test
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 2s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- run: bundle install
working-directory: ./rails/riverqueue-rails
- run: bundle exec rspec
working-directory: ./rails/riverqueue-rails
- run: bundle exec standardrb
working-directory: ./rails/riverqueue-rails