jmazur/go_transit_ruby

View on GitHub
.github/workflows/tests.yml

Summary

Maintainability
Test Coverage
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: Tests

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

permissions:
  contents: read

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        ruby-version: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2']
    env:
      CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
    steps:
    - uses: actions/checkout@v3
    - name: Remove gemfile.lock
      run: rm Gemfile.lock
    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby-version }}
    - name: Bundle install
      run: bundle install
    - name: Install cc-test-reporter
      run: |
        mkdir -p ./tmp/
        curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./tmp/cc-test-reporter
        chmod +x ./tmp/cc-test-reporter
    - name: Notify pending build
      run: ./tmp/cc-test-reporter before-build
    - name: Run tests
      run: bundle exec rspec spec
    - name: Format test coverage
      run: ./tmp/cc-test-reporter format-coverage -t simplecov ./coverage/.resultset.json
    - name: Upload coverage
      run: ./tmp/cc-test-reporter upload-coverage