name: APM Parametric Tests

on:
  workflow_call: # allows to reuse this workflow
    inputs:
      branch_ref:
        description: 'The branch to run the workflow on'
        required: true
        type: string
  push:
    branches:
      - release-v*
      - mq-working-branch-**
    tags-ignore:
      - 'contrib/**'
      - 'instrumentation/**'
      - 'internal/**'
      - 'orchestrion/**'
      - 'scripts/**'
  pull_request:
  workflow_dispatch:
    inputs:
      ref:
        description: 'System Tests ref/tag/branch'
        required: true
        default: main
        type: string
  schedule:
    - cron:  '00 04 * * 2-6'

permissions:
  contents: read

jobs:
  parametric-tests:
    if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'DataDog/dd-trace-go')
    runs-on:
      group: "APM Larger Runners"
    env:
      TEST_LIBRARY: golang
    steps:
      - name: Checkout system tests
        uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
        with:
          repository: 'DataDog/system-tests'
          ref: ${{ inputs.ref }}

      - name: Checkout dd-trace-go
        uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
        with:
          ref: ${{ inputs.branch_ref || github.ref }}
          path: 'binaries/dd-trace-go'

      - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
        with:
          go-version: "oldstable"

      - name: Build runner
        uses: ./.github/actions/install_runner

      - name: Run
        run: ./run.sh PARAMETRIC
