Skip to content

Commit 73c8666

Browse files
authored
Add Ruby 3.4 support and newer Faraday versions (#66)
This pull request introduces multiple updates across the codebase, including improvements to the CI/CD pipeline, configuration files, and dependency management. Key changes include updates to CircleCI configuration for better caching and compatibility, new configuration for SonarLint and YAML linting, and expanded support for Faraday versions. ### CI/CD Pipeline Updates: - Updated `.circleci/config.yml` to use newer versions of `sonarcloud` (3.0) and `codecov` (5.4) orbs, updated default Ruby version to `3.4.5`, and switched Docker images from `stable` to `current`. [[1]](diffhunk://#diff-78a8a19706dbd2a4425dd72bdab0502ed7a2cef16365ab7030a5a0588927bf47L8-R10) [[2]](diffhunk://#diff-78a8a19706dbd2a4425dd72bdab0502ed7a2cef16365ab7030a5a0588927bf47L21-R21) [[3]](diffhunk://#diff-78a8a19706dbd2a4425dd72bdab0502ed7a2cef16365ab7030a5a0588927bf47L33-R38) - Added caching steps for ASDF in CircleCI jobs to improve performance and ensure Ruby versions are managed consistently. [[1]](diffhunk://#diff-78a8a19706dbd2a4425dd72bdab0502ed7a2cef16365ab7030a5a0588927bf47R57-R82) [[2]](diffhunk://#diff-78a8a19706dbd2a4425dd72bdab0502ed7a2cef16365ab7030a5a0588927bf47R131-R158) [[3]](diffhunk://#diff-78a8a19706dbd2a4425dd72bdab0502ed7a2cef16365ab7030a5a0588927bf47R238-R267) - Expanded Ruby version matrix in workflows to include `3.4.5`, `3.3.9`, `3.2.9`, and `3.1.7`. ### Configuration Improvements: - Added SonarLint connected mode configuration in `.vscode/settings.json` to integrate with SonarCloud for code quality analysis. - Introduced `.yamllint.yml` configuration for YAML linting with custom rules, including a line-length limit of 250 characters. ### Dependency Management: - Updated `.tool-versions` to reflect new Ruby versions (`3.4.5`, `3.3.9`, `3.2.9`, `3.1.7`). - Expanded `Appraisals` to include support for Faraday versions `2.10`, `2.11`, `2.12`, and `2.13`, with corresponding gemfiles added under `gemfiles/`. [[1]](diffhunk://#diff-635b20966b1d2fea76ee0565254eab939d55f6d22e3c4727cf9d453f589b87a0R53-R72) [[2]](diffhunk://#diff-6944a8a7e435b1b47e1b316540c07e8d8b1e574587fa0cc27f6fdb6a579a36b6R1-R7) [[3]](diffhunk://#diff-163b90daee2d10d72219f028674eeb98ebe0ba44ffc60498adf5e242d8f1daccR1-R7) [[4]](diffhunk://#diff-35aa6d6536d9c9e3663d6ddc807fe8188b9cad0bf1b656902e77c31e897d22cbR1-R7) [[5]](diffhunk://#diff-03139eaaf67412a5fe2dc7fecddd4678883e01f3ceac476ec489a244f6d915adR1-R7)
1 parent 98827c4 commit 73c8666

9 files changed

Lines changed: 136 additions & 19 deletions

File tree

.circleci/config.yml

Lines changed: 62 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ version: 2.1
55
orbs:
66
ruby: circleci/ruby@2.5
77
node: circleci/node@7.1
8-
sonarcloud: sonarsource/sonarcloud@2.0
8+
sonarcloud: sonarsource/sonarcloud@3.0
99
asdf: rynkowsg/asdf@0.2
10-
codecov: codecov/codecov@5.2
10+
codecov: codecov/codecov@5.4
1111
github: circleci/github-cli@2.7
1212

1313
# Pipeline parameters
@@ -18,7 +18,7 @@ parameters:
1818
default: main
1919
default-ruby:
2020
type: string
21-
default: 3.3.8
21+
default: 3.4.5
2222

2323
# Define common YAML anchors
2424
x-common-auth: &common-auth
@@ -30,12 +30,12 @@ x-common-auth: &common-auth
3030
executors:
3131
docker: # Docker using the Base Convenience Image
3232
docker:
33-
- image: cimg/base:stable
33+
- image: cimg/base:current
3434
<<: *common-auth
3535
macos: # macOS executor running Xcode
3636
macos:
3737
# https://circleci.com/developer/machine/image/xcode
38-
xcode: 16.2.0
38+
xcode: 16.4.0
3939

4040
jobs:
4141
# Lint Job
@@ -54,17 +54,32 @@ jobs:
5454
imagemagick libvips42 libffi-dev libreadline-dev \
5555
libyaml-dev openssl libtool
5656
- asdf/install
57+
- run:
58+
name: Set default Ruby to << pipeline.parameters.default-ruby >>
59+
command: echo "ruby << pipeline.parameters.default-ruby >>" > ~/.tool-versions
60+
# Restore ASDF cache
61+
- restore_cache:
62+
name: Restore ASDF cache
63+
keys:
64+
- asdf-docker-<< pipeline.parameters.default-ruby >>
5765
# Install requested Ruby version
5866
- run:
5967
name: Install Ruby << pipeline.parameters.default-ruby >>
6068
command: |
6169
asdf plugin add ruby
62-
asdf install ruby << pipeline.parameters.default-ruby >>
63-
echo "ruby << pipeline.parameters.default-ruby >>" > ~/.tool-versions
70+
ASDF_RUBY_BUILD_VERSION=master asdf install ruby << pipeline.parameters.default-ruby >>
6471
gem install --user-install executable-hooks
72+
# Save ASDF cache
73+
- save_cache:
74+
name: Save ASDF cache
75+
key: asdf-docker-<< pipeline.parameters.default-ruby >>
76+
paths:
77+
- ~/.asdf/installs
78+
- ~/.asdf/plugins
79+
- ~/.asdf/shims
6580
# Install dependencies using bundler
6681
- ruby/install-deps:
67-
key: gems-v{{ .Environment.CACHE_VERSION }}
82+
key: gems-v{{ .Environment.CACHE_VERSION }}-{{ checksum "~/.tool-versions" }}
6883
# Run Rubocop
6984
- run:
7085
name: Run Rubocop
@@ -113,19 +128,34 @@ jobs:
113128
name: Install ImageMagick, libvips and libffi
114129
command: |
115130
brew install openssl@3 imagemagick vips asdf libffi
131+
- run:
132+
name: Install Ruby << parameters.ruby-version >>
133+
command: echo "ruby << parameters.ruby-version >>" > ~/.tool-versions
134+
# Restore ASDF cache
135+
- restore_cache:
136+
name: Restore ASDF cache
137+
keys:
138+
- asdf-<< parameters.os >>-<< parameters.ruby-version >>
116139
# Install requested Ruby version
117140
- run:
118141
name: Install Ruby << parameters.ruby-version >>
119142
command: |
120143
asdf plugin add ruby
121-
asdf install ruby << parameters.ruby-version >>
122-
echo "ruby << parameters.ruby-version >>" > ~/.tool-versions
144+
ASDF_RUBY_BUILD_VERSION=master asdf install ruby << parameters.ruby-version >>
123145
gem install --user-install executable-hooks
146+
# Save ASDF cache
147+
- save_cache:
148+
name: Save ASDF cache
149+
key: asdf-<< parameters.os >>-<< parameters.ruby-version >>
150+
paths:
151+
- ~/.asdf/installs
152+
- ~/.asdf/plugins
153+
- ~/.asdf/shims
124154
# Check out code
125155
- checkout
126156
# Install dependencies using bundler
127157
- ruby/install-deps:
128-
key: gems-v{{ .Environment.CACHE_VERSION }}
158+
key: gems-v{{ .Environment.CACHE_VERSION }}-{{ checksum "~/.tool-versions" }}
129159
# Run RSpec tests
130160
- run:
131161
name: Run tests
@@ -162,7 +192,7 @@ jobs:
162192
# Sonarcloud Job
163193
sonarcloud:
164194
docker:
165-
- image: cimg/openjdk:21.0-node
195+
- image: cimg/base:current
166196
<<: *common-auth
167197
resource_class: small
168198
steps:
@@ -186,7 +216,7 @@ jobs:
186216
# Release Job
187217
release:
188218
docker:
189-
- image: cimg/base:stable
219+
- image: cimg/base:current
190220
<<: *common-auth
191221
resource_class: medium+
192222
environment:
@@ -205,21 +235,36 @@ jobs:
205235
libyaml-dev openssl libtool libz-dev libjemalloc-dev \
206236
libgmp-dev build-essential ruby-dev libssl-dev zlib1g-dev
207237
- asdf/install
238+
- run:
239+
name: Set default Ruby to << pipeline.parameters.default-ruby >>
240+
command: echo "ruby << pipeline.parameters.default-ruby >>" > ~/.tool-versions
241+
# Restore ASDF cache
242+
- restore_cache:
243+
name: Restore ASDF cache
244+
keys:
245+
- asdf-docker-<< pipeline.parameters.default-ruby >>
208246
# Install requested Ruby version
209247
- run:
210248
name: Install Ruby << pipeline.parameters.default-ruby >>
211249
command: |
212250
asdf plugin add ruby
213-
asdf install ruby << pipeline.parameters.default-ruby >>
214-
echo "ruby << pipeline.parameters.default-ruby >>" > ~/.tool-versions
251+
ASDF_RUBY_BUILD_VERSION=master asdf install ruby << pipeline.parameters.default-ruby >>
215252
gem install --user-install executable-hooks
253+
# Save ASDF cache
254+
- save_cache:
255+
name: Save ASDF cache
256+
key: asdf-docker-<< pipeline.parameters.default-ruby >>
257+
paths:
258+
- ~/.asdf/installs
259+
- ~/.asdf/plugins
260+
- ~/.asdf/shims
216261
- checkout
217262
- run:
218263
name: Check out main branch
219264
command: git checkout --force "${GIT_MAIN_BRANCH}"
220265
# Install dependencies using bundler
221266
- ruby/install-deps:
222-
key: gems-v{{ .Environment.CACHE_VERSION }}
267+
key: gems-v{{ .Environment.CACHE_VERSION }}-{{ checksum "~/.tool-versions" }}
223268
- run:
224269
name: Build and push gem
225270
command: |
@@ -299,7 +344,7 @@ workflows:
299344
matrix:
300345
parameters:
301346
os: ["docker", "macos"]
302-
ruby-version: ["3.3.8", "3.2.3", "3.1.6"]
347+
ruby-version: ["3.4.5", "3.3.9", "3.2.9", "3.1.7"]
303348
filters:
304349
tags:
305350
only: /^\d+\.\d+\.\d+$/
@@ -321,7 +366,6 @@ workflows:
321366
- SonarCloud
322367
requires:
323368
- lint
324-
- test
325369
filters:
326370
tags:
327371
only: /^\d+\.\d+\.\d+$/

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ruby 3.3.8 3.2.3 3.1.6
1+
ruby 3.4.5 3.3.9 3.2.9 3.1.7

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"sonarlint.connectedMode.project": {
3+
"connectionId": "remove-bg",
4+
"projectKey": "remove-bg_ruby"
5+
}
6+
}

.yamllint.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
3+
extends: default
4+
5+
yaml-files:
6+
- '*.yaml'
7+
- '*.yml'
8+
9+
rules:
10+
line-length:
11+
max: 250
12+
level: warning
13+
14+
ignore: |
15+
rspec
16+
resources
17+
gemfiles
18+
examples
19+
.git

Appraisals

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,26 @@ appraise "faraday-2-9" do
5050
gem "faraday", "~> 2.9.0"
5151
end
5252

53+
# Faraday 2.10
54+
appraise "faraday-2-10" do
55+
gem "faraday", "~> 2.10.0"
56+
end
57+
58+
# Faraday 2.11
59+
appraise "faraday-2-11" do
60+
gem "faraday", "~> 2.11.0"
61+
end
62+
63+
# Faraday 2.12
64+
appraise "faraday-2-12" do
65+
gem "faraday", "~> 2.12.0"
66+
end
67+
68+
# Faraday 2.13
69+
appraise "faraday-2-13" do
70+
gem "faraday", "~> 2.13.0"
71+
end
72+
5373
# Latest in Faraday 2.x series
5474
appraise "faraday-2-x" do
5575
gem "faraday", "~> 2", "< 3"

gemfiles/faraday_2_10.gemfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "faraday", "~> 2.10.0"
6+
7+
gemspec path: "../"

gemfiles/faraday_2_11.gemfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "faraday", "~> 2.11.0"
6+
7+
gemspec path: "../"

gemfiles/faraday_2_12.gemfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "faraday", "~> 2.12.0"
6+
7+
gemspec path: "../"

gemfiles/faraday_2_13.gemfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "faraday", "~> 2.13.0"
6+
7+
gemspec path: "../"

0 commit comments

Comments
 (0)