diff --git a/.github/shared/setup/action.yaml b/.github/shared/setup/action.yaml new file mode 100644 index 0000000..bc7ca11 --- /dev/null +++ b/.github/shared/setup/action.yaml @@ -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 diff --git a/.github/workflows/2018-ruby.yaml b/.github/workflows/2018-ruby.yaml index f3ab9e0..f2a78b0 100644 --- a/.github/workflows/2018-ruby.yaml +++ b/.github/workflows/2018-ruby.yaml @@ -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 diff --git a/.github/workflows/2021-ruby.yaml b/.github/workflows/2021-ruby.yaml index e3ad965..9231707 100644 --- a/.github/workflows/2021-ruby.yaml +++ b/.github/workflows/2021-ruby.yaml @@ -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 diff --git a/.github/workflows/2024-ruby.yaml b/.github/workflows/2024-ruby.yaml index e2571b5..72ae51d 100644 --- a/.github/workflows/2024-ruby.yaml +++ b/.github/workflows/2024-ruby.yaml @@ -3,7 +3,6 @@ name: 2024-ruby on: pull_request: push: - branches: [master] paths: - 2024/ruby/** @@ -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 diff --git a/2018/ruby/spec/advent_03_spec.rb b/2018/ruby/spec/advent_03_spec.rb index 073cebe..796e22b 100644 --- a/2018/ruby/spec/advent_03_spec.rb +++ b/2018/ruby/spec/advent_03_spec.rb @@ -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 diff --git a/2018/ruby/spec/advent_05_spec.rb b/2018/ruby/spec/advent_05_spec.rb index 7a3c45c..caac678 100644 --- a/2018/ruby/spec/advent_05_spec.rb +++ b/2018/ruby/spec/advent_05_spec.rb @@ -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 @@ -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| diff --git a/2018/ruby/spec/advent_06_spec.rb b/2018/ruby/spec/advent_06_spec.rb index f33941b..107760d 100644 --- a/2018/ruby/spec/advent_06_spec.rb +++ b/2018/ruby/spec/advent_06_spec.rb @@ -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 diff --git a/2018/ruby/spec/advent_07_spec.rb b/2018/ruby/spec/advent_07_spec.rb index 4e5dfe9..3a0a584 100644 --- a/2018/ruby/spec/advent_07_spec.rb +++ b/2018/ruby/spec/advent_07_spec.rb @@ -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) @@ -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)