Skip to content

add rubocop action #1

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

Merged
merged 13 commits into from
Dec 5, 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
11 changes: 11 additions & 0 deletions .github/shared/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: "setup ruby"
description: "setup ruby"

runs:
using: "composite"
steps:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
working-directory: ./2024/ruby
1 change: 1 addition & 0 deletions .github/workflows/2018-ruby.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ jobs:
with:
ruby-version: ${{ steps.determine-ruby-version.outputs.VERSION }}
bundler-cache: true
working-directory: ./2018/ruby
- name: Run tests
run: bundle exec rspec
1 change: 1 addition & 0 deletions .github/workflows/2021-ruby.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ jobs:
with:
ruby-version: ${{ steps.determine-ruby-version.outputs.VERSION }}
bundler-cache: true
working-directory: ./2021/ruby
- name: Run tests
run: bundle exec rspec
22 changes: 13 additions & 9 deletions .github/workflows/2024-ruby.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: 2024-ruby
on:
pull_request:
push:
branches: [master]
paths:
- 2024/ruby/**

Expand All @@ -12,14 +11,19 @@ defaults:
working-directory: ./2024/ruby

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Ruby
uses: ./.github/shared/setup
- name: Run rubocop
run: bundle exec rubocop
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
working-directory: ./2024/ruby
- name: Run tests
run: bundle exec rspec
- uses: actions/checkout@v3
- name: Setup Ruby
uses: ./.github/shared/setup
- name: Run tests
run: bundle exec rspec
2 changes: 1 addition & 1 deletion 2018/ruby/spec/advent_03_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
expect(rectangle.width).to eq(4)
end

it "solves the puzzle", solution: true do
it "solves the puzzle", solution: true, slow: true do
reader = ClaimReader.new(puzzle_input)
claims = reader.process

Expand Down
4 changes: 2 additions & 2 deletions 2018/ruby/spec/advent_05_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
end
end

xit "solves part 1" do
it "solves part 1", slow: true do
reader = AlchemicalReduction.new(puzzle_input)
reader.process

Expand Down Expand Up @@ -55,7 +55,7 @@
expect(lowest[1]).to eq(4)
end

xit "solves part 2" do
it "solves part 2", slow: true do
counts = {}

('a'..'z').each do |letter|
Expand Down
5 changes: 2 additions & 3 deletions 2018/ruby/spec/advent_06_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,17 @@
expect(c.largest_area).to eq(17)
end

xit "solves part 1" do
it "solves part 1", slow: true do
coordinates = puzzle_input.collect do |item|
Coordinate.new(item[0], item[1])
end

c = ChronalCoordinates.new(coordinates)
# c.print_grid

expect(c.largest_area).to eq(3401)
end

it "solves part 2" do
it "solves part 2", slow: true do
coordinates = puzzle_input.collect do |item|
Coordinate.new(item[0], item[1])
end
Expand Down
4 changes: 2 additions & 2 deletions 2018/ruby/spec/advent_07_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def create_graph(input, weighted = false, seed_weight = 0)
expect(orderer.compressed_order).to eq("CABDFE")
end

xit "figures out the puzzle order" do
it "figures out the puzzle order", slow: true do
graph = create_graph(puzzle_input)

orderer = Orderer.new(graph)
Expand All @@ -76,7 +76,7 @@ def create_graph(input, weighted = false, seed_weight = 0)
expect(seconds).to eq(15)
end

xit "figures out part 2 puzzle order" do
it "figures out part 2 puzzle order", slow: true do
graph = create_graph(puzzle_input, true, 60)

orderer = Orderer.new(graph)
Expand Down
Loading