.github/workflows/ci.yml
name: Ruby
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.7', '3.1', '3.2']
steps:
- uses: actions/checkout@v3
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Install dependencies
run: bundle install --no-cache
- name: Run tests
run: bundle exec rspec
- uses: joshmfrankel/simplecov-check-action@main
with:
minimum_suite_coverage: 85
minimum_file_coverage: 70
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Workaround for coverage report to CodeClimate with jq
if: startsWith(matrix.ruby-version, '3')
run: |
jq 'map_values(. | map_values(if type=="object" then map_values(.lines) else . end))' coverage/.resultset.json > coverage/.resultset_workaround.json
diff -uw coverage/.resultset.json coverage/.resultset_workaround.json || true
- name: Send coverage report to CodeClimate
if: startsWith(matrix.ruby-version, '3')
continue-on-error: true
uses: paambaati/codeclimate-action@v3.0.0
with:
coverageLocations: ${{ github.workspace }}/coverage/.resultset_workaround.json:simplecov
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}