name: build

on: [push, pull_request]

jobs:
  build:
    env:
      AWS_ACCESS_KEY_ID: secret
      AWS_SECRET_ACCESS_KEY: secret
      CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
      GIT_COMMIT_SHA: ${{ github.sha }}
      GIT_BRANCH: ${{ github.ref }}

    runs-on: ubuntu-latest

    strategy:
      matrix:
        ruby: [2.4.x, 2.5.x, 2.6.x]

    steps:
    - uses: actions/checkout@v1

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

    - name: Set up reporter
      if: matrix.ruby == '2.6.x'
      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: Run tests
      run: |
        gem install bundler
        bundle install --jobs 4 --retry 3
        bundle exec rake

    - name: Report
      continue-on-error: true
      if: success() && matrix.ruby == '2.6.x'
      run: ./cc-test-reporter after-build --exit-code $?

name: build

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        ruby: [2.4.x, 2.5.x, 2.6.x]

    steps:
    - uses: actions/checkout@v1

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

    - name: Set up reporter
      if: matrix.ruby == '2.6.x'
      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: Run tests
      run: |
        gem install bundler
        bundle install --jobs 4 --retry 3
        bundle exec rake
      env:
        AWS_ACCESS_KEY_ID: secret
        AWS_SECRET_ACCESS_KEY: secret

    - name: Report
      continue-on-error: true
      if: success() && matrix.ruby == '2.6.x'
      run: GIT_BRANCH="${GITHUB_REF/refs\/heads\//}" ./cc-test-reporter after-build --exit-code $?
      env:
        CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
        GIT_COMMIT_SHA: ${{ github.sha }}

Fix branch when reporting test coverage
Fix branch when reporting test coverage
