Do not depend on setup-ruby cache to make robust CI (#550) #336
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://docs.github.com/ja/actions/reference/workflow-syntax-for-github-actions | |
name: CI | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/ci.yml' | |
- 'lib/**' | |
- 'test/**' | |
- 'spec/**' | |
- '.rspec' | |
- '**.gemspec' | |
- 'Gemfile' | |
- 'Rakefile' | |
- '.ruby-version' | |
pull_request: | |
paths: | |
- '.github/workflows/ci.yml' | |
- 'lib/**' | |
- 'test/**' | |
- 'spec/**' | |
- '.rspec' | |
- '**.gemspec' | |
- 'Gemfile' | |
- 'Rakefile' | |
- '.ruby-version' | |
jobs: | |
test: | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
# Syntax https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs | |
matrix: | |
# macos is covered in nix ci | |
os: ['ubuntu-24.04'] | |
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for 'n.0' | |
ruby: ['head', '3.3', '3.2'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
# libyaml is needed for psych, see https://github.com/actions/runner-images/issues/9895 | |
# GitHub installs libyaml-dev in latest runners, but often dropped in new runners. | |
- name: Install libyaml | |
if: startsWith(matrix.os, 'ubuntu-') | |
run: sudo apt-get install --no-install-recommends --assume-yes libyaml-dev | |
- uses: actions/checkout@v4 | |
- uses: ruby/setup-ruby@943103cae7d3f1bb1e4951d5fcc7928b40e4b742 # v1.177.1 | |
env: | |
# https://github.com/kachick/ruby-ulid/blob/104834846baf5caa1e8536a11c43acdd56fc849c/CONTRIBUTING.md#adding-dependencies-for-this-gem | |
BUNDLE_WITHOUT: development | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
# Enabling is the recommended way, but it cannot detect runner changes in early stage. | |
# So disable it is better for test job, do not mind in other jobs | |
bundler-cache: false # runs 'bundle install' and caches installed gems automatically | |
- run: bundle install | |
- run: bundle exec rake test_all --suppress-backtrace='\/bundle' | |
env: | |
# Need same specifying for now(want to squash) | |
BUNDLE_WITHOUT: development |