Skip to content

Commit 98aecf6

Browse files
Cache dependencies using ruby/setup-ruby
To speed our CI a bit, let's cache the dependencies. I am using the recommended cache strategy for Ruby: https://github.com/actions/cache/blob/main/examples.md#ruby---bundler Additionally, to use the without configuration, we need to explicitely use the configuration keys through the environment: https://bundler.io/man/bundle-config.1.html#CONFIGURATION-KEYS
1 parent d703d80 commit 98aecf6

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

.github/workflows/bench.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ jobs:
1919
- uses: ruby/setup-ruby@v1
2020
with:
2121
ruby-version: '4.0'
22-
- name: Install dependencies
23-
run: bundle install
22+
bundler-cache: true
2423

2524
- name: Generators
2625
run: RUBYOPT="-W0" bundle exec ruby benchmark/generators.rb

.github/workflows/ruby.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,22 @@ jobs:
2121
lint:
2222
name: RuboCop
2323
runs-on: ubuntu-latest
24+
env:
25+
BUNDLE_WITHOUT: benchmark
2426
steps:
2527
- uses: actions/checkout@v6
2628
- uses: ruby/setup-ruby@v1
2729
with:
2830
ruby-version: '4.0'
29-
30-
- name: Install dependencies
31-
run: bundle install
31+
bundler-cache: true
3232

3333
- name: Run RuboCop
3434
run: bundle exec rake rubocop
3535
test:
3636
name: Ruby ${{ matrix.ruby }}
3737
runs-on: ubuntu-latest
38+
env:
39+
BUNDLE_WITHOUT: benchmark
3840
strategy:
3941
fail-fast: false # don't fail all matrix builds if one fails
4042
matrix:
@@ -52,11 +54,7 @@ jobs:
5254
- uses: ruby/setup-ruby@v1
5355
with:
5456
ruby-version: ${{ matrix.ruby }}
55-
56-
- name: Install dependencies
57-
run: |
58-
bundle config set --without benchmark
59-
bundle install
57+
bundler-cache: true
6058

6159
- name: Run tests
6260
run: bundle exec rake test

0 commit comments

Comments
 (0)