name: Test Resources (workers, tools, etc.)

on:
  pull_request:
    types: [labeled]

jobs:
  test-resources:
    # Only run on PRs targeting main labeled with 'run-integration-tests'
    if: github.base_ref == 'main' && github.event.label.name == 'run-integration-tests'
    runs-on: ubuntu-latest
    env:
      SHOPIFY_FIXED_ARGS: ${{ secrets.SHOPIFY_FIXED_ARGS }}
      OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up Python 3.10
        uses: actions/setup-python@v4
        with:
          python-version: '3.10'

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -e '.[milvus,shopify,hubspot]' --quiet

      - name: Test with pytest
        run: |
          pytest tests/ --cov=arklex --cov-report=term-missing --cov-report=html --no-cov-on-fail