diff --git a/.github/workflows/solutions.yml b/.github/workflows/solutions.yml new file mode 100644 index 0000000..fd61cf1 --- /dev/null +++ b/.github/workflows/solutions.yml @@ -0,0 +1,25 @@ +name: Solutions + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + continue-on-error: true + + steps: + - uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.3.4 + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Run tests + run: bundle exec bin/aoc all diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d5de92c..8e101f2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,27 +2,23 @@ name: Test on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] permissions: contents: read jobs: test: - runs-on: ubuntu-latest - + steps: - - uses: actions/checkout@v4 - - name: Set up Ruby - # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, - # change this to (see https://github.com/ruby/setup-ruby#versioning): - # uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0 - with: - ruby-version: 3.3.4 - bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - name: Run tests - run: bundle exec rspec + - uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.3.4 + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Run tests + run: bundle exec rspec diff --git a/bin/aoc b/bin/aoc index a1171ad..bd24edd 100755 --- a/bin/aoc +++ b/bin/aoc @@ -3,11 +3,17 @@ require_relative '../lib/application' if ARGV.empty? - puts "Usage: bin/aoc DAY" - puts "Example: bin/aoc 1" + puts 'Usage: bin/aoc DAY' + puts 'Example: bin/aoc 1' + puts 'To run all solutions: bin/aoc all' exit 1 end -day = ARGV[0].to_i -AdventOfCode2024.run(day) - +if ARGV[0].downcase == 'all' + 1.upto(25) do |day| + AdventOfCode2024.run(day) + end +else + day = ARGV[0].to_i + AdventOfCode2024.run(day) +end