diff mupdf-source/.github/workflows/test_python_pip.yml @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mupdf-source/.github/workflows/test_python_pip.yml	Mon Sep 15 11:43:07 2025 +0200
@@ -0,0 +1,73 @@
+name: Pip build/install and test of Python Bindings
+
+on:
+  schedule:
+    - cron: '13 5 * * *'
+  workflow_dispatch:
+    inputs:
+
+jobs:
+
+  test:
+    name: Pip build/install and test of Python Bindings
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ubuntu-latest, windows-2019, macos-latest]
+
+      # Avoid cancelling of all runs after a single failure.
+      fail-fast: false
+
+    steps:
+
+      - uses: actions/checkout@v2
+        with:
+          submodules: true
+      - uses: actions/setup-python@v2
+
+      - name: Pip build/install and test of Python Bindings
+
+        # We use a python script to run a series of commands, all inside a venv
+        # so that packages can be installed as required.
+        #
+        # We use pip to build and install the Python bindings. This
+        # will automatically install required packages as specified in
+        # pyproject.toml, and then use setup.py to build and install into the
+        # venv.
+        #
+        # Then we run MuPDF's python tests using the venv's newly-installed
+        # `mupdf` module.
+        #
+
+        run: |
+            import os
+            import platform
+            import subprocess
+            import sys
+
+            venv_name = 'pylocal'
+
+            command = ''
+            command += f'{sys.executable} -m venv {venv_name}'
+            if platform.system() == 'Windows':
+                command += f' && ./{venv_name}/Scripts/activate'.replace('/', os.sep)
+            else:
+                command += f' && . {venv_name}/bin/activate'
+            command += f' && python -m pip install -U pip setuptools'
+            command += f' && python -m pip install -vv .'
+            command += f' && python scripts/mupdfwrap.py -d - --test-python'
+
+            print(f'Running: {command}')
+            sys.stdout.flush()
+            subprocess.run( command, check=1, shell=1)
+
+        shell: python
+
+      - name: Archive generated code
+        uses: actions/upload-artifact@v4
+        if: failure()
+        with:
+          name: generated-code
+          path: |
+            platform/c++/
+            platform/python/