Skip to content

Commit ed1b96a

Browse files
authored
Merge pull request #614 from sparklemotion/flavorjones-ci-and-dep-cleanup
dep: move style and docs deps into a separate group
2 parents 5092a75 + 03f57c1 commit ed1b96a

File tree

6 files changed

+80
-65
lines changed

6 files changed

+80
-65
lines changed

.github/workflows/ci.yml

+12-6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ on:
1717
branches:
1818
- '*'
1919

20+
env:
21+
BUNDLE_WITHOUT: "development"
22+
2023
jobs:
2124
ruby_versions:
2225
outputs:
@@ -31,6 +34,8 @@ jobs:
3134
#
3235
rubocop:
3336
runs-on: ubuntu-latest
37+
env:
38+
BUNDLE_WITHOUT: "" # we need rubocop, obviously
3439
steps:
3540
- uses: actions/checkout@v4
3641
- uses: ruby/setup-ruby@v1
@@ -101,7 +106,7 @@ jobs:
101106
steps:
102107
- run: |
103108
dnf group install -y "C Development Tools and Libraries"
104-
dnf install -y ruby ruby-devel libyaml-devel
109+
dnf install -y ruby ruby-devel
105110
- uses: actions/checkout@v4
106111
- run: bundle install
107112
- run: bundle exec rake compile -- --disable-system-libraries
@@ -118,6 +123,7 @@ jobs:
118123
usesh: true
119124
copyback: false
120125
prepare: pkg install -y ruby devel/ruby-gems pkgconf
126+
envs: BUNDLE_WITHOUT
121127
run: |
122128
gem install bundler
123129
bundle install --local || bundle install
@@ -294,10 +300,10 @@ jobs:
294300
ruby: ${{ fromJSON(needs.ruby_versions.outputs.image_tag) }}
295301
include:
296302
# declare docker image for each platform
297-
- { platform: aarch64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base yaml-dev &&" }
298-
- { platform: arm-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base yaml-dev &&" }
299-
- { platform: x86-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base yaml-dev &&" }
300-
- { platform: x86_64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base yaml-dev &&" }
303+
- { platform: aarch64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base &&" }
304+
- { platform: arm-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base &&" }
305+
- { platform: x86-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base &&" }
306+
- { platform: x86_64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base &&" }
301307
# declare docker platform for each platform
302308
- { platform: aarch64-linux-gnu, docker_platform: "--platform=linux/arm64" }
303309
- { platform: aarch64-linux-musl, docker_platform: "--platform=linux/arm64" }
@@ -371,5 +377,5 @@ jobs:
371377
with:
372378
name: cruby-x86_64-linux-musl-gem
373379
path: gems
374-
- run: apk add build-base yaml-dev
380+
- run: apk add build-base
375381
- run: ./bin/test-gem-install ./gems

.github/workflows/downstream.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- uses: actions/checkout@v4
2525
- uses: ruby/setup-ruby-pkgs@v1
2626
with:
27-
ruby-version: "3.3"
27+
ruby-version: "3.4"
2828
bundler: latest
2929
bundler-cache: true
3030
apt-get: sqlite3 # active record test suite uses the sqlite3 cli
@@ -37,7 +37,7 @@ jobs:
3737
run: |
3838
git clone --depth 1 --branch main https://github.com/rails/rails
3939
cd rails
40-
bundle install
40+
bundle install --prefer-local
4141
bundle remove sqlite3
4242
bundle add sqlite3 --path=".."
4343
- name: run tests

Gemfile

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ source "https://rubygems.org"
22

33
gemspec
44

5-
group :development do
5+
group :test do
66
gem "minitest", "5.25.4"
77

8+
gem "ruby_memcheck", "3.0.1" if Gem::Platform.local.os == "linux"
9+
810
gem "rake-compiler", "1.2.9"
911
gem "rake-compiler-dock", "1.9.1"
12+
end
1013

11-
gem "ruby_memcheck", "3.0.1" if Gem::Platform.local.os == "linux"
12-
14+
group :development do
1315
gem "rdoc", "6.11.0"
1416

1517
gem "rubocop", "1.59.0", require: false

bin/test-gem-build

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ test -e /etc/os-release && cat /etc/os-release
1616

1717
set -x
1818

19+
bundle config set without development
1920
bundle install --local || bundle install
2021
bundle exec rake set-version-to-timestamp
2122

bin/test-gem-install

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# run as part of CI
44
#
5-
if [[ $# -lt 1 ]] ; then
5+
if [ $# -lt 1 ] ; then
66
echo "usage: $(basename $0) <gems_dir> [install_flags]"
77
exit 1
88
fi
@@ -24,6 +24,7 @@ cd $GEMS_DIR
2424

2525
cd ..
2626

27+
bundle config set without development
2728
bundle install --local || bundle install
2829

2930
rm -rf lib ext # ensure we don't use the local files

rakelib/format.rake

+58-53
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,75 @@
11
require "rake/clean"
2-
require "rubocop/rake_task"
3-
4-
module AstyleHelper
5-
class << self
6-
def run(files)
7-
assert
8-
command = ["astyle", args, files].flatten.shelljoin
9-
system(command)
10-
end
112

12-
def assert
13-
require "mkmf"
14-
find_executable0("astyle") || raise("Could not find command 'astyle'")
15-
end
3+
begin
4+
require "rubocop/rake_task"
165

17-
def args
18-
[
19-
# indentation
20-
"--indent=spaces=4",
21-
"--indent-switches",
6+
module AstyleHelper
7+
class << self
8+
def run(files)
9+
assert
10+
command = ["astyle", args, files].flatten.shelljoin
11+
system(command)
12+
end
2213

23-
# brackets
24-
"--style=1tbs",
25-
"--keep-one-line-blocks",
14+
def assert
15+
require "mkmf"
16+
find_executable0("astyle") || raise("Could not find command 'astyle'")
17+
end
2618

27-
# where do we want spaces
28-
"--unpad-paren",
29-
"--pad-header",
30-
"--pad-oper",
31-
"--pad-comma",
19+
def args
20+
[
21+
# indentation
22+
"--indent=spaces=4",
23+
"--indent-switches",
3224

33-
# "void *pointer" and not "void* pointer"
34-
"--align-pointer=name",
25+
# brackets
26+
"--style=1tbs",
27+
"--keep-one-line-blocks",
3528

36-
# function definitions and declarations
37-
"--break-return-type",
38-
"--attach-return-type-decl",
29+
# where do we want spaces
30+
"--unpad-paren",
31+
"--pad-header",
32+
"--pad-oper",
33+
"--pad-comma",
3934

40-
# gotta set a limit somewhere
41-
"--max-code-length=100",
35+
# "void *pointer" and not "void* pointer"
36+
"--align-pointer=name",
4237

43-
# be quiet about files that haven't changed
44-
"--formatted",
45-
"--verbose"
46-
]
47-
end
38+
# function definitions and declarations
39+
"--break-return-type",
40+
"--attach-return-type-decl",
4841

49-
def c_files
50-
SQLITE3_SPEC.files.grep(%r{ext/sqlite3/.*\.[ch]\Z})
42+
# gotta set a limit somewhere
43+
"--max-code-length=100",
44+
45+
# be quiet about files that haven't changed
46+
"--formatted",
47+
"--verbose"
48+
]
49+
end
50+
51+
def c_files
52+
SQLITE3_SPEC.files.grep(%r{ext/sqlite3/.*\.[ch]\Z})
53+
end
5154
end
5255
end
53-
end
5456

55-
namespace "format" do
56-
desc "Format C code"
57-
task "c" do
58-
puts "Running astyle on C files ..."
59-
AstyleHelper.run(AstyleHelper.c_files)
60-
end
57+
namespace "format" do
58+
desc "Format C code"
59+
task "c" do
60+
puts "Running astyle on C files ..."
61+
AstyleHelper.run(AstyleHelper.c_files)
62+
end
6163

62-
CLEAN.add(AstyleHelper.c_files.map { |f| "#{f}.orig" })
64+
CLEAN.add(AstyleHelper.c_files.map { |f| "#{f}.orig" })
6365

64-
desc "Format Ruby code"
65-
task "ruby" => "rubocop:autocorrect"
66-
end
66+
desc "Format Ruby code"
67+
task "ruby" => "rubocop:autocorrect"
68+
end
6769

68-
RuboCop::RakeTask.new
70+
RuboCop::RakeTask.new
6971

70-
task "format" => ["format:c", "format:ruby"]
72+
task "format" => ["format:c", "format:ruby"]
73+
rescue LoadError => e
74+
puts "NOTE: Rubocop is not available in this environment: #{e.message}"
75+
end

0 commit comments

Comments
 (0)