name: Run Integration Test Scripts

on:
  workflow_dispatch:
  pull_request:
    paths:
      - '.github/workflows/test-scripts.yml'
      - 'arelle/**'
      - 'tests/**'
      - '**.py'
      - '**.pyw'
      - 'requirements*.txt'

permissions: {}

jobs:
  run-tests:
    name: ${{ matrix.os }} - ${{ matrix.python-version }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os:
          - macos-15
          - ubuntu-24.04
          - windows-2022
        python-version:
          - '3.9'
          - '3.10'
          - '3.11'
          - '3.12'
          - '3.13.8'
    steps:
      - uses: actions/checkout@v5.0.0
      - name: Install Python 3
        uses: actions/setup-python@v6.0.0
        with:
          cache: 'pip'
          check-latest: true
          python-version: ${{ matrix.python-version }}
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip setuptools wheel
          pip install -r requirements-test.txt
          pip install -r requirements-plugins.txt
      - name: Run integration tests with pytest
        run: |
          pytest -s --disable-warnings --all --download-cache --offline --arelle="python arelleCmdLine.py" tests/integration_tests/scripts/test_scripts.py
      - name: Upload log artifacts
        if: always()
        uses: actions/upload-artifact@v4.6.2
        with:
          name: ${{ matrix.os }}_${{ matrix.python-version }}_logs
          if-no-files-found: error
          include-hidden-files: true
          path: '.test/**/*.logfile.*'
