Skip to content

Commit

Permalink
Update github actions config
Browse files Browse the repository at this point in the history
  • Loading branch information
ariejan committed Nov 15, 2024
1 parent ee58d5c commit 64b90eb
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 20 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/solutions.yml
Original file line number Diff line number Diff line change
@@ -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
26 changes: 11 additions & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 11 additions & 5 deletions bin/aoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 64b90eb

Please sign in to comment.