Handle external URL references in archives for offline Kolibri use #923
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Python tests | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - main | |
| pull_request: | |
| branches: | |
| - develop | |
| - main | |
| jobs: | |
| pre_job: | |
| name: Path match check | |
| runs-on: ubuntu-latest | |
| # Map a step output to a job output | |
| outputs: | |
| should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
| steps: | |
| - id: skip_check | |
| uses: fkirc/skip-duplicate-actions@master | |
| with: | |
| github_token: ${{ github.token }} | |
| paths: '["**.py", "requirements_test.txt", ".github/workflows/pythontest.yml"]' | |
| unit_test: | |
| name: Python unit tests | |
| needs: pre_job | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| max-parallel: 5 | |
| fail-fast: false | |
| matrix: | |
| os: [windows-latest, ubuntu-latest, macos-latest] | |
| python-version: [3.9, '3.10', '3.11', '3.12', '3.13'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
| - name: Set up Python ${{ matrix.python-version }} | |
| if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install Ubuntu dependencies | |
| run: | | |
| sudo apt-get -y -qq update | |
| sudo apt-get install -y ffmpeg | |
| sudo apt-get install -y poppler-utils | |
| if: ${{ needs.pre_job.outputs.should_skip != 'true' && startsWith(matrix.os, 'ubuntu') }} | |
| - name: Cache Mac dependencies | |
| uses: actions/cache@v5 | |
| if: needs.pre_job.outputs.should_skip != 'true' && matrix.os == 'macos-latest' | |
| with: | |
| path: ~/Library/Caches/Homebrew | |
| key: ${{ runner.os }}-brew-${{ hashFiles('.github/workflows/pythontest.yml') }} | |
| - name: Unlink Homebrew Python 3.13 if not testing 3.13 | |
| if: needs.pre_job.outputs.should_skip != 'true' && matrix.os == 'macos-latest' && matrix.python-version != '3.13' | |
| run: brew unlink python@3.13 || true | |
| - name: Install Mac dependencies | |
| run: | | |
| # Conditionally link python@3.13 to avoid conflicts when testing Python 3.13 | |
| # See: https://github.com/actions/runner-images/issues/9966 | |
| if [[ "${{ matrix.python-version }}" != "3.13" ]]; then | |
| echo "Linking Homebrew python@3.13" | |
| brew link --overwrite python@3.13 | |
| else | |
| echo "Skipping Homebrew python@3.13 linking for Python 3.13 test." | |
| fi | |
| brew install ffmpeg poppler | |
| if: needs.pre_job.outputs.should_skip != 'true' && matrix.os == 'macos-latest' | |
| - name: Windows dependencies cache | |
| id: windowscache | |
| if: needs.pre_job.outputs.should_skip != 'true' && matrix.os == 'windows-latest' | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ github.workspace }}\tools | |
| key: ${{ runner.os }}-${{ matrix.python-version }}-tools-${{ hashFiles('.github/workflows/pythontest.yml') }} | |
| - name: Download Windows dependencies if needed | |
| if: needs.pre_job.outputs.should_skip != 'true' && matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| # Create tools directory if it doesn't exist | |
| New-Item -Path "tools" -ItemType Directory -Force -ErrorAction SilentlyContinue | |
| # Check and download FFmpeg if needed | |
| if (-not (Test-Path "$env:GITHUB_WORKSPACE\tools\ffmpeg-master-latest-win64-gpl\bin\ffmpeg.exe")) { | |
| Write-Output "FFmpeg not found, downloading..." | |
| curl.exe --output ffmpeg.zip -L https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip | |
| 7z x ffmpeg.zip -otools -y | |
| } else { | |
| Write-Output "FFmpeg already exists, skipping download" | |
| } | |
| # Check and download Poppler if needed | |
| if (-not (Test-Path "$env:GITHUB_WORKSPACE\tools\poppler-21.11.0\Library\bin\pdfinfo.exe")) { | |
| Write-Output "Poppler not found, downloading..." | |
| curl.exe --output poppler.zip -L https://github.com/oschwartz10612/poppler-windows/releases/download/v21.11.0-0/Release-21.11.0-0.zip | |
| 7z x poppler.zip -otools -y | |
| } else { | |
| Write-Output "Poppler already exists, skipping download" | |
| } | |
| - name: Set paths to Windows dependencies | |
| if: needs.pre_job.outputs.should_skip != 'true' && matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| Add-Content -Path $env:GITHUB_PATH -Value "$env:GITHUB_WORKSPACE\tools\ffmpeg-master-latest-win64-gpl\bin" -Encoding utf8 | |
| Add-Content -Path $env:GITHUB_PATH -Value "$env:GITHUB_WORKSPACE\tools\poppler-21.11.0\Library\bin" -Encoding utf8 | |
| - name: Install tox | |
| if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install tox | |
| - name: tox env cache | |
| if: ${{ needs.pre_job.outputs.should_skip != 'true' && !startsWith(runner.os, 'windows') }} | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ github.workspace }}/.tox/py${{ matrix.python-version }} | |
| key: ${{ runner.os }}-tox-py${{ matrix.python-version }}-${{ hashFiles('setup.py') }} | |
| - name: Test with tox | |
| if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
| run: tox -e py${{ matrix.python-version }} |