Validate to build gem (#596) #371
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 }} | |
env: | |
# https://github.com/kachick/ruby-ulid/blob/104834846baf5caa1e8536a11c43acdd56fc849c/CONTRIBUTING.md#adding-dependencies-for-this-gem | |
BUNDLE_WITHOUT: development | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0 | |
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' | |
- run: bundle exec rake validate_gem |