name: Interoperability Testing

on:
  workflow_dispatch:
  pull_request:
    paths:
      - 'config/**'
      - 'core/**'
      - 'internal/**'
      - 'p2p/**'
      - 'test-plans/**'
      - '.github/workflows/interop-test.yml'
  push:
    branches:
      - "master"
    paths:
      - 'config/**'
      - 'core/**'
      - 'internal/**'
      - 'p2p/**'
      - 'test-plans/**'

jobs:
  run-transport-interop:
    name: Run transport interoperability tests
    runs-on: ${{ fromJSON(vars['INTEROP_TEST_RUNNER_UBUNTU'] || '"ubuntu-22.04"') }}
    steps:
      - name: Free Disk Space (Ubuntu)
        if: vars['INTEROP_TEST_RUNNER_UBUNTU'] == ''
        uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
        with:
          tool-cache: true
      - uses: actions/checkout@v4
      - name: Build image
        run: docker build -t go-libp2p-head -f test-plans/PingDockerfile .
      - uses: libp2p/test-plans/.github/actions/run-transport-interop-test@master
        with:
          test-filter: go-libp2p-head
          extra-versions: ${{ github.workspace }}/test-plans/ping-version.json
          s3-cache-bucket: ${{ vars.S3_LIBP2P_BUILD_CACHE_BUCKET_NAME }}
          s3-access-key-id: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_ACCESS_KEY_ID }}
          s3-secret-access-key: ${{ secrets.S3_LIBP2P_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }}
