From 909f93e3e0326e1beb6ca1bb71a5ce495bea05f5 Mon Sep 17 00:00:00 2001 From: Mirko Galimberti Date: Wed, 4 Oct 2023 20:17:52 +0200 Subject: [PATCH] Now Github Actions provides python3 via setup-python also for Apple Silicon Macs (#677) * Now Github Actions provides python3 via setup-python also for Apple Silicon macs * Python 3.8 and 3.9 are not available for Apple Silicon --- .ci/osx_ci.sh | 13 ---------- .github/workflows/create.yml | 47 ++++++------------------------------ 2 files changed, 8 insertions(+), 52 deletions(-) delete mode 100644 .ci/osx_ci.sh diff --git a/.ci/osx_ci.sh b/.ci/osx_ci.sh deleted file mode 100644 index 8cdd1ac..0000000 --- a/.ci/osx_ci.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -set -e -x - -arm64_set_path_and_python_version(){ - python_version="$1" - if [[ $(/usr/bin/arch) = arm64 ]]; then - export PATH=/opt/homebrew/bin:$PATH - eval "$(pyenv init --path)" - pyenv install $python_version -s - pyenv global $python_version - export PATH=$(pyenv prefix)/bin:$PATH - fi -} \ No newline at end of file diff --git a/.github/workflows/create.yml b/.github/workflows/create.yml index 133f244..fb1599c 100644 --- a/.github/workflows/create.yml +++ b/.github/workflows/create.yml @@ -122,13 +122,10 @@ jobs: architecture: 'x64' - os: apple-silicon-m1 architecture: 'aarch64' - python: '3.8.13' + python: '3.10' - os: apple-silicon-m1 architecture: 'aarch64' - python: '3.9.11' - - os: apple-silicon-m1 - architecture: 'aarch64' - python: '3.10.3' + python: '3.11' runs-on: ${{ matrix.os }} steps: @@ -142,7 +139,7 @@ jobs: - 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' + 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 }} @@ -157,8 +154,6 @@ jobs: - name: Setup ant on macOS if: (matrix.os == 'macos-latest') || (matrix.os == 'apple-silicon-m1') run: | - source .ci/osx_ci.sh - arm64_set_path_and_python_version ${{ matrix.python }} brew install ant - name: Setup ant on Linux @@ -166,19 +161,11 @@ jobs: run: | sudo apt-get update && sudo apt-get install -y ant - - name: Build test-classes via ant (macOS x64, macOS Apple Silicon) - if: (matrix.os == 'macos-latest') || (matrix.os == 'apple-silicon-m1') - run: | - source .ci/osx_ci.sh - arm64_set_path_and_python_version ${{ matrix.python }} - ant all - - - name: Build test-classes via ant (Linux, Windows) - if: matrix.os == 'windows-latest' || matrix.os == 'kivy-ubuntu-arm64' || matrix.os == 'ubuntu-latest' + - name: Build test-classes via ant run: ant all - - name: Install pyjnius wheel + test prerequisites (Windows, macOS x64) - if: matrix.os == 'windows-latest' || matrix.os == 'macos-latest' + - 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: | @@ -195,32 +182,14 @@ jobs: python -m pip install --find-links=dist --no-index pyjnius python -m pip install pyjnius[dev,ci] - - name: Install pyjnius wheel + test prerequisites (Apple Silicon M1) - if: 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: | - source .ci/osx_ci.sh - arm64_set_path_and_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 Intel) - if: (matrix.os == 'ubuntu-latest') || (matrix.os == 'kivy-ubuntu-arm64') || (matrix.os == 'macos-latest') + - 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 (macOS Apple Silicon) - if: matrix.os == 'apple-silicon-m1' - run: | - source .ci/osx_ci.sh - arm64_set_path_and_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')