-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.cirrus.yaml
222 lines (175 loc) · 6.33 KB
/
.cirrus.yaml
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
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:
## Fix Bundle cache in CI for macOS
- bundle config set --local path 'vendor/bundle'
- bundle update
unix_codecov_uploader_cache: &unix_codecov_uploader_cache
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
unix_codecov: &unix_codecov
<<: *unix_codecov_uploader_cache
codecov_script: codecov/uploader
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:latest
os_prepare_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
os_prepare_script:
- gem install bundler
<<: *unix_bundle_cache
lint_script: bundle exec rubocop --format=json --out=rubocop.json
always:
rubocop_artifacts:
path: rubocop.json
type: text/json
format: rubocop
only_if: ($CIRRUS_BRANCH == 'main') ||
changesInclude(
'.cirrus.yaml', '.gitignore', 'Gemfile', '.toys.rb', '.rubocop.yml', '*.gemspec',
'**.rb', '**.ru'
)
task:
name: Test on $CIRRUS_OS
matrix:
- container:
matrix:
image: ruby:3.0
image: ruby:3.1
image: ruby:3.2
image: ruby:3.3
image: jruby:latest
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
<<: *unix_codecov
- macos_instance:
image: ghcr.io/cirruslabs/macos-ventura-base:latest
env:
RUBY_PATH: "/usr/local/opt/ruby"
PATH: "$RUBY_PATH/bin:$PATH"
CODECOV_OS: macos
os_prepare_script:
## https://github.com/codecov/feedback/issues/141#issuecomment-1797830585
- softwareupdate --install-rosetta --agree-to-license
ruby_cache:
folder: $RUBY_PATH
fingerprint_script:
- echo $CIRRUS_OS
- brew info ruby
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
<<: *unix_bundle_cache
test_script: bundle exec rspec
## https://github.com/codecov/feedback/issues/141#issuecomment-1797830585
# <<: *unix_codecov
<<: *unix_codecov_uploader_cache
codecov_script: arch -x86_64 codecov/uploader
- 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
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 install bundler
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
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: ($CIRRUS_BRANCH == 'main') ||
changesInclude(
'.cirrus.yaml', '.gitignore', 'Gemfile', '.toys.rb', '.rspec',
'*.gemspec', 'lib/**', 'exe/**', 'spec/**'
)