Skip to content

Commit ee1d210

Browse files
parkrashmaroli
andauthored
Update and fix CI for 3.9-stable on Ruby 3.x (#8942)
* Copy-paste CI workflow from `master` * Copy-paste Release workflow from `master` * Fix Ruby 3.0 and 3.1 compatibility issues * Add webrick gem to bundle on Ruby 3.x * Stop using `Kernel#exec` to check for python presence, since it replaces the current process * Read `/proc/version` using `File.read` directly * Fix some style offenses in touched files Co-authored-by: Ashwin Maroli <ashmaroli@gmail.com>
1 parent 01ea247 commit ee1d210

File tree

9 files changed

+138
-141
lines changed

9 files changed

+138
-141
lines changed

.github/workflows/ci.yml

Lines changed: 44 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -3,98 +3,69 @@ name: Continuous Integration
33
on:
44
push:
55
branches:
6-
- 3.9-stable
6+
- master
7+
- "*-stable"
78
pull_request:
89
branches:
9-
- 3.9-stable
10+
- master
11+
- "*-stable"
1012

1113
jobs:
12-
cruby:
13-
if: "!contains(github.event.commits[0].message, '[ci skip]')"
14-
name: 'Ruby ${{ matrix.ruby_version }}'
15-
runs-on: 'ubuntu-latest'
14+
ci:
15+
name: "Run Tests (${{ matrix.label }})"
16+
runs-on: "ubuntu-latest"
1617
strategy:
1718
fail-fast: false
1819
matrix:
19-
ruby_version:
20-
- 2.5
21-
- 2.7
20+
include:
21+
- label: Ruby 2.5
22+
ruby_version: "2.5"
23+
- label: Ruby 2.7
24+
ruby_version: "2.7"
25+
- label: Ruby 3.0
26+
ruby_version: "3.0"
27+
- label: Ruby 3.1
28+
ruby_version: "3.1"
29+
- label: JRuby 9.2.20.1
30+
ruby_version: "jruby-9.2.20.1"
2231
steps:
23-
- uses: actions/checkout@v2
24-
with:
25-
fetch-depth: 5
26-
- name: "Set up Ruby ${{ matrix.ruby_version }}"
27-
uses: ruby/setup-ruby@v1
28-
with:
29-
ruby-version: ${{ matrix.ruby_version }}
30-
bundler-cache: true
31-
- name: Execute Unit Tests
32-
run: bash script/test
33-
- name: Execute Cucumber Scenarios
34-
run: bash script/cucumber
35-
- name: Create and Build new site
36-
run: bash script/default-site
37-
38-
jruby:
39-
if: "!contains(github.event.commits[0].message, '[ci skip]')"
40-
name: JRuby
41-
runs-on: 'ubuntu-latest'
42-
43-
strategy:
44-
fail-fast: false
45-
matrix:
46-
ruby_version:
47-
- jruby
48-
steps:
49-
- uses: actions/checkout@v2
50-
with:
51-
fetch-depth: 5
52-
- name: "Set up Ruby ${{ matrix.ruby_version }}"
32+
- name: Checkout Repository
33+
uses: actions/checkout@v2
34+
- name: "Set up ${{ matrix.label }}"
5335
uses: ruby/setup-ruby@v1
5436
with:
5537
ruby-version: ${{ matrix.ruby_version }}
5638
bundler-cache: true
57-
- name: Execute Unit Tests
58-
run: bash script/test
39+
- name: Run Minitest based tests
40+
run: bash script/test
41+
- name: Run Cucumber based tests
42+
if: "!contains(matrix.ruby_version, 'jruby')"
43+
run: bash script/cucumber
44+
- name: Generate and Build a new site
45+
run: bash script/default-site
5946

60-
profile_docs:
61-
if: "!contains(github.event.commits[0].message, '[ci skip]')"
62-
name: 'Profile Docs Site (Ruby ${{ matrix.ruby_version }})'
63-
runs-on: 'ubuntu-latest'
47+
xtras:
48+
name: "${{ matrix.job_name }} (Ruby ${{ matrix.ruby_version }})"
49+
runs-on: "ubuntu-latest"
6450
strategy:
6551
fail-fast: false
6652
matrix:
67-
ruby_version:
68-
- 2.5
53+
include:
54+
- job_name: "Profile Docs Site"
55+
step_name: "Build and Profile docs site"
56+
script_file: "profile-docs"
57+
ruby_version: "2.5"
58+
- job_name: "Style Check"
59+
step_name: "Run RuboCop"
60+
script_file: "fmt"
61+
ruby_version: "2.5"
6962
steps:
70-
- uses: actions/checkout@v2
71-
with:
72-
fetch-depth: 5
73-
- name: "Set up Ruby ${{ matrix.ruby_version }}"
74-
uses: ruby/setup-ruby@v1
75-
with:
76-
ruby-version: ${{ matrix.ruby_version }}
77-
bundler-cache: true
78-
- name: Profile building docs site
79-
run: bash script/profile-docs
80-
81-
style_check:
82-
if: "!contains(github.event.commits[0].message, '[ci skip]')"
83-
name: 'Style Check (Ruby ${{ matrix.ruby_version }})'
84-
runs-on: 'ubuntu-latest'
85-
strategy:
86-
fail-fast: false
87-
matrix:
88-
ruby_version:
89-
- 2.5
90-
steps:
91-
- uses: actions/checkout@v2
92-
with:
93-
fetch-depth: 5
63+
- name: Checkout Repository
64+
uses: actions/checkout@v2
9465
- name: "Set up Ruby ${{ matrix.ruby_version }}"
9566
uses: ruby/setup-ruby@v1
9667
with:
9768
ruby-version: ${{ matrix.ruby_version }}
9869
bundler-cache: true
99-
- name: Run RuboCop
100-
run: bash script/fmt
70+
- name: ${{ matrix.step_name }}
71+
run: bash script/${{ matrix.script_file }}

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release Gem
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- "*-stable"
8+
paths:
9+
- "lib/**/version.rb"
10+
11+
jobs:
12+
release:
13+
if: "github.repository_owner == 'jekyll'"
14+
name: "Release Gem (Ruby ${{ matrix.ruby_version }})"
15+
runs-on: "ubuntu-latest"
16+
strategy:
17+
fail-fast: true
18+
matrix:
19+
ruby_version:
20+
- 2.7
21+
steps:
22+
- name: Checkout Repository
23+
uses: actions/checkout@v2
24+
- name: "Set up Ruby ${{ matrix.ruby_version }}"
25+
uses: ruby/setup-ruby@v1
26+
with:
27+
ruby-version: ${{ matrix.ruby_version }}
28+
bundler-cache: true
29+
- name: Build and Publish Gem
30+
uses: ashmaroli/release-gem@dist
31+
with:
32+
gemspec_name: jekyll
33+
env:
34+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_GEM_PUSH_API_KEY }}

Gemfile

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@ gem "rake", "~> 12.0"
77

88
gem "rouge", ENV["ROUGE"] if ENV["ROUGE"]
99

10-
# Dependency of jekyll-mentions. RubyGems in Ruby 2.1 doesn't shield us from this.
11-
gem "activesupport", "~> 4.2", :groups => [:test_legacy, :site] if RUBY_VERSION < "2.2.2"
12-
1310
group :development do
1411
gem "launchy", "~> 2.3"
1512
gem "pry"
1613

17-
unless RUBY_ENGINE == "jruby"
18-
gem "pry-byebug"
19-
end
14+
gem "pry-byebug" unless RUBY_ENGINE == "jruby"
2015
end
2116

2217
#
2318

2419
group :test do
2520
gem "codeclimate-test-reporter", "~> 1.0.5"
26-
gem "cucumber", RUBY_VERSION >= "2.2" ? "~> 3.0" : "3.0.1"
21+
gem "cucumber", "~> 3.0"
2722
gem "httpclient"
2823
gem "jekyll_test_plugin"
2924
gem "jekyll_test_plugin_malicious"
30-
# nokogiri v1.10 does not work with ruby 2.2 and below
31-
gem "nokogiri", RUBY_VERSION >= "2.3" ? "~> 1.9" : "~> 1.9.0"
25+
gem "nokogiri", "~> 1.9"
26+
27+
# Ruby 3.1.0 shipped with `psych-4.0.3` which caused some of our Cucumber-based tests to fail.
28+
# TODO: Remove lock once we implement a way to use Psych 4 without breaking anything.
29+
# See https://github.com/jekyll/jekyll/pull/8918
30+
gem "psych", "~> 3.3"
31+
3232
gem "rspec"
3333
gem "rspec-mocks"
3434
gem "rubocop", "~> 0.56.0"
@@ -37,6 +37,8 @@ group :test do
3737
gem "test-theme-skinny", :path => File.expand_path("test/fixtures/test-theme-skinny", __dir__)
3838
gem "test-theme-symlink", :path => File.expand_path("test/fixtures/test-theme-symlink", __dir__)
3939

40+
gem "webrick" if RUBY_VERSION >= "3"
41+
4042
# http_parser.rb has stopped shipping jruby-compatible versions
4143
# latest compatible one was 0.6.0 https://rubygems.org/gems/http_parser.rb
4244
if RUBY_ENGINE == "jruby"
@@ -48,9 +50,7 @@ end
4850
#
4951

5052
group :test_legacy do
51-
if RUBY_PLATFORM =~ %r!cygwin! || RUBY_VERSION.start_with?("2.2")
52-
gem "test-unit"
53-
end
53+
gem "test-unit" if RUBY_PLATFORM =~ %r!cygwin!
5454

5555
gem "minitest"
5656
gem "minitest-profile"
@@ -79,9 +79,14 @@ group :jekyll_optional_dependencies do
7979
gem "jekyll-gist"
8080
gem "jekyll-paginate"
8181
gem "jekyll-redirect-from"
82+
83+
# Add gem 'matrix'
84+
# Ref: https://github.com/jekyll/jekyll/commit/d0eb07ba29dc7d5f52defab855bdb7a768cf824c
85+
gem "matrix"
86+
8287
gem "mime-types", "~> 3.0"
83-
gem "rdoc", RUBY_VERSION >= "2.2.2" ? "~> 6.0" : "~> 5.1"
84-
gem "tomlrb", "~> 1.2"
88+
gem "rdoc", "~> 6.3.0"
89+
gem "tomlrb", "~> 2.0"
8590

8691
if ENV["KRAMDOWN_VERSION"].nil? || ENV["KRAMDOWN_VERSION"].to_i >= 2
8792
gem "kramdown-syntax-coderay"
@@ -92,7 +97,7 @@ group :jekyll_optional_dependencies do
9297

9398
platform :ruby, :mswin, :mingw, :x64_mingw do
9499
gem "classifier-reborn", "~> 2.2.0"
95-
gem "liquid-c", "~> 3.0"
100+
gem "liquid-c", "~> 4.0"
96101
gem "pygments.rb", "~> 1.0"
97102
gem "rdiscount", "~> 2.0"
98103
gem "redcarpet", "~> 3.2", ">= 3.2.3"
@@ -106,9 +111,7 @@ end
106111
#
107112

108113
group :site do
109-
if ENV["PROOF"]
110-
gem "html-proofer", "~> 3.4"
111-
end
114+
gem "html-proofer", "~> 3.4" if ENV["PROOF"]
112115

113116
gem "jekyll-avatar"
114117
gem "jekyll-mentions"

lib/jekyll/readers/data_reader.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,14 @@ def read_data_to(dir, data)
5454
def read_data_file(path)
5555
case File.extname(path).downcase
5656
when ".csv"
57-
CSV.read(path, {
57+
CSV.read(path,
5858
:headers => true,
59-
:encoding => site.config["encoding"],
60-
}).map(&:to_hash)
59+
:encoding => site.config["encoding"]).map(&:to_hash)
6160
when ".tsv"
62-
CSV.read(path, {
61+
CSV.read(path,
6362
:col_sep => "\t",
6463
:headers => true,
65-
:encoding => site.config["encoding"],
66-
}).map(&:to_hash)
64+
:encoding => site.config["encoding"]).map(&:to_hash)
6765
else
6866
SafeYAML.load_file(path)
6967
end

lib/jekyll/utils/platforms.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ def linux?
7070
private
7171
def proc_version
7272
@proc_version ||= begin
73-
Pathutil.new(
73+
File.read(
7474
"/proc/version"
75-
).read
75+
).downcase
7676
rescue Errno::ENOENT
7777
nil
7878
end

0 commit comments

Comments
 (0)