name: Test

on:
  pull_request:
  push:
    branches:
      - master
      - spec_live

jobs:
  test-and-lint:
    name: Test and lint
    runs-on: ubuntu-latest
    strategy:
      matrix:
        ruby:
          - 2.5
          - 2.6
          - 2.7
          - 3.0
          - 3.1
          - jruby-9.1
          - jruby-9.2
    steps:
      - name: Checkout code
        uses: zendesk/checkout@v2
      - name: Set up Ruby
        uses: zendesk/setup-ruby@v1
        with:
          bundler-cache: true
          ruby-version: ${{ matrix.ruby }}
      - name: Test and Lint
        run: |
          bundle install
          bundle exec rake
          bundle exec rubocop
  spec-live:
    name: Spec live
    if: github.repository == 'zendesk/zendesk_api_client_rb'
    env:
      SPEC_LIVE_USERNAME: ${{ secrets.SPEC_LIVE_USERNAME }}
      SPEC_LIVE_PASSWORD: ${{ secrets.SPEC_LIVE_PASSWORD }}
      SPEC_LIVE_ZENDESK_HOST: ${{ secrets.SPEC_LIVE_ZENDESK_HOST }}
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: zendesk/checkout@v2
      - name: Set up Ruby
        uses: zendesk/setup-ruby@v1
        with:
          bundler-cache: true
          ruby-version: 2.6
      - name: spec:live
        run: |
          bundle install
          bundle exec rake clean_live set_ci_credentials spec:live

name: Test

on:
  pull_request:
  push:
    branches:
      - master
      - spec_live

jobs:
  test-and-lint:
    name: Test and lint
    runs-on: ubuntu-latest
    strategy:
      matrix:
        ruby:
          - 2.6
          - 2.7
          - 3.0
          - 3.1
          - jruby-9.1
          - jruby-9.2
    steps:
      - name: Checkout code
        uses: zendesk/checkout@v2
      - name: Set up Ruby
        uses: zendesk/setup-ruby@v1
        with:
          bundler-cache: true
          ruby-version: ${{ matrix.ruby }}
      - name: Test and Lint
        run: |
          bundle install
          bundle exec rake
          bundle exec rubocop
  spec-live:
    name: Spec live
    if: github.repository == 'zendesk/zendesk_api_client_rb'
    env:
      SPEC_LIVE_USERNAME: ${{ secrets.SPEC_LIVE_USERNAME }}
      SPEC_LIVE_PASSWORD: ${{ secrets.SPEC_LIVE_PASSWORD }}
      SPEC_LIVE_ZENDESK_HOST: ${{ secrets.SPEC_LIVE_ZENDESK_HOST }}
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: zendesk/checkout@v2
      - name: Set up Ruby
        uses: zendesk/setup-ruby@v1
        with:
          bundler-cache: true
          ruby-version: 2.6
      - name: spec:live
        run: |
          bundle install
          bundle exec rake clean_live set_ci_credentials spec:live

Remove Ruby 2.5 from CI (eol)
Remove Ruby 2.5 from CI (eol)
