Skip to content

Remove support for Ruby 2.7 #634

Remove support for Ruby 2.7

Remove support for Ruby 2.7 #634

Workflow file for this run

name: Tests & Linting
on: pull_request
permissions:
contents: read
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
rubocop:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.0
bundler-cache: true
- name: rubocop
uses: reviewdog/action-rubocop@v2
with:
skip_install: true # use bundler
use_bundler: true
rubocop_flags: '--config .rubocop.yml'
fail_on_error: true
rspec-matrix:
runs-on: ubuntu-latest
strategy:
matrix:
ruby:
- '3.0'
- '3.1'
- '3.2'
gemfile:
- '3.5'
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rspec-${{ matrix.gemfile }}.gemfile
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Setup abq
uses: rwx-research/setup-abq@v1
with:
access-token: ${{ secrets.RWX_ACCESS_TOKEN }}
- uses: rwx-research/setup-captain@v1
- name: run rspec & upload to captain
run: |
captain run \
--suite-id rspec-abq \
--test-results tmp/rspec.json \
-- \
bundle exec rspec \
--format json --out tmp/rspec.json \
--format documentation && bin/check_num_tests.rb
if: ${{ matrix.ruby == 3.1 && matrix.gemfile == 3.12 }}
env:
RWX_ACCESS_TOKEN: ${{ secrets.RWX_ACCESS_TOKEN }}
timeout-minutes: 5
- name: run rspec without uploading to captain
run: |
bundle exec rspec \
--format json --out tmp/rspec.json \
--format documentation && bin/check_num_tests.rb
if: ${{ matrix.ruby != 3.1 || matrix.gemfile != 3.12 }}
timeout-minutes: 5
- name: Upload Coverage
if: always()
uses: actions/upload-artifact@v3
with:
name: coverage-${{ matrix.ruby }}-${{ matrix.gemfile }}
path: coverage/.resultset.json
# strategy borrowed from https://brunoscheufler.com/blog/2022-04-09-the-required-github-status-check-that-wasnt
# this is used to summarize the matrix results into a single job (abq-work) that can be used as a required check
collate-coverage:
needs: rspec-matrix
runs-on: ubuntu-latest
if: always()
steps:
- uses: actions/checkout@v3
- name: download coverage reports
uses: actions/download-artifact@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.0
bundler-cache: true
- name: collate coverage
run: |
gem install simplecov
ruby -e 'require "simplecov"; SimpleCov.collate Dir["**/.resultset.json"] { add_filter "/spec/" }'
- name: Upload Coverage
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage/
rspec-github-workflow-wrapup-helper:
needs: rspec-matrix # run after shards
runs-on: ubuntu-latest
if: success() # only run when matrix passed
# store success output flag for ci job
outputs:
success: ${{ steps.setoutput.outputs.success }}
steps:
- id: setoutput
run: echo "success=true" >> "$GITHUB_OUTPUT"
rspec:
runs-on: ubuntu-latest
if: always() # always run, so we never skip the check
needs: rspec-github-workflow-wrapup-helper
steps:
# pass step only when output of previous after-shards job is set
# in case at least one of the shard fails, after-shards is skipped
# and the output will not be set, which will then cause the ci job to fail
- run: |
passed="${{ needs.rspec-github-workflow-wrapup-helper.outputs.success }}"
if [[ $passed == "true" ]]; then
echo "Shards passed"
exit 0
else
echo "Shards failed"
exit 1
fi
nixfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v18
- run: nix fmt -- --check flake.nix
yard:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.0
bundler-cache: true
- run: bin/check_yard
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Lint github workflows
run: |
echo "::add-matcher::.github/actionlint-matcher.json"
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/3a2f2c755b6442ec7999b28dfd107e1bb9853389/scripts/download-actionlint.bash)
./actionlint -color
shell: bash