ElMassimo/js_from_routes

View on GitHub
.github/workflows/ruby.yml

Summary

Maintainability
Test Coverage
name: build

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - '**'

jobs:
  build:
    name: build
    runs-on: ${{ matrix.os }}
    continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' || matrix.experimental }}
    env:
      BUNDLE_JOBS: 4
      BUNDLE_RETRY: 3
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest]
        ruby: [
          3.0,
          3.2
        ]
        gemfile: [
          "gemfiles/Gemfile-rails.6.1.x",
          "gemfiles/Gemfile-rails.7.0.x"
        ]
        experimental: [false]
        include:
          - ruby: "3.2"
            os: ubuntu-latest
            gemfile: gemfiles/Gemfile-rails-edge
            experimental: true

    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v2
        with:
          path: /home/runner/bundle
          key: bundle-ruby-${{ matrix.ruby }}-${{ matrix.gemfile }}-gems-${{ hashFiles(matrix.gemfile) }}-${{ hashFiles('**/*.gemspec') }}
          restore-keys: |
            bundle-ruby-${{ matrix.ruby }}-${{ matrix.gemfile }}-gems-

      - uses: actions/setup-node@v2
        with:
          node-version: '15'

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

      - name: Bundle install
        run: |
          gem install bundler -v 2.1.4
          bundle config path /home/runner/bundle
          bundle config --global gemfile ${{ matrix.gemfile }}
          bundle install --jobs 4 --retry 3

      - 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: Ruby specs
        run: bundle exec rspec

      - name: Upload code coverage to Code Climate
        run: |
          export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
          ./cc-test-reporter after-build -r ${{secrets.CC_TEST_REPORTER_ID}}