-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.cirrus.yaml
More file actions
256 lines (193 loc) · 6.36 KB
/
.cirrus.yaml
File metadata and controls
256 lines (193 loc) · 6.36 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
unix_bundle_cache: &unix_bundle_cache
bundle_cache:
folder: vendor/bundle
fingerprint_script:
- echo $CIRRUS_OS
- ruby -v
- cat Gemfile
- cat *.gemspec
bundle_install_script:
- bundle config set --local path 'vendor/bundle'
- bundle update
unix_codecov: &unix_codecov
codecov_uploader_cache:
folder: codecov
fingerprint_script:
- curl -s https://uploader.codecov.io/latest/${CODECOV_OS}/codecov.SHA256SUM
populate_script:
- mkdir -p codecov
- curl -s https://uploader.codecov.io/latest/${CODECOV_OS}/codecov -o codecov/uploader
- chmod +x codecov/uploader
codecov_script: codecov/uploader
only_if_test_changes: &only_if_test_changes
($CIRRUS_BRANCH == 'main') ||
changesInclude(
'.cirrus.yaml', '.gitignore', 'Gemfile', '.toys.rb', '.rspec', '*.gemspec', 'lib/**',
'spec/**'
)
env:
## To suppress flood of warnings:
## https://github.com/cirruslabs/cirrus-ci-docs/issues/814
## https://github.com/rubygems/rubygems/issues/4466#issuecomment-818688569
## Global for:
## 1. different tasks (rubocop, test, etc.);
## 2. avoiding overriding `env` in specific cases like macOS.
TMPDIR: $CIRRUS_WORKING_DIR
remark_task:
container:
image: node
node_modules_cache:
folder: node_modules
fingerprint_script:
- echo $CIRRUS_OS
- node -v
- cat package.json
install_script: npm install
lint_script: npm run remark
only_if: ($CIRRUS_BRANCH == 'main') ||
changesInclude(
'.cirrus.yaml', '.gitignore', 'package.json', '.remarkrc.yaml', '**.md'
)
bundle-audit_task:
container:
image: ruby
install_script:
- gem install bundler
<<: *unix_bundle_cache
audit_script: bundle exec bundle-audit check --update
only_if: ($CIRRUS_BRANCH == 'main') ||
changesInclude(
'.cirrus.yaml', '.gitignore', 'Gemfile', '*.gemspec'
)
rubocop_task:
container:
image: ruby:latest
install_script:
- gem install bundler
<<: *unix_bundle_cache
lint_script: bundle exec rubocop
only_if: ($CIRRUS_BRANCH == 'main') ||
changesInclude(
'.cirrus.yaml', '.gitignore', 'Gemfile', '.rubocop.yml', '*.gemspec', '**.rb'
)
test_mri_task:
name: Test on MRI
container:
matrix:
image: ruby:3.2
image: ruby:3.3
image: ruby:3.4
image: ruby:4.0
env:
CODECOV_OS: linux
os_prepare_script:
- gem update --system --no-document
- gem install bundler --no-document
<<: *unix_bundle_cache
test_script: bundle exec rspec
<<: *unix_codecov
only_if: *only_if_test_changes
test_jruby_task:
name: Test on JRuby
container:
image: jruby:latest
env:
CODECOV_OS: linux
os_prepare_script:
- apt-get update
- apt-get install -y build-essential
- gem update --system --no-document
- gem install bundler --no-document
<<: *unix_bundle_cache
test_script: bundle exec rspec
<<: *unix_codecov
only_if: *only_if_test_changes
test_truffle_task:
name: Test on Truffle Ruby
container:
image: ghcr.io/graalvm/truffleruby-community:latest
env:
CODECOV_OS: linux
os_prepare_script:
- gem update --system --no-document
- gem install bundler --no-document
<<: *unix_bundle_cache
test_script: bundle exec rspec
only_if: *only_if_test_changes
test_macos_task:
name: Test on macOS
macos_instance:
image: ghcr.io/cirruslabs/macos-runner:sonoma
env:
CODECOV_OS: macos
ruby_cache:
## `/opt/homebrew/opt/ruby` is a symlink, and Cirrus CI can't cache it properly
folder: /opt/homebrew/Cellar/ruby
fingerprint_script:
- echo $CIRRUS_OS
- brew info --json=v2 ruby | jq -r '.formulae[0].versions.stable'
populate_script:
## Brew is pre-installed, as described in the CI docs:
## https://cirrus-ci.org/guide/macOS/#list-of-available-images
# - bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
- brew install ruby
- gem update --system --no-document
- gem install bundler --no-document
<<: *unix_bundle_cache
test_script: bundle exec rspec
<<: *unix_codecov
only_if: *only_if_test_changes
test_windows_task:
name: Test on Windows
windows_container:
image: cirrusci/windowsservercore:2019
env:
## It's better to pre-define here instead of `refreshenv`:
## https://cirrus-ci.org/guide/windows/#environment-variables
RUBY_PATH: C:\tools\ruby
MSYS2_PATH: C:\tools\msys2
PATH: $MSYS2_PATH;$RUBY_PATH\bin;$PATH
CIRRUS_SHELL: powershell
ruby_cache:
folder: C:\tools\ruby
fingerprint_script:
- echo $Env:CIRRUS_OS
## `--limit-output` to try rid off extra information and avoid cache miss:
## https://cirrus-ci.com/task/5913496480120832?logs=ruby#L11-L13
- choco search --exact "ruby" --limit-output
populate_script:
## Cirrus CI has Chocolatey pre-installed 😍:
## https://cirrus-ci.org/guide/windows/#chocolatey
## https://community.chocolatey.org/packages/ruby#notes
- choco install msys2 -y --no-progress --params "/NoPath /InstallDir:$Env:MSYS2_PATH"
## Install the latest Ruby with Chocolatey: https://community.chocolatey.org/packages/ruby
## But I don't know what to do with cache and new versions (`upgrade`?)
- choco install ruby -y --no-progress --params "/NoPath /InstallDir:$Env:RUBY_PATH"
## ```
## Installing json 2.6.2 with native extensions
## MSYS2 could not be found. Please run 'ridk install'
## or download and install MSYS2 manually from https://msys2.github.io/
## ```
- ridk install 3
- gem update --system --no-document
- gem install bundler --no-document
bundle_cache:
folder: vendor\bundle
fingerprint_script:
- echo $Env:CIRRUS_OS
- ruby -v
- type Gemfile
- type *.gemspec
bundle_install_script:
- bundle config set --local path 'vendor/bundle'
- bundle update --all
test_script: bundle exec rspec
codecov_uploader_cache:
folder: codecov
fingerprint_script:
- Invoke-WebRequest -UseBasicParsing -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM
populate_script:
- mkdir -p codecov
- Invoke-WebRequest -UseBasicParsing -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov/uploader.exe
codecov_script: .\codecov\uploader.exe
only_if: *only_if_test_changes