lxxxvi/ruboclean

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
env:
  CC_TEST_REPORTER_BINARY_URL: https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
  CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}

name: Continuous Integration
on:
  push:
    branches:
      - 'main'  # Set a branch to deploy
  pull_request:

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest]
        ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4', head]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v3

      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}
          bundler-cache: true

      # prepare CC test reporter
      - name: Download CC test reporter binary
        run: |
          curl -L ${CC_TEST_REPORTER_BINARY_URL} > ./cc-test-reporter
          chmod +x ./cc-test-reporter
          ./cc-test-reporter before-build

      # run tests
      - name: Run tests
        run: bin/test

      # report to CC
      - run: ./cc-test-reporter after-build --exit-code 1
        if: ${{ failure() }}

      - run: ./cc-test-reporter after-build --exit-code 0
        if: ${{ success() }}