Skip to content

Instantly share code, notes, and snippets.

@jcypret
Created October 29, 2019 03:06
Show Gist options
  • Save jcypret/608731eed983dd46a9e7447791c86cdb to your computer and use it in GitHub Desktop.
Save jcypret/608731eed983dd46a9e7447791c86cdb to your computer and use it in GitHub Desktop.
Ruby CI (RSpec + CodeClimate) using GitHub Actions
name: build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install Ruby (2.6)
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Setup Code Climate test-reporter
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: Build and test with RSpec
run: |
gem install bundler
bundle install --jobs 4 --retry 3
bundle exec rspec
- name: Publish code coverage
run: |
export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
./cc-test-reporter after-build -r ${{secrets.CC_TEST_REPORTER_ID}}
@davidauza-engineer
Copy link

Thank you for sharing this! 💪 👍

@aarongough
Copy link

Quick note: you cannot use SimpleCov 0.18.x with this workflow because the Code Climate coverage reporter is not compatible with the newer version of SimpleCov. Downgrading to 0.17.1 fixes the issue...

Thanks for the workflow!

@nicholalexander
Copy link

hi @aarongough ! nice to run into you! 😄
thanks for the post @jcypret ! super helpful!

One other thing I found, for others who come this way was to use https://github.com/vicentllongo/simplecov-json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment