[CI-CD] Add/update Ruby Test and Coverage workflow #5
Workflow file for this run
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
name: CI with Code Climate Coverage | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
ruby-version: [3.0, 3.1, 3.2] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby-version }} | |
bundler-cache: true | |
- name: Install dependencies | |
run: bundle install | |
- name: Run tests and generate coverage | |
run: bundle exec rspec | |
- name: Install Code Climate CLI | |
run: | | |
curl -L https://github.com/codeclimate/codeclimate/archive/refs/tags/v0.8.1.tar.gz | tar xz | |
cd codeclimate-0.8.1 | |
make build | |
sudo mv bin/codeclimate /usr/local/bin/ | |
cd .. | |
- name: Upload coverage to Code Climate | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
run: | | |
codeclimate-test-reporter before-build | |
codeclimate-test-reporter format-coverage -t simplecov | |
codeclimate-test-reporter upload-coverage |