name: Code Coverage on: push: branches: [ master ] pull_request: branches: [ master ] workflow_dispatch: jobs: coverage: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' cache: pip - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e ".[dev]" pip install pytest-cov - name: Run coverage tests in parallel run: | # Create a simple script to run coverage tests in parallel cat > run_parallel_coverage.py << 'EOF' import concurrent.futures import subprocess import sys def run_coverage(args): test_path, module_path = args cmd = ['python', '-m', 'devscripts.run_coverage', test_path, module_path] return subprocess.run(cmd, check=True) coverage_tests = [ ('test/test_utils.py', 'yt_dlp.utils'), ('test/test_YoutubeDL.py', 'yt_dlp.YoutubeDL') ] with concurrent.futures.ThreadPoolExecutor(max_workers=3) as executor: futures = [executor.submit(run_coverage, test) for test in coverage_tests] for future in concurrent.futures.as_completed(futures): try: future.result() except subprocess.CalledProcessError as e: print(f"Error running coverage: {e}") sys.exit(1) EOF # Run the script python run_parallel_coverage.py - name: Archive coverage results uses: actions/upload-artifact@v4 with: name: coverage-report path: | .coverage-reports/html/ .coverage-reports/coverage.xml