.github/workflows/tests.yml in scan_left-0.3.0 vs .github/workflows/tests.yml in scan_left-0.3.1

- old
+ new

@@ -1,32 +1,39 @@ -# based on https://github.com/ruby/setup-ruby/blob/master/README.md -name: Tests -on: [push, pull_request] +name: Main +on: + pull_request: + branches: + - main + push: + branches: + - main jobs: ci: name: CI strategy: fail-fast: false matrix: - os: [ ubuntu-latest ] - ruby: [ 2.5, 2.6, 2.7, jruby ] - runs-on: ${{ matrix.os }} - env: - CI: true + # Due to https://github.com/actions/runner/issues/849, we have to use + # quotes for '3.0'. Without quotes, CI runs 3.1. + ruby: [ jruby, truffleruby, 2.5, 2.6, 2.7, '3.0', 3.1 ] + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + + # Conditionally configure bundler via environment variables as advised + # * https://github.com/ruby/setup-ruby#bundle-config + - name: Set bundler environment variables + run: | + echo "BUNDLE_WITHOUT=checks" >> $GITHUB_ENV + if: matrix.ruby != 3.1 + + # Use 'bundler-cache: true' instead of actions/cache as advised: + # * https://github.com/actions/cache/blob/main/examples.md#ruby---bundler - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} - - uses: actions/cache@v1 - with: - path: vendor/bundle - key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby }}- - - name: bundle install - run: | - ruby -v - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 - - run: bundle exec rubocop + bundler-cache: true + - run: bundle exec rspec + + - run: bundle exec rubocop + if: matrix.ruby == 3.1