Skip to content

Commit f714e62

Browse files
authored
Merge pull request #25 from Shopify/ec-tweaks
Various tweaks
2 parents 37dd18b + 62e90bd commit f714e62

File tree

25 files changed

+106
-47
lines changed

25 files changed

+106
-47
lines changed

.github/actions/cibuildgem/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"version": "1.0.0",
44
"description": "A companion GitHub action for the cibuildgem ruby tool.",
55
"main": "index.js",
6-
"repository": "https://github.com/rails/cool-stuff-fun-time",
6+
"repository": "https://github.com/shopify/cibuildgem",
77
"scripts": {
88
"test": "NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 jest",
99
"package": "ncc build src/index.js -o dist"
1010
},
11-
"author": "Edouard Chin",
11+
"author": "Shopify",
1212
"license": "MIT",
1313
"devDependencies": {
1414
"@vercel/ncc": "^0.38.4",

.github/workflows/main.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,28 @@ name: "Run the test suite"
22
on: push
33

44
jobs:
5+
lint:
6+
timeout-minutes: 5
7+
name: "Ruby linter"
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: "Checkout code"
11+
uses: "actions/checkout@v5"
12+
- name: "Setup ruby"
13+
uses: "ruby/setup-ruby@v1"
14+
with:
15+
bundler-cache: true
16+
- name: "Run rubocop"
17+
run: "bundle exec rubocop"
518
test:
619
timeout-minutes: 10
720
name: "Testing the gem"
821
runs-on: ubuntu-latest
922
steps:
1023
- name: "Checkout code"
1124
uses: "actions/checkout@v5"
25+
- name: "Remove the Gemfile.lock"
26+
run: "rm -rf Gemfile.lock"
1227
- name: "Setup ruby"
1328
uses: "ruby/setup-ruby@v1"
1429
with:

.rubocop.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
inherit_gem:
2+
rubocop-shopify: rubocop.yml
3+
4+
AllCops:
5+
NewCops: disable
6+
SuggestExtensions: false
7+
Exclude:
8+
- test/fixtures/date/**/*

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ gemspec
77

88
gem "rake", "~> 13.0"
99
gem "minitest", "~> 5.16"
10+
gem "rubocop-shopify"

Gemfile.lock

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,43 @@ PATH
99
GEM
1010
remote: https://rubygems.org/
1111
specs:
12+
ast (2.4.3)
13+
json (2.16.0)
14+
language_server-protocol (3.17.0.5)
15+
lint_roller (1.1.0)
1216
minitest (5.25.5)
17+
parallel (1.27.0)
18+
parser (3.3.10.0)
19+
ast (~> 2.4.1)
20+
racc
1321
prism (1.6.0)
22+
racc (1.8.1)
23+
rainbow (3.1.1)
1424
rake (13.3.0)
1525
rake-compiler (1.3.0)
1626
rake
27+
regexp_parser (2.11.3)
28+
rubocop (1.81.7)
29+
json (~> 2.3)
30+
language_server-protocol (~> 3.17.0.2)
31+
lint_roller (~> 1.1.0)
32+
parallel (~> 1.10)
33+
parser (>= 3.3.0.2)
34+
rainbow (>= 2.2.2, < 4.0)
35+
regexp_parser (>= 2.9.3, < 3.0)
36+
rubocop-ast (>= 1.47.1, < 2.0)
37+
ruby-progressbar (~> 1.7)
38+
unicode-display_width (>= 2.4.0, < 4.0)
39+
rubocop-ast (1.48.0)
40+
parser (>= 3.3.7.2)
41+
prism (~> 1.4)
42+
rubocop-shopify (2.18.0)
43+
rubocop (~> 1.62)
44+
ruby-progressbar (1.13.0)
1745
thor (1.4.0)
46+
unicode-display_width (3.2.0)
47+
unicode-emoji (~> 4.1)
48+
unicode-emoji (4.1.0)
1849

1950
PLATFORMS
2051
arm64-darwin-23
@@ -24,6 +55,7 @@ DEPENDENCIES
2455
cibuildgem!
2556
minitest (~> 5.16)
2657
rake (~> 13.0)
58+
rubocop-shopify
2759

2860
BUNDLED WITH
2961
2.7.2

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2025 Edouard CHIN
3+
Copyright (c) 2025 Shopify
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ rescue LoadError
1313
# it the GitHub action clones the repo and runs `rake install`, without running a `bundle install` first.
1414
end
1515

16-
task default: :test
16+
task(default: :test)

cibuildgem.gemspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
3030
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
3131
spec.require_paths = ["lib"]
3232

33-
spec.add_dependency "rake-compiler"
34-
spec.add_dependency "thor"
35-
spec.add_dependency "prism"
33+
spec.add_dependency("prism")
34+
spec.add_dependency("rake-compiler")
35+
spec.add_dependency("thor")
3636
end

lib/cibuildgem/cli.rb

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ class CLI < Thor
99

1010
source_root(File.expand_path("templates", __dir__))
1111

12-
def self.exit_on_failure?
13-
true
12+
class << self
13+
def exit_on_failure?
14+
true
15+
end
1416
end
1517

1618
desc "compile", "Compile a gem's native extension."
@@ -92,13 +94,12 @@ def clobber
9294
method_option "working-directory", type: "string", required: false, desc: "If your gem lives outside of the repository root, specify where."
9395
method_option "test-command", type: "string", required: false, desc: "The test command to run. Defaults to running `bundle exec rake test` and `bundle exec rake spec`."
9496
def ci_template
95-
# os = ["macos-latest", "macos-15-intel", "ubuntu-latest", "windows-latest"]
96-
os = ["macos-latest", "ubuntu-22.04"] # Just this for now because the CI takes too long otherwise.
97-
9897
ruby_requirements = compilation_task.gemspec.required_ruby_version
99-
latest_supported_ruby_version = RubySeries.latest_version_for_requirements(ruby_requirements)
100-
runtime_version_for_compilation = RubySeries.runtime_version_for_compilation(ruby_requirements)
101-
ruby_versions_for_testing = RubySeries.versions_to_test_against(ruby_requirements)
98+
# os = ["macos-latest", "macos-15-intel", "ubuntu-latest", "windows-latest"]
99+
@os = ["macos-latest", "ubuntu-22.04"] # Just this for now because the CI takes too long otherwise.
100+
@latest_supported_ruby_version = RubySeries.latest_version_for_requirements(ruby_requirements)
101+
@runtime_version_for_compilation = RubySeries.runtime_version_for_compilation(ruby_requirements)
102+
@ruby_versions_for_testing = RubySeries.versions_to_test_against(ruby_requirements)
102103

103104
directory(".github", context: instance_eval("binding"))
104105
end
@@ -117,12 +118,12 @@ def release
117118
desc "print_ruby_cc_version", "Output the cross compile ruby version needed for the gem. For internal usage", hide: true
118119
method_option "gemspec", type: "string", required: false, desc: "The gemspec to use. If the option is not passed, a gemspec file from the current working directory will be used."
119120
def print_ruby_cc_version
120-
print compilation_task.ruby_cc_version
121+
print(compilation_task.ruby_cc_version)
121122
end
122123

123124
desc "normalized_platform", "The platform name for compilation purposes", hide: true
124125
def print_normalized_platform
125-
print compilation_task.normalized_platform
126+
print(compilation_task.normalized_platform)
126127
end
127128

128129
private
@@ -143,7 +144,7 @@ def run_rake_tasks!(*tasks)
143144
def compilation_task
144145
@compilation_task ||= CompilationTasks.new(false)
145146
rescue GemspecError => e
146-
print e.message
147+
print(e.message)
147148

148149
Kernel.exit(false)
149150
end

lib/cibuildgem/compilation_tasks.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class CompilationTasks
1010
attr_reader :gemspec, :native, :create_packaging_task, :extension_task
1111

1212
def initialize(create_packaging_task = false, gemspec = nil)
13-
@gemspec = Bundler.load_gemspec(gemspec || find_gemspec)
13+
@gemspec = Bundler.load_gemspec(gemspec || find_gemspec)
1414
verify_gemspec!
1515

1616
@create_packaging_task = create_packaging_task
@@ -85,7 +85,7 @@ def disable_shared
8585
makefile_content.match(/LIBRUBYARG_SHARED = (.*)/) do |match|
8686
shared_flags = match[1].split(" ")
8787
shared_flags.reject! { |flag| flag == "-l$(RUBY_SO_NAME)" }
88-
makefile_content.gsub!(/(LIBRUBYARG_SHARED = ).*/, "\\1#{shared_flags.join(' ')}")
88+
makefile_content.gsub!(/(LIBRUBYARG_SHARED = ).*/, "\\1#{shared_flags.join(" ")}")
8989

9090
File.write(task.name, makefile_content)
9191
end

0 commit comments

Comments
 (0)