Skip to content

Commit b979be9

Browse files
ruby 3.2.0 (#86)
* Upgrade to ruby 3.2 * Upgrade bundler * Stop if non-zero exit code * Update docker tag * Use endless methods * Fix rubocop workflow * Fix tests workflow * Add bundler cache
1 parent 38a8d63 commit b979be9

File tree

11 files changed

+66
-50
lines changed

11 files changed

+66
-50
lines changed

.github/workflows/rubocop.yml

+14-7
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,31 @@ on:
55
branches: [main]
66
pull_request:
77
branches: [main]
8+
workflow_dispatch:
89

910
jobs:
1011
rubocop:
11-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-22.04
1213

1314
steps:
14-
- uses: actions/checkout@v2
15+
- name: Checkout code
16+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
1517

1618
- name: Set up Ruby
17-
uses: ruby/setup-ruby@a699edbce608a2c128dedad88e3b6a0e28687b3c
19+
uses: ruby/setup-ruby@d4526a55538b775af234ba4af27118ed6f8f6677
1820
with:
19-
ruby-version: 2.6.6
21+
ruby-version: .ruby-version
2022

2123
- name: Install gems
2224
run: |
23-
gem install rubocop -v 1.7.0
24-
gem install rubocop-minitest -v 0.11.0
25-
gem install rubocop-performance -v 1.10.1
25+
# Extract the exact versions of the rubocop gems from Gemfile.lock
26+
rubocop_version=$(sed -n -E 's/^ rubocop \((.+)\)/\1/p' Gemfile.lock)
27+
rubocop_performance_version=$(sed -n -E 's/^ rubocop-performance \((.+)\)/\1/p' Gemfile.lock)
28+
rubocop_minitest_version=$(sed -n -E 's/^ rubocop-minitest \((.+)\)/\1/p' Gemfile.lock)
29+
30+
gem install rubocop -v $rubocop_version
31+
gem install rubocop-performance -v $rubocop_performance_version
32+
gem install rubocop-minitest -v $rubocop_minitest_version
2633
2734
- name: Run Rubocop
2835
run: rubocop --except Metrics

.github/workflows/tests.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@ on:
88

99
jobs:
1010
test:
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-22.04
1212

1313
steps:
14-
# Checkout using GitHub's checkout action
15-
- uses: actions/checkout@v2
14+
- name: Checkout code
15+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
1616

17-
# Setup Ruby - this needs to match the version in the Gemfile
1817
- name: Set up Ruby
19-
uses: ruby/setup-ruby@a699edbce608a2c128dedad88e3b6a0e28687b3c
18+
uses: ruby/setup-ruby@d4526a55538b775af234ba4af27118ed6f8f6677
2019
with:
21-
ruby-version: 2.6.6
20+
ruby-version: .ruby-version
2221
bundler-cache: true
2322

2423
# Setup code climate

.ruby-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.6.6
1+
3.2.0

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM amazon/aws-lambda-ruby
1+
FROM public.ecr.aws/lambda/ruby:3.2 AS build
22

33
RUN yum install -y make gcc
44

Gemfile.lock

+35-27
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,51 @@ GEM
22
remote: https://rubygems.org/
33
specs:
44
ast (2.4.2)
5-
docile (1.3.2)
6-
json (2.3.1)
7-
mandate (0.3.0)
8-
minitest (5.14.2)
5+
docile (1.4.0)
6+
json (2.7.1)
7+
language_server-protocol (3.17.0.3)
8+
mandate (2.2.0)
9+
minitest (5.22.2)
910
minitest-stub-const (0.6)
10-
mocha (1.11.2)
11-
parallel (1.20.1)
12-
parser (3.0.0.0)
11+
mocha (2.1.0)
12+
ruby2_keywords (>= 0.0.5)
13+
parallel (1.24.0)
14+
parser (3.3.0.5)
1315
ast (~> 2.4.1)
14-
rainbow (3.0.0)
15-
rake (13.0.1)
16-
regexp_parser (2.1.1)
17-
rexml (3.2.4)
18-
rubocop (1.11.0)
16+
racc
17+
racc (1.7.3)
18+
rainbow (3.1.1)
19+
rake (13.1.0)
20+
regexp_parser (2.9.0)
21+
rexml (3.2.6)
22+
rubocop (1.60.2)
23+
json (~> 2.3)
24+
language_server-protocol (>= 3.17.0)
1925
parallel (~> 1.10)
20-
parser (>= 3.0.0.0)
26+
parser (>= 3.3.0.2)
2127
rainbow (>= 2.2.2, < 4.0)
2228
regexp_parser (>= 1.8, < 3.0)
23-
rexml
24-
rubocop-ast (>= 1.2.0, < 2.0)
29+
rexml (>= 3.2.5, < 4.0)
30+
rubocop-ast (>= 1.30.0, < 2.0)
2531
ruby-progressbar (~> 1.7)
26-
unicode-display_width (>= 1.4.0, < 3.0)
27-
rubocop-ast (1.4.1)
28-
parser (>= 2.7.1.5)
29-
rubocop-minitest (0.11.0)
30-
rubocop (>= 0.90, < 2.0)
31-
rubocop-performance (1.10.1)
32-
rubocop (>= 0.90.0, < 2.0)
33-
rubocop-ast (>= 0.4.0)
34-
ruby-progressbar (1.11.0)
32+
unicode-display_width (>= 2.4.0, < 3.0)
33+
rubocop-ast (1.30.0)
34+
parser (>= 3.2.1.0)
35+
rubocop-minitest (0.34.5)
36+
rubocop (>= 1.39, < 2.0)
37+
rubocop-ast (>= 1.30.0, < 2.0)
38+
rubocop-performance (1.20.2)
39+
rubocop (>= 1.48.1, < 2.0)
40+
rubocop-ast (>= 1.30.0, < 2.0)
41+
ruby-progressbar (1.13.0)
42+
ruby2_keywords (0.0.5)
3543
simplecov (0.17.1)
3644
docile (~> 1.1)
3745
json (>= 1.8, < 3)
3846
simplecov-html (~> 0.10.0)
3947
simplecov-html (0.10.2)
40-
unicode-display_width (2.0.0)
41-
zeitwerk (2.4.2)
48+
unicode-display_width (2.5.0)
49+
zeitwerk (2.6.13)
4250

4351
PLATFORMS
4452
ruby
@@ -57,4 +65,4 @@ DEPENDENCIES
5765
zeitwerk
5866

5967
BUNDLED WITH
60-
2.1.4
68+
2.4.1

bin/rubocop-quick

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22

3-
git diff --name-status --staged | grep '^[MA]' | grep -o '\s\+.*rb' | xargs bundle exec rubocop --except Metrics --auto-correct --format quiet --force-exclusion Gemfile && \
3+
git diff --name-status --staged | grep '^[MA]' | grep -o '\s\+.*rb' | xargs bundle exec rubocop --except Metrics --autocorrect --format quiet --force-exclusion Gemfile && \
44
git diff --name-status --staged | grep '^[MA]' | grep -o '\s\+.*rb' | xargs git add

bin/run-in-docker.sh

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
# Example:
1616
# ./bin/run-in-docker.sh csharp tests/csharp/simple.cs
1717

18+
# Stop executing when a command returns a non-zero return code
19+
set -e
20+
1821
# If any required arguments is missing, print the usage and exit
1922
if [[ $# -lt 2 ]]; then
2023
echo "usage: ./bin/run-in-docker.sh track-slug <path/to/source/code/> [path/to/output/directory/]"

bin/run.sh

+3
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@
33
# Usage:
44
# ./bin/run.sh two_fer ~/solution/ ~/output/
55

6+
# Stop executing when a command returns a non-zero return code
7+
set -e
8+
69
ruby bin/run.rb $1 $2 $3

lib/snippet_extractor.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@
66
loader.setup
77

88
module SnippetExtractor
9-
def self.process_request(event:, context:)
10-
ProcessRequest.(event, context)
11-
end
9+
def self.process_request(event:, context:) = ProcessRequest.(event, context)
1210
end

lib/snippet_extractor/basic/extract.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ def call
1818
extracted_lines[0...10]
1919
end
2020

21-
def lines
22-
code.lines
23-
end
21+
def lines = code.lines
2422
end
2523
end
2624
end

template.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Resources:
2121
Path: /extract_snippet
2222
Method: post
2323
Metadata:
24-
DockerTag: ruby2.7-v1
24+
DockerTag: ruby3.2-v1
2525
DockerContext: ./
2626
Dockerfile: Dockerfile
2727

0 commit comments

Comments
 (0)