-
Notifications
You must be signed in to change notification settings - Fork 18
266 lines (257 loc) · 8.11 KB
/
ci.yml
File metadata and controls
266 lines (257 loc) · 8.11 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
name: CI
on:
pull_request:
push:
branches:
- main
tags:
- v*.*.*
schedule:
- cron: 14 21 * * *
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
ruleset:
name: Ruleset
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: bazel-contrib/setup-bazel@0.19.0
with:
bazelrc: common --announce_rc --color=yes
repository-cache: true
- run: bazel run :buildifier.check
- run: bazel test --verbose_failures --test_output=errors --test_summary=detailed ...
- if: failure() && runner.debug == '1'
uses: mxschmitt/action-tmate@v3
examples-gem:
name: Examples / Gem
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
ruby:
- 3.2.9
- 3.3.9
- 3.4.6
- 4.0.1
- jruby-10.0.2.0
- truffleruby-33.0.0
- system
os:
- ubuntu-latest
- macos-latest
- windows-latest
mode:
- bzlmod
- WORKSPACE
exclude:
# TruffleRuby doesn't work on Windows.
- os: windows-latest
ruby: truffleruby-33.0.0
defaults:
run:
working-directory: examples/gem
steps:
- uses: actions/checkout@v6
- uses: bazel-contrib/setup-bazel@0.19.0
with:
# Move autoload_externally to .bazelrc once Bazel 6 support is dropped.
bazelrc: common --announce_rc --color=yes --incompatible_autoload_externally= ${{ matrix.mode == 'WORKSPACE' && '--enable_workspace' || '' }}
module-root: examples/gem
# Workaround for long path issues: https://github.com/jruby/jruby/issues/3995.
output-base: ${{ matrix.os == 'windows-latest' && 'D:/b' || '' }}
repository-cache: true
- run: echo ${{ matrix.ruby }} > .ruby-version
- if: matrix.ruby == 'system'
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.9
- run: bazel build ...
- run: bazel run lib/gem:add-numbers 2
- run: bazel run lib/gem:print-version
- run: bazel run "@ruby" "--" -e "puts RUBY_VERSION"
- run: bazel run "@ruby//:bundle" "--" lock
- run: bazel run "@ruby//:gem" "--" info
- run: bazel run "@bundle//bin:rake" "--" --version
- run: bazel run "@bundle//bin:rspec" "--" --help
- run: bazel test ...
- name: Run coverage
if: matrix.os != 'windows-latest'
shell: bash
run: |
bazel coverage //spec:add
COVERAGE_FILE=bazel-testlogs/spec/add/coverage.dat
if ! grep -q "SF:.*lib/gem/add.rb" "$COVERAGE_FILE"; then
echo "Error: Coverage report does not contain expected file coverage"
cat "$COVERAGE_FILE"
exit 1
fi
- name: Upload coverage report
if: matrix.os != 'windows-latest'
uses: actions/upload-artifact@v7
with:
name: coverage-${{ matrix.os }}-${{ matrix.ruby }}-${{ matrix.mode }}
path: examples/gem/bazel-testlogs/spec/add/coverage.dat
- if: failure() && runner.debug == '1'
uses: mxschmitt/action-tmate@v3
examples-jekyll:
name: Examples / Jekyll
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os:
- ubuntu
- macos
defaults:
run:
working-directory: examples/jekyll
steps:
- uses: actions/checkout@v6
- uses: bazel-contrib/setup-bazel@0.19.0
with:
bazelrc: common --announce_rc --color=yes
module-root: examples/jekyll
repository-cache: true
- run: bazel build ...
- if: failure() && runner.debug == '1'
uses: mxschmitt/action-tmate@v3
examples-native_ext:
name: Examples / Native Ext
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
ruby:
- 3.3.9
- jruby-10.0.2.0
use-system-ruby:
- true
- false
defaults:
run:
working-directory: examples/native_ext
steps:
- uses: actions/checkout@v6
- uses: bazel-contrib/setup-bazel@0.19.0
with:
bazelrc: common --announce_rc --color=yes
module-root: examples/native_ext
repository-cache: true
- if: matrix.use-system-ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- run: echo ${{ matrix.use-system-ruby && 'system' || matrix.ruby }} > .ruby-version
- run: bazel build ...
- if: failure() && runner.debug == '1'
uses: mxschmitt/action-tmate@v3
examples-deep-gem:
name: Examples / Deep Gem
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
ruby:
- jruby-10.0.2.0
os:
- ubuntu-latest
- macos-latest
- windows-latest
defaults:
run:
working-directory: examples/deep_gem
steps:
- uses: actions/checkout@v6
- uses: bazel-contrib/setup-bazel@0.19.0
with:
# Move autoload_externally to .bazelrc once Bazel 6 support is dropped.
bazelrc: common --announce_rc --color=yes --incompatible_autoload_externally=
module-root: examples/deep_gem
# Workaround for long path issues: https://github.com/jruby/jruby/issues/3995.
output-base: ${{ matrix.os == 'windows-latest' && 'D:/b' || '' }}
repository-cache: true
- run: echo ${{ matrix.ruby }} > .ruby-version
- if: matrix.ruby == 'system'
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.9
- run: ./do_test
examples-rails:
name: Examples / Rails
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
ruby:
- 3.4.8
os:
- ubuntu-latest
- macos-latest
- windows-latest
defaults:
run:
working-directory: examples/rails
steps:
- uses: actions/checkout@v6
- uses: bazel-contrib/setup-bazel@0.19.0
with:
# Move autoload_externally to .bazelrc once Bazel 6 support is dropped.
bazelrc: common --announce_rc --incompatible_autoload_externally=
module-root: examples/rails
repository-cache: true
- run: echo ${{ matrix.ruby }} > .ruby-version
- run: ./do_test
examples-proto:
name: Examples / Proto
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
ruby:
- 3.4.5
os:
- ubuntu-latest
- macos-latest
# Fails with an error on the grpc gem:
# linking shared-object grpc/grpc_c.so
# D:/_bazel/external/rules_ruby++ruby+ruby/dist/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/15.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
# cannot find -lx64-ucrt-ruby340: No such file or directory
# D:/_bazel/external/rules_ruby++ruby+ruby/dist/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/15.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
# have you installed the static version of the x64-ucrt-ruby340 library ?
# - windows-latest
defaults:
run:
working-directory: examples/proto
steps:
- uses: actions/checkout@v6
- uses: bazel-contrib/setup-bazel@0.19.0
with:
# Move autoload_externally to .bazelrc once Bazel 6 support is dropped.
bazelrc: common --announce_rc --incompatible_autoload_externally=
module-root: examples/proto
repository-cache: true
- run: echo ${{ matrix.ruby }} > .ruby-version
- run: bazel build app
release:
name: Release
if: startsWith(github.ref, 'refs/tags/v')
needs:
- ruleset
- examples-deep-gem
- examples-gem
- examples-jekyll
- examples-native_ext
- examples-rails
uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v7
with:
mount_bazel_caches: false
prerelease: false
release_files: rules_ruby-*.tar.gz