name: CIT Hotrod

on:
  push:
    branches: [main]

  pull_request:
    branches: [main]

jobs:
  hotrod:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2.4.0
      with:
        submodules: true

    - name: Fetch git tags
      run: |
        git fetch --prune --unshallow --tags

    - uses: actions/setup-go@v2
      with:
        go-version: ^1.17

    - name: Export BRANCH variable
      uses: ./.github/actions/setup-branch

    - name: Install tools
      run: make install-ci
    
    - uses: docker/setup-qemu-action@v1

    - name: Build, test, and publish hotrod image
      run: bash scripts/hotrod-integration-test.sh
      env:
        DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
        QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
