Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rejig a bunch of the Ruby handling in CI [Was: Bump rubocop from 1.62.1 to 1.63.0] #777

Merged
merged 16 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build_site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
build:
name: Build the website
runs-on: ubuntu-latest
env:
BUNDLE_WITH: build
steps:
- name: "Check out the repo"
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/merge_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
build:
name: Merge pull request
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'alexwlchan' && !github.event.pull_request.draft
steps:
- name: "Check out the repo"
uses: actions/checkout@v4

- name: Merge the pull request
if: github.event.pull_request.user.login == 'alexwlchan' && !github.event.pull_request.draft
run: |
python3 -m pip install httpx
python3 .github/workflows/merge_pull_request.py
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,26 @@ on:

paths:
- '**/*.rb'
- '.github/workflows/rubocop.yml'
- 'Gemfile'
- 'Gemfile.lock'

pull_request:
branches:
- main

paths:
- '**/*.rb'
- '.github/workflows/rubocop.yml'
- 'Gemfile'
- 'Gemfile.lock'

jobs:
build:
name: Lint the Ruby code
runs-on: ubuntu-latest
env:
BUNDLE_WITH: lint
steps:
- name: "Check out the repo"
uses: actions/checkout@v4
Expand All @@ -27,8 +35,8 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
cache-version: 0

- name: Run rubocop
run: |
gem install rubocop -v 1.62.1
rubocop
run: bundle exec rubocop
6 changes: 6 additions & 0 deletions .github/workflows/run_plugin_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,24 @@ on:

paths:
- 'src/_plugins/**'
- 'Gemfile'
- 'Gemfile.lock'

pull_request:
branches:
- main

paths:
- 'src/_plugins/**'
- 'Gemfile'
- 'Gemfile.lock'

jobs:
build:
name: Run plugin tests
runs-on: ubuntu-latest
env:
BUNDLE_WITH: build:test
steps:
- name: "Check out the repo"
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
.sass-cache
_site
*.pyc

.bundle
.DS_Store
7 changes: 6 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
AllCops:
NewCops: enable
TargetRubyVersion: 3.1
TargetRubyVersion: 3.3

Exclude:
- '_site/**/*'
- 'src/_files/2022/division1.rb'
- 'src/_files/2022/division2.rb'
- 'src/_files/2023/uequals_operator.rb'

# This is to avoid RuboCop trying to lint too much stuff when running
# in GitHub Actions.
# See https://stackoverflow.com/a/69421161/1558022
- 'vendor/**/*'

Layout/LineLength:
Max: 200

Expand Down
27 changes: 18 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
source 'https://rubygems.org'

gem 'chunky_png', '~> 1.4'
gem 'color', '~> 1.8'
gem 'html-proofer', '~> 5'
gem 'jekyll', '~> 4'
gem 'jekyll-include-cache', '~> 0.2'
gem 'json-schema', '~> 4'
gem 'nokogiri', '~> 1.16'
gem 'rubocop', '~> 1.62'
gem 'shell-executer', '~> 1.0'
group :build, optional: true do
gem 'chunky_png', '~> 1.4'
gem 'color', '~> 1.8'
gem 'html-proofer', '~> 5'
gem 'jekyll', '~> 4'
gem 'jekyll-include-cache', '~> 0.2'
gem 'json-schema', '~> 4'
gem 'nokogiri', '~> 1.16'
gem 'shell-executer', '~> 1.0'
end

group :lint, optional: true do
gem 'rubocop', '~> 1.63'
end

group :test, optional: true do
gem 'test-unit'
end
8 changes: 6 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ GEM
hashery (~> 2.0)
ruby-rc4
ttfunk
power_assert (2.0.3)
public_suffix (5.0.5)
racc (1.7.3)
rainbow (3.1.1)
Expand All @@ -112,7 +113,7 @@ GEM
regexp_parser (2.9.0)
rexml (3.2.6)
rouge (4.2.1)
rubocop (1.62.1)
rubocop (1.63.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand All @@ -137,6 +138,8 @@ GEM
open4
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
test-unit (3.6.2)
power_assert
timers (4.3.5)
ttfunk (1.8.0)
bigdecimal (~> 3.1)
Expand All @@ -158,8 +161,9 @@ DEPENDENCIES
jekyll-include-cache (~> 0.2)
json-schema (~> 4)
nokogiri (~> 1.16)
rubocop (~> 1.62)
rubocop (~> 1.63)
shell-executer (~> 1.0)
test-unit

BUNDLED WITH
2.3.26
2 changes: 0 additions & 2 deletions scripts/linter.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require 'set'

require 'html-proofer'
require 'json'
require 'json-schema'
Expand Down
1 change: 0 additions & 1 deletion scripts/save_elsewhere_article.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# [2]: https://www.stephaniemorillo.co/post/why-developers-should-archive-their-old-content

require 'fileutils'
require 'set'
require 'yaml'

require 'unidecode'
Expand Down