Description
First of all, thank you for providing this amazing GitHub Action! It's been a really great addition to my CI workflows.
Something I've found a lot of value in with the ruby/setup-ruby
action is the ability to run bundle install
and cache the gems as a part of the action with the bundler-cache: true
option.
Is something like a shards-cache: true
option something that the maintainers would be open to as a part of this action? I haven't worked with writing GitHub actions before, so I wanted to make sure there was an appetite to review a PR before taking the time to learn and implement one.
This would reduce the common copy-and-paste that I do to every Crystal project, which generally does these steps every time:
steps:
- uses: actions/[email protected]
- uses: crystal-lang/install-crystal@v1
with:
crystal: latest
- name: Set up Crystal cache
uses: actions/[email protected]
id: crystal-cache
with:
path: |
~/.cache/crystal
bin/ameba
lib
key: ${{ runner.os }}-crystal-${{ matrix.crystal_version }}-${{ hashFiles('**/shard.lock') }}
restore-keys: |
${{ runner.os }}-crystal-${{ matrix.crystal_version }}
- name: Install shards
if: steps.crystal-cache.outputs.cache-hit != 'true'
run: shards check || shards install --ignore-crystal-version
- name: Run tests
run: crystal spec
My hope would be that these steps could be reduced to (naming TBD):
steps:
- uses: actions/[email protected]
- uses: crystal-lang/install-crystal@v1
with:
crystal: latest
shards-cache: true
shards-cache-ignore-crystal-version: true
shards-cache-additional-paths: bin/ameba
- name: Run tests
run: crystal spec
Or, if you didn't use something like Ameba and didn't do matrix testing against old Crystal versions, something as simple as:
steps:
- uses: actions/[email protected]
- uses: crystal-lang/install-crystal@v1
with:
crystal: latest
shards-cache: true
- name: Run tests
run: crystal spec