From 9f5890e59ef3eff2b7d86118359c89c0336d7be2 Mon Sep 17 00:00:00 2001 From: Craig Macdonald Date: Wed, 20 Dec 2023 14:50:40 +0000 Subject: [PATCH 1/8] lets see if CI works with a JRE rather than JDK --- .github/workflows/create.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/create.yml b/.github/workflows/create.yml index d78194ef..3cbfc4e5 100644 --- a/.github/workflows/create.yml +++ b/.github/workflows/create.yml @@ -152,6 +152,7 @@ jobs: with: java-version: '17' distribution: 'temurin' + java-package: 'jre' architecture: ${{ matrix.architecture }} - name: Setup ant on macOS From 4fa842c34122cbcc2c4b27e9dd10099a1353f09e Mon Sep 17 00:00:00 2001 From: Craig Macdonald Date: Wed, 20 Dec 2023 15:29:27 +0000 Subject: [PATCH 2/8] add new action testing wheels on JREs --- .github/workflows/test-wheels.yml | 210 ++++++++++++++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 .github/workflows/test-wheels.yml diff --git a/.github/workflows/test-wheels.yml b/.github/workflows/test-wheels.yml new file mode 100644 index 00000000..17cc8f56 --- /dev/null +++ b/.github/workflows/test-wheels.yml @@ -0,0 +1,210 @@ +on: + push: + pull_request: + create: + + name: Continuous Integration - Testing Wheels on JREs + jobs: + build_wheels: + name: cibuildwheel on ${{ matrix.os }} ${{ matrix.architecture }} + env: + CIBW_BEFORE_ALL_LINUX: 'yum install -y java-11-openjdk-devel' + CIBW_REPAIR_WHEEL_COMMAND_MACOS: '' + CIBW_SKIP: 'cp36-* *musllinux*' + strategy: + matrix: + include: + - os: windows-latest + architecture: 'x86' + cibw_archs: 'x86' + - os: windows-latest + architecture: 'x64' + cibw_archs: 'AMD64' + - os: ubuntu-latest + architecture: 'x64' + cibw_archs: 'x86_64' + - os: kivy-ubuntu-arm64 + architecture: 'aarch64' + cibw_archs: aarch64 + - os: macos-latest + architecture: 'x64' + cibw_archs: 'x86_64 universal2' + runs-on: ${{ matrix.os }} + steps: + + - name: Checkout pyjnius + uses: actions/checkout@v3 + + - name: Setup Python (Ubuntu x86_64, macOS Intel, Windows x86_64) + if: matrix.os == 'macos-latest' || matrix.os == 'windows-latest' || matrix.os == 'ubuntu-latest' + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Setup java + # There's no need to setup java on ubuntu-latest, as build is done into a manylinux + # containerized environment. (CIBW_BEFORE_ALL_LINUX) takes care of it. + if: ${{ matrix.os != 'ubuntu-latest' }} + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + architecture: ${{ matrix.architecture }} + + - name: Install cibuildwheel & build wheels (Windows) + if: matrix.os == 'windows-latest' + env: + CIBW_ARCHS: '${{ matrix.cibw_archs }}' + run: | + python -m pip install cibuildwheel~=2.16.2 + python -m cibuildwheel --output-dir dist + + - name: Install cibuildwheel & build wheels (Linux, macOS Intel) + if: (matrix.os == 'ubuntu-latest') || (matrix.os == 'kivy-ubuntu-arm64') || (matrix.os == 'macos-latest') + env: + CIBW_ARCHS: '${{ matrix.cibw_archs }}' + run: | + source .ci/utils.sh + ensure_python_version 3.11 + python -m pip install cibuildwheel~=2.16.2 + python -m cibuildwheel --output-dir dist + + - name: upload wheels + uses: actions/upload-artifact@v2 + with: + name: dist + path: dist + + build_sdist: + name: Build sdist + if: (github.event_name == 'create' && github.event.ref_type == 'tag') || contains(github.event.head_commit.message, '[build sdist]') || contains(github.event.pull_request.title, '[build sdist]') + runs-on: 'ubuntu-latest' + steps: + - name: Checkout pyjnius + uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Build sdist + run: | + pip install -U setuptools Cython + python setup.py sdist + + - name: upload sdist + uses: actions/upload-artifact@v2 + with: + name: dist + path: dist + + test_wheels: + name: Test wheel on ${{ matrix.os }} (${{ matrix.architecture }}) Python ${{ matrix.python }} + if: (github.event_name == 'create' && github.event.ref_type == 'tag') || contains(github.event.head_commit.message, '[build wheel]') || contains(github.event.pull_request.title, '[build wheel]') + needs: + - build_wheels + continue-on-error: true + strategy: + matrix: + os: ['ubuntu-latest', 'macos-latest', 'windows-latest', 'kivy-ubuntu-arm64'] + python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.7', 'pypy3.8', 'pypy3.9'] + include: + # We may would like to introduce tests also on windows-latest on x86 (win32 wheels)? + - os: ubuntu-latest + architecture: 'x64' + - os: kivy-ubuntu-arm64 + architecture: 'aarch64' + - os: windows-latest + architecture: 'x64' + - os: macos-latest + architecture: 'x64' + - os: apple-silicon-m1 + architecture: 'aarch64' + python: '3.10' + - os: apple-silicon-m1 + architecture: 'aarch64' + python: '3.11' + - os: apple-silicon-m1 + architecture: 'aarch64' + python: '3.12' + runs-on: ${{ matrix.os }} + steps: + + - name: Checkout pyjnius + uses: actions/checkout@v3 + + - uses: actions/download-artifact@v2 + with: + name: dist + path: dist + + - name: Setup Python (Ubuntu x86_64, macOS Intel, Windows x86_64) + # Needs to be skipped on our self-hosted runners tagged as 'apple-silicon-m1' + if: matrix.os == 'macos-latest' || matrix.os == 'windows-latest' || matrix.os == 'ubuntu-latest' || matrix.os == 'apple-silicon-m1' + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + - name: Setup java + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + java-package: 'jre' + architecture: ${{ matrix.architecture }} + + - name: Setup ant on macOS + if: (matrix.os == 'macos-latest') || (matrix.os == 'apple-silicon-m1') + run: | + brew install ant + + - name: Setup ant on Linux + if: (matrix.os == 'ubuntu-latest') || (matrix.os == 'kivy-ubuntu-arm64') + run: | + sudo apt-get update && sudo apt-get install -y ant + + - name: Build test-classes via ant + run: ant all + + - name: Install pyjnius wheel + test prerequisites (Windows, macOS) + if: matrix.os == 'windows-latest' || matrix.os == 'macos-latest' || matrix.os == 'apple-silicon-m1' + # --find-links=dist --no-index is needed to avoid downloading the pyjnius wheel + # from the index. We need to test the wheel we just built. + run: | + python -m pip install --find-links=dist --no-index pyjnius + python -m pip install pyjnius[dev,ci] + + - name: Install pyjnius wheel + test prerequisites (Linux) + if: matrix.os == 'ubuntu-latest' || matrix.os == 'kivy-ubuntu-arm64' + # --find-links=dist --no-index is needed to avoid downloading the pyjnius wheel + # from the index. We need to test the wheel we just built. + run: | + source .ci/utils.sh + ensure_python_version ${{ matrix.python }} + python -m pip install --find-links=dist --no-index pyjnius + python -m pip install pyjnius[dev,ci] + + - name: Test wheel (Linux, macOS) + if: (matrix.os == 'ubuntu-latest') || (matrix.os == 'kivy-ubuntu-arm64') || (matrix.os == 'macos-latest') || (matrix.os == 'apple-silicon-m1') + run: | + source .ci/utils.sh + ensure_python_version ${{ matrix.python }} + cd tests + CLASSPATH=../build/test-classes:../build/classes python -m pytest -v + + - name: Test wheel ( Windows + Python == 3.7.x ) + # On Python < 3.8.x, we can't use `os.add_dll_directory`, so the jre should be in PATH. + if: (matrix.os == 'windows-latest') && contains(matrix.python, '3.7') + run: | + cd tests + $env:PATH +=";$env:JAVA_HOME\jre\bin\server\;$env:JAVA_HOME\jre\bin\client\;$env:JAVA_HOME\bin\server\" + $env:CLASSPATH ="../build/test-classes;../build/classes" + python -m pytest -v + + - name: Test wheel (Windows + Python != 3.7.x ) + if: (matrix.os == 'windows-latest') && !contains(matrix.python, '3.7') + run: | + cd tests + $env:CLASSPATH ="../build/test-classes;../build/classes" + python -m pytest -v \ No newline at end of file From edf208b0dce3526ba992676a11ab61362f104e7e Mon Sep 17 00:00:00 2001 From: Craig Macdonald Date: Wed, 20 Dec 2023 15:30:47 +0000 Subject: [PATCH 3/8] fix syntax --- .github/workflows/test-wheels.yml | 410 +++++++++++++++--------------- 1 file changed, 205 insertions(+), 205 deletions(-) diff --git a/.github/workflows/test-wheels.yml b/.github/workflows/test-wheels.yml index 17cc8f56..3693d023 100644 --- a/.github/workflows/test-wheels.yml +++ b/.github/workflows/test-wheels.yml @@ -3,208 +3,208 @@ on: pull_request: create: - name: Continuous Integration - Testing Wheels on JREs - jobs: - build_wheels: - name: cibuildwheel on ${{ matrix.os }} ${{ matrix.architecture }} - env: - CIBW_BEFORE_ALL_LINUX: 'yum install -y java-11-openjdk-devel' - CIBW_REPAIR_WHEEL_COMMAND_MACOS: '' - CIBW_SKIP: 'cp36-* *musllinux*' - strategy: - matrix: - include: - - os: windows-latest - architecture: 'x86' - cibw_archs: 'x86' - - os: windows-latest - architecture: 'x64' - cibw_archs: 'AMD64' - - os: ubuntu-latest - architecture: 'x64' - cibw_archs: 'x86_64' - - os: kivy-ubuntu-arm64 - architecture: 'aarch64' - cibw_archs: aarch64 - - os: macos-latest - architecture: 'x64' - cibw_archs: 'x86_64 universal2' - runs-on: ${{ matrix.os }} - steps: - - - name: Checkout pyjnius - uses: actions/checkout@v3 - - - name: Setup Python (Ubuntu x86_64, macOS Intel, Windows x86_64) - if: matrix.os == 'macos-latest' || matrix.os == 'windows-latest' || matrix.os == 'ubuntu-latest' - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Setup java - # There's no need to setup java on ubuntu-latest, as build is done into a manylinux - # containerized environment. (CIBW_BEFORE_ALL_LINUX) takes care of it. - if: ${{ matrix.os != 'ubuntu-latest' }} - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - architecture: ${{ matrix.architecture }} - - - name: Install cibuildwheel & build wheels (Windows) - if: matrix.os == 'windows-latest' - env: - CIBW_ARCHS: '${{ matrix.cibw_archs }}' - run: | - python -m pip install cibuildwheel~=2.16.2 - python -m cibuildwheel --output-dir dist - - - name: Install cibuildwheel & build wheels (Linux, macOS Intel) - if: (matrix.os == 'ubuntu-latest') || (matrix.os == 'kivy-ubuntu-arm64') || (matrix.os == 'macos-latest') - env: - CIBW_ARCHS: '${{ matrix.cibw_archs }}' - run: | - source .ci/utils.sh - ensure_python_version 3.11 - python -m pip install cibuildwheel~=2.16.2 - python -m cibuildwheel --output-dir dist - - - name: upload wheels - uses: actions/upload-artifact@v2 - with: - name: dist - path: dist - - build_sdist: - name: Build sdist - if: (github.event_name == 'create' && github.event.ref_type == 'tag') || contains(github.event.head_commit.message, '[build sdist]') || contains(github.event.pull_request.title, '[build sdist]') - runs-on: 'ubuntu-latest' - steps: - - name: Checkout pyjnius - uses: actions/checkout@v3 - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Build sdist - run: | - pip install -U setuptools Cython - python setup.py sdist - - - name: upload sdist - uses: actions/upload-artifact@v2 - with: - name: dist - path: dist - - test_wheels: - name: Test wheel on ${{ matrix.os }} (${{ matrix.architecture }}) Python ${{ matrix.python }} - if: (github.event_name == 'create' && github.event.ref_type == 'tag') || contains(github.event.head_commit.message, '[build wheel]') || contains(github.event.pull_request.title, '[build wheel]') - needs: - - build_wheels - continue-on-error: true - strategy: - matrix: - os: ['ubuntu-latest', 'macos-latest', 'windows-latest', 'kivy-ubuntu-arm64'] - python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.7', 'pypy3.8', 'pypy3.9'] - include: - # We may would like to introduce tests also on windows-latest on x86 (win32 wheels)? - - os: ubuntu-latest - architecture: 'x64' - - os: kivy-ubuntu-arm64 - architecture: 'aarch64' - - os: windows-latest - architecture: 'x64' - - os: macos-latest - architecture: 'x64' - - os: apple-silicon-m1 - architecture: 'aarch64' - python: '3.10' - - os: apple-silicon-m1 - architecture: 'aarch64' - python: '3.11' - - os: apple-silicon-m1 - architecture: 'aarch64' - python: '3.12' - runs-on: ${{ matrix.os }} - steps: - - - name: Checkout pyjnius - uses: actions/checkout@v3 - - - uses: actions/download-artifact@v2 - with: - name: dist - path: dist - - - name: Setup Python (Ubuntu x86_64, macOS Intel, Windows x86_64) - # Needs to be skipped on our self-hosted runners tagged as 'apple-silicon-m1' - if: matrix.os == 'macos-latest' || matrix.os == 'windows-latest' || matrix.os == 'ubuntu-latest' || matrix.os == 'apple-silicon-m1' - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - - - name: Setup java - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - java-package: 'jre' - architecture: ${{ matrix.architecture }} - - - name: Setup ant on macOS - if: (matrix.os == 'macos-latest') || (matrix.os == 'apple-silicon-m1') - run: | - brew install ant - - - name: Setup ant on Linux - if: (matrix.os == 'ubuntu-latest') || (matrix.os == 'kivy-ubuntu-arm64') - run: | - sudo apt-get update && sudo apt-get install -y ant - - - name: Build test-classes via ant - run: ant all - - - name: Install pyjnius wheel + test prerequisites (Windows, macOS) - if: matrix.os == 'windows-latest' || matrix.os == 'macos-latest' || matrix.os == 'apple-silicon-m1' - # --find-links=dist --no-index is needed to avoid downloading the pyjnius wheel - # from the index. We need to test the wheel we just built. - run: | - python -m pip install --find-links=dist --no-index pyjnius - python -m pip install pyjnius[dev,ci] - - - name: Install pyjnius wheel + test prerequisites (Linux) - if: matrix.os == 'ubuntu-latest' || matrix.os == 'kivy-ubuntu-arm64' - # --find-links=dist --no-index is needed to avoid downloading the pyjnius wheel - # from the index. We need to test the wheel we just built. - run: | - source .ci/utils.sh - ensure_python_version ${{ matrix.python }} - python -m pip install --find-links=dist --no-index pyjnius - python -m pip install pyjnius[dev,ci] - - - name: Test wheel (Linux, macOS) - if: (matrix.os == 'ubuntu-latest') || (matrix.os == 'kivy-ubuntu-arm64') || (matrix.os == 'macos-latest') || (matrix.os == 'apple-silicon-m1') - run: | - source .ci/utils.sh - ensure_python_version ${{ matrix.python }} - cd tests - CLASSPATH=../build/test-classes:../build/classes python -m pytest -v - - - name: Test wheel ( Windows + Python == 3.7.x ) - # On Python < 3.8.x, we can't use `os.add_dll_directory`, so the jre should be in PATH. - if: (matrix.os == 'windows-latest') && contains(matrix.python, '3.7') - run: | - cd tests - $env:PATH +=";$env:JAVA_HOME\jre\bin\server\;$env:JAVA_HOME\jre\bin\client\;$env:JAVA_HOME\bin\server\" - $env:CLASSPATH ="../build/test-classes;../build/classes" - python -m pytest -v - - - name: Test wheel (Windows + Python != 3.7.x ) - if: (matrix.os == 'windows-latest') && !contains(matrix.python, '3.7') - run: | - cd tests - $env:CLASSPATH ="../build/test-classes;../build/classes" - python -m pytest -v \ No newline at end of file +name: Continuous Integration - Testing Wheels on JREs +jobs: + build_wheels: + name: cibuildwheel on ${{ matrix.os }} ${{ matrix.architecture }} + env: + CIBW_BEFORE_ALL_LINUX: 'yum install -y java-11-openjdk-devel' + CIBW_REPAIR_WHEEL_COMMAND_MACOS: '' + CIBW_SKIP: 'cp36-* *musllinux*' + strategy: + matrix: + include: + - os: windows-latest + architecture: 'x86' + cibw_archs: 'x86' + - os: windows-latest + architecture: 'x64' + cibw_archs: 'AMD64' + - os: ubuntu-latest + architecture: 'x64' + cibw_archs: 'x86_64' + - os: kivy-ubuntu-arm64 + architecture: 'aarch64' + cibw_archs: aarch64 + - os: macos-latest + architecture: 'x64' + cibw_archs: 'x86_64 universal2' + runs-on: ${{ matrix.os }} + steps: + + - name: Checkout pyjnius + uses: actions/checkout@v3 + + - name: Setup Python (Ubuntu x86_64, macOS Intel, Windows x86_64) + if: matrix.os == 'macos-latest' || matrix.os == 'windows-latest' || matrix.os == 'ubuntu-latest' + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Setup java + # There's no need to setup java on ubuntu-latest, as build is done into a manylinux + # containerized environment. (CIBW_BEFORE_ALL_LINUX) takes care of it. + if: ${{ matrix.os != 'ubuntu-latest' }} + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + architecture: ${{ matrix.architecture }} + + - name: Install cibuildwheel & build wheels (Windows) + if: matrix.os == 'windows-latest' + env: + CIBW_ARCHS: '${{ matrix.cibw_archs }}' + run: | + python -m pip install cibuildwheel~=2.16.2 + python -m cibuildwheel --output-dir dist + + - name: Install cibuildwheel & build wheels (Linux, macOS Intel) + if: (matrix.os == 'ubuntu-latest') || (matrix.os == 'kivy-ubuntu-arm64') || (matrix.os == 'macos-latest') + env: + CIBW_ARCHS: '${{ matrix.cibw_archs }}' + run: | + source .ci/utils.sh + ensure_python_version 3.11 + python -m pip install cibuildwheel~=2.16.2 + python -m cibuildwheel --output-dir dist + + - name: upload wheels + uses: actions/upload-artifact@v2 + with: + name: dist + path: dist + + build_sdist: + name: Build sdist + if: (github.event_name == 'create' && github.event.ref_type == 'tag') || contains(github.event.head_commit.message, '[build sdist]') || contains(github.event.pull_request.title, '[build sdist]') + runs-on: 'ubuntu-latest' + steps: + - name: Checkout pyjnius + uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Build sdist + run: | + pip install -U setuptools Cython + python setup.py sdist + + - name: upload sdist + uses: actions/upload-artifact@v2 + with: + name: dist + path: dist + + test_wheels: + name: Test wheel on ${{ matrix.os }} (${{ matrix.architecture }}) Python ${{ matrix.python }} + if: (github.event_name == 'create' && github.event.ref_type == 'tag') || contains(github.event.head_commit.message, '[build wheel]') || contains(github.event.pull_request.title, '[build wheel]') + needs: + - build_wheels + continue-on-error: true + strategy: + matrix: + os: ['ubuntu-latest', 'macos-latest', 'windows-latest', 'kivy-ubuntu-arm64'] + python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.7', 'pypy3.8', 'pypy3.9'] + include: + # We may would like to introduce tests also on windows-latest on x86 (win32 wheels)? + - os: ubuntu-latest + architecture: 'x64' + - os: kivy-ubuntu-arm64 + architecture: 'aarch64' + - os: windows-latest + architecture: 'x64' + - os: macos-latest + architecture: 'x64' + - os: apple-silicon-m1 + architecture: 'aarch64' + python: '3.10' + - os: apple-silicon-m1 + architecture: 'aarch64' + python: '3.11' + - os: apple-silicon-m1 + architecture: 'aarch64' + python: '3.12' + runs-on: ${{ matrix.os }} + steps: + + - name: Checkout pyjnius + uses: actions/checkout@v3 + + - uses: actions/download-artifact@v2 + with: + name: dist + path: dist + + - name: Setup Python (Ubuntu x86_64, macOS Intel, Windows x86_64) + # Needs to be skipped on our self-hosted runners tagged as 'apple-silicon-m1' + if: matrix.os == 'macos-latest' || matrix.os == 'windows-latest' || matrix.os == 'ubuntu-latest' || matrix.os == 'apple-silicon-m1' + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + - name: Setup java + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + java-package: 'jre' + architecture: ${{ matrix.architecture }} + + - name: Setup ant on macOS + if: (matrix.os == 'macos-latest') || (matrix.os == 'apple-silicon-m1') + run: | + brew install ant + + - name: Setup ant on Linux + if: (matrix.os == 'ubuntu-latest') || (matrix.os == 'kivy-ubuntu-arm64') + run: | + sudo apt-get update && sudo apt-get install -y ant + + - name: Build test-classes via ant + run: ant all + + - name: Install pyjnius wheel + test prerequisites (Windows, macOS) + if: matrix.os == 'windows-latest' || matrix.os == 'macos-latest' || matrix.os == 'apple-silicon-m1' + # --find-links=dist --no-index is needed to avoid downloading the pyjnius wheel + # from the index. We need to test the wheel we just built. + run: | + python -m pip install --find-links=dist --no-index pyjnius + python -m pip install pyjnius[dev,ci] + + - name: Install pyjnius wheel + test prerequisites (Linux) + if: matrix.os == 'ubuntu-latest' || matrix.os == 'kivy-ubuntu-arm64' + # --find-links=dist --no-index is needed to avoid downloading the pyjnius wheel + # from the index. We need to test the wheel we just built. + run: | + source .ci/utils.sh + ensure_python_version ${{ matrix.python }} + python -m pip install --find-links=dist --no-index pyjnius + python -m pip install pyjnius[dev,ci] + + - name: Test wheel (Linux, macOS) + if: (matrix.os == 'ubuntu-latest') || (matrix.os == 'kivy-ubuntu-arm64') || (matrix.os == 'macos-latest') || (matrix.os == 'apple-silicon-m1') + run: | + source .ci/utils.sh + ensure_python_version ${{ matrix.python }} + cd tests + CLASSPATH=../build/test-classes:../build/classes python -m pytest -v + + - name: Test wheel ( Windows + Python == 3.7.x ) + # On Python < 3.8.x, we can't use `os.add_dll_directory`, so the jre should be in PATH. + if: (matrix.os == 'windows-latest') && contains(matrix.python, '3.7') + run: | + cd tests + $env:PATH +=";$env:JAVA_HOME\jre\bin\server\;$env:JAVA_HOME\jre\bin\client\;$env:JAVA_HOME\bin\server\" + $env:CLASSPATH ="../build/test-classes;../build/classes" + python -m pytest -v + + - name: Test wheel (Windows + Python != 3.7.x ) + if: (matrix.os == 'windows-latest') && !contains(matrix.python, '3.7') + run: | + cd tests + $env:CLASSPATH ="../build/test-classes;../build/classes" + python -m pytest -v \ No newline at end of file From 8394281e3967374f75fdd38dd2b8776dc9a1162a Mon Sep 17 00:00:00 2001 From: Craig Macdonald Date: Wed, 20 Dec 2023 15:47:35 +0000 Subject: [PATCH 4/8] remove kivy arm64 - probably not relevant for JRE? --- .github/workflows/test-wheels.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/test-wheels.yml b/.github/workflows/test-wheels.yml index 3693d023..c607d7ef 100644 --- a/.github/workflows/test-wheels.yml +++ b/.github/workflows/test-wheels.yml @@ -23,9 +23,6 @@ jobs: - os: ubuntu-latest architecture: 'x64' cibw_archs: 'x86_64' - - os: kivy-ubuntu-arm64 - architecture: 'aarch64' - cibw_archs: aarch64 - os: macos-latest architecture: 'x64' cibw_archs: 'x86_64 universal2' @@ -113,8 +110,6 @@ jobs: # We may would like to introduce tests also on windows-latest on x86 (win32 wheels)? - os: ubuntu-latest architecture: 'x64' - - os: kivy-ubuntu-arm64 - architecture: 'aarch64' - os: windows-latest architecture: 'x64' - os: macos-latest From a204abffe7a8cc95de76e8dc1df0f594b4079505 Mon Sep 17 00:00:00 2001 From: Craig Macdonald Date: Wed, 20 Dec 2023 21:35:04 +0000 Subject: [PATCH 5/8] run tests too --- .github/workflows/test-wheels.yml | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/.github/workflows/test-wheels.yml b/.github/workflows/test-wheels.yml index c607d7ef..14596084 100644 --- a/.github/workflows/test-wheels.yml +++ b/.github/workflows/test-wheels.yml @@ -72,33 +72,8 @@ jobs: name: dist path: dist - build_sdist: - name: Build sdist - if: (github.event_name == 'create' && github.event.ref_type == 'tag') || contains(github.event.head_commit.message, '[build sdist]') || contains(github.event.pull_request.title, '[build sdist]') - runs-on: 'ubuntu-latest' - steps: - - name: Checkout pyjnius - uses: actions/checkout@v3 - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Build sdist - run: | - pip install -U setuptools Cython - python setup.py sdist - - - name: upload sdist - uses: actions/upload-artifact@v2 - with: - name: dist - path: dist - test_wheels: name: Test wheel on ${{ matrix.os }} (${{ matrix.architecture }}) Python ${{ matrix.python }} - if: (github.event_name == 'create' && github.event.ref_type == 'tag') || contains(github.event.head_commit.message, '[build wheel]') || contains(github.event.pull_request.title, '[build wheel]') needs: - build_wheels continue-on-error: true From 915597f620aed38334cb49d838c3fcb8d28defe1 Mon Sep 17 00:00:00 2001 From: Craig Macdonald Date: Thu, 21 Dec 2023 11:04:32 +0000 Subject: [PATCH 6/8] build test classes elsewhere --- .github/workflows/test-wheels.yml | 69 ++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 24 deletions(-) diff --git a/.github/workflows/test-wheels.yml b/.github/workflows/test-wheels.yml index 14596084..4a326da6 100644 --- a/.github/workflows/test-wheels.yml +++ b/.github/workflows/test-wheels.yml @@ -5,6 +5,35 @@ on: name: Continuous Integration - Testing Wheels on JREs jobs: + build_test_jar: + runs-on: 'ubuntu-latest' + steps: + + - name: Checkout pyjnius + uses: actions/checkout@v3 + + - name: Setup java + # There's no need to setup java on ubuntu-latest, as build is done into a manylinux + # containerized environment. (CIBW_BEFORE_ALL_LINUX) takes care of it. + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + architecture: 'x64' + + - name: Setup ant on Linux + run: | + sudo apt-get update && sudo apt-get install -y ant + + - name: Build test-classes via ant + run: ant all + + - name: Upload test-classes + uses: actions/upload-artifact@v3 + with: + name: test-classes + path: build/test-classes + build_wheels: name: cibuildwheel on ${{ matrix.os }} ${{ matrix.architecture }} env: @@ -67,7 +96,7 @@ jobs: python -m cibuildwheel --output-dir dist - name: upload wheels - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: dist path: dist @@ -89,26 +118,31 @@ jobs: architecture: 'x64' - os: macos-latest architecture: 'x64' - - os: apple-silicon-m1 - architecture: 'aarch64' - python: '3.10' - - os: apple-silicon-m1 - architecture: 'aarch64' - python: '3.11' - - os: apple-silicon-m1 - architecture: 'aarch64' - python: '3.12' + #- os: apple-silicon-m1 + # architecture: 'aarch64' + # python: '3.10' + #- os: apple-silicon-m1 + # architecture: 'aarch64' + # python: '3.11' + #- os: apple-silicon-m1 + # architecture: 'aarch64' + # python: '3.12' runs-on: ${{ matrix.os }} steps: - name: Checkout pyjnius uses: actions/checkout@v3 - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: dist path: dist + - uses: actions/download-artifact@v3 + with: + name: test-classes + path: build/test-classes + - name: Setup Python (Ubuntu x86_64, macOS Intel, Windows x86_64) # Needs to be skipped on our self-hosted runners tagged as 'apple-silicon-m1' if: matrix.os == 'macos-latest' || matrix.os == 'windows-latest' || matrix.os == 'ubuntu-latest' || matrix.os == 'apple-silicon-m1' @@ -124,19 +158,6 @@ jobs: java-package: 'jre' architecture: ${{ matrix.architecture }} - - name: Setup ant on macOS - if: (matrix.os == 'macos-latest') || (matrix.os == 'apple-silicon-m1') - run: | - brew install ant - - - name: Setup ant on Linux - if: (matrix.os == 'ubuntu-latest') || (matrix.os == 'kivy-ubuntu-arm64') - run: | - sudo apt-get update && sudo apt-get install -y ant - - - name: Build test-classes via ant - run: ant all - - name: Install pyjnius wheel + test prerequisites (Windows, macOS) if: matrix.os == 'windows-latest' || matrix.os == 'macos-latest' || matrix.os == 'apple-silicon-m1' # --find-links=dist --no-index is needed to avoid downloading the pyjnius wheel From fa019fb7e0c48dcc78b20bcedc2aa1dfe8fc3051 Mon Sep 17 00:00:00 2001 From: Craig Macdonald Date: Thu, 21 Dec 2023 11:23:51 +0000 Subject: [PATCH 7/8] enable skipped tests --- .github/workflows/test-wheels.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test-wheels.yml b/.github/workflows/test-wheels.yml index 4a326da6..f648dd48 100644 --- a/.github/workflows/test-wheels.yml +++ b/.github/workflows/test-wheels.yml @@ -118,15 +118,15 @@ jobs: architecture: 'x64' - os: macos-latest architecture: 'x64' - #- os: apple-silicon-m1 - # architecture: 'aarch64' - # python: '3.10' - #- os: apple-silicon-m1 - # architecture: 'aarch64' - # python: '3.11' - #- os: apple-silicon-m1 - # architecture: 'aarch64' - # python: '3.12' + - os: apple-silicon-m1 + architecture: 'aarch64' + python: '3.10' + - os: apple-silicon-m1 + architecture: 'aarch64' + python: '3.11' + - os: apple-silicon-m1 + architecture: 'aarch64' + python: '3.12' runs-on: ${{ matrix.os }} steps: From 4419774440f2cfbae5f7cb7e1266fee44fb63019 Mon Sep 17 00:00:00 2001 From: Craig Macdonald Date: Thu, 21 Dec 2023 11:30:01 +0000 Subject: [PATCH 8/8] udpate documentation for JRE --- docs/source/building.rst | 4 ++-- docs/source/installation.rst | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/source/building.rst b/docs/source/building.rst index 3aedf64e..7f33fbcc 100644 --- a/docs/source/building.rst +++ b/docs/source/building.rst @@ -6,9 +6,9 @@ Building PyJNIus Building PyJNIus is necessary for development purposes, or if there is no pre-built binary for your particular platform. -Like installation of PyJNIus, building PyJNIus requires a `Java Development Kit +Building PyJNIus requires a `Java Development Kit `_ (JDK) -to be installed. +to be installed (NB: installing pre-built wheels required only a JRE). Apart from the JDK, the build requirements for each platform are as follows: diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 32f1dbdc..ebedac12 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -16,10 +16,11 @@ If there is no pre-compiled binary available, pip install will aim to compile a binary on your operating system. For more information see the :ref:`building` documentation. -You will need the Java JDK installed (`OpenJDK `_ is fine). +You will need the Java JRE installed (`OpenJDK `_ is fine). PyJNIus searches for Java in the usual places on each operating system. If PyJNIus cannot find Java, set the `JAVA_HOME` environment variable (this is often needed `on Windows `_). +NB: Building pyjnius requires a Java JDK rather than a JRE. Installation for Android ------------------------