frankvielma/timet

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
name: Ruby

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

permissions:
  contents: read

jobs:
  tests:
    strategy:
      fail-fast: false
      matrix:
        ruby-version: ["3.3"]
        os: [ubuntu-latest]
    runs-on: ${{ matrix.os }}

    steps:
      - uses: actions/checkout@v4

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

      - name: Install dependencies
        run: |
          gem install bundler
          bundle install --jobs 4 --retry 3

      - name: Run tests with coverage
        run: |
          bundle exec rspec
        env:
          COVERAGE: true

      - name: Code Climate Run before-test
        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
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}

      - name: Publish code coverage
        run: |
          ./cc-test-reporter format-coverage -t simplecov -o coverage/codeclimate.json
          ./cc-test-reporter upload-coverage
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}

      - name: Code Climate After-test
        run: ./cc-test-reporter after-build --exit-code $?
        if: always()
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}