kivy/.github/workflows/osx_wheels_app.yml

301 lines
9.8 KiB
YAML

name: OSX wheels/app
on:
push:
pull_request:
create:
schedule:
- cron: '23 1 * * *'
env:
KIVY_SPLIT_EXAMPLES: 1
SERVER_IP: '159.203.106.198'
CC: clang
CXX: clang
FFLAGS: '-ff2c'
USE_SDL2: 1
jobs:
kivy_examples_create:
# we need examples wheel for tests, but only windows actually uploads kivy-examples to pypi/server
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: |
source .ci/ubuntu_ci.sh
install_kivy_test_wheel_run_pip_deps dev
- name: Create wheel
run: |
source .ci/ubuntu_ci.sh
create_kivy_examples_wheel
- name: Upload kivy-examples wheel as artifact
uses: actions/upload-artifact@v3
with:
name: osx_examples_wheel
path: dist
osx_wheels_create:
if: github.event_name == 'schedule' || (github.event_name == 'create' && github.event.ref_type == 'tag') || contains(github.event.head_commit.message, '[build wheel]') || contains(github.event.head_commit.message, '[build wheel osx]') || contains(github.event.pull_request.title, '[build wheel]') || contains(github.event.pull_request.title, '[build wheel osx]')
env:
CIBW_BUILD: "cp37-macosx_x86_64 cp38-macosx_universal2 cp39-macosx_universal2 cp310-macosx_universal2 cp311-macosx_universal2"
CIBW_ARCHS_MACOS: "x86_64 universal2"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-listdeps {wheel} &&
DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}
runs-on: ${{ matrix.runs_on }}
strategy:
matrix:
include:
- runs_on: macos-latest
python: '3.x'
steps:
- uses: actions/checkout@v3
- name: Set up Python
# Needs to be skipped on our self-hosted runners tagged as 'apple-silicon-m1'
if: ${{ matrix.runs_on != 'apple-silicon-m1' }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Cache macOS deps downloads
uses: actions/cache@v3
with:
path: osx-cache
key: ${{ runner.OS }}-build-${{ hashFiles('.ci/osx_ci.sh') }}
- name: Generate version metadata
run: |
source .ci/ubuntu_ci.sh
update_version_metadata
- name: Build universal Kivy dependencies
run: |
source .ci/ubuntu_ci.sh
source .ci/osx_ci.sh
arm64_set_path_and_python_version ${{ matrix.python }}
./tools/build_macos_dependencies.sh
- name: Install cibuildwheel
run: |
source .ci/osx_ci.sh
arm64_set_path_and_python_version ${{ matrix.python }}
python -m pip install cibuildwheel==2.11.2
- name: Build wheels
run: |
source .ci/osx_ci.sh
arm64_set_path_and_python_version ${{ matrix.python }}
export KIVY_DEPS_ROOT=$(pwd)/kivy-dependencies
export REPAIR_LIBRARY_PATH=$KIVY_DEPS_ROOT/dist/Frameworks:$KIVY_DEPS_ROOT/dist/Frameworks/SDL2_mixer.framework/Frameworks
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v3
with:
name: osx_wheels
path: ./wheelhouse/*.whl
osx_wheel_upload:
runs-on: macos-latest
needs: osx_wheels_create
if: github.event_name != 'pull_request'
env:
KIVY_GL_BACKEND: 'mock'
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: actions/download-artifact@v3
with:
name: osx_wheels
path: dist
- name: Rename wheels
if: github.event.ref_type != 'tag'
run: |
source .ci/ubuntu_ci.sh
rename_wheels
- name: Upload wheels to server
env:
UBUNTU_UPLOAD_KEY: ${{ secrets.UBUNTU_UPLOAD_KEY }}
run: |
source .ci/ubuntu_ci.sh
upload_file_to_server "$SERVER_IP" "osx/kivy/"
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v0.1.14
if: startsWith(github.ref, 'refs/tags/')
with:
files: dist/*
draft: true
- name: Publish to PyPI
if: github.event_name == 'create' && github.event.ref_type == 'tag'
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
source .ci/ubuntu_ci.sh
upload_artifacts_to_pypi
osx_wheel_test:
name: "osx_wheel_test (${{ matrix.runs_on }}, ${{ matrix.python }})"
needs: [ osx_wheels_create, kivy_examples_create ]
runs-on: ${{ matrix.runs_on }}
strategy:
matrix:
include:
- runs_on: macos-latest
python: '3.7'
- runs_on: macos-latest
python: '3.8'
- runs_on: macos-latest
python: '3.9'
- runs_on: macos-latest
python: '3.10'
- runs_on: macos-latest
python: '3.11'
- runs_on: apple-silicon-m1
python: '3.8.13'
- runs_on: apple-silicon-m1
python: '3.9.7'
- runs_on: apple-silicon-m1
python: '3.10.1'
- runs_on: apple-silicon-m1
python: '3.11'
env:
KIVY_GL_BACKEND: 'mock'
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }} on ${{ matrix.runs_on }}
# Needs to be skipped on our self-hosted runners tagged as 'apple-silicon-m1'
if: ${{ matrix.runs_on != 'apple-silicon-m1' }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- uses: actions/download-artifact@v3
with:
name: osx_wheels
path: dist
- name: Install test dependencies
run: |
source .ci/ubuntu_ci.sh
source .ci/osx_ci.sh
arm64_set_path_and_python_version ${{ matrix.python }}
install_kivy_test_wheel_run_pip_deps dev
- name: Install Kivy wheel
run: |
source .ci/ubuntu_ci.sh
source .ci/osx_ci.sh
arm64_set_path_and_python_version ${{ matrix.python }}
install_kivy_wheel dev
- uses: actions/download-artifact@v3
with:
name: osx_examples_wheel
path: dist
- name: Install kivy-examples wheel
run: |
source .ci/ubuntu_ci.sh
source .ci/osx_ci.sh
arm64_set_path_and_python_version ${{ matrix.python }}
install_kivy_examples_wheel dev
- name: Test Kivy wheel
run: |
source .ci/ubuntu_ci.sh
source .ci/osx_ci.sh
arm64_set_path_and_python_version ${{ matrix.python }}
test_kivy_install
osx_app_create:
runs-on: macos-latest
if: github.event_name != 'pull_request' && (github.event_name == 'schedule' || (github.event_name == 'create' && github.event.ref_type == 'tag') || contains(github.event.head_commit.message, '[build app osx]')) || contains(github.event.pull_request.title, '[build app osx]')
env:
KIVY_SPLIT_EXAMPLES: 0
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Cache macOS deps downloads
uses: actions/cache@v3
with:
path: osx-cache
key: ${{ runner.OS }}-build-${{ hashFiles('.ci/osx_ci.sh') }}
- name: Generate version metadata
run: |
source .ci/ubuntu_ci.sh
update_version_metadata
- name: Install dependencies
run: |
source .ci/ubuntu_ci.sh
source .ci/osx_ci.sh
install_platypus
install_kivy_test_run_pip_deps dev
- name: Make app bundle
run: |
py_version=$(python3 -c "import platform; print(platform.python_version())")
source .ci/osx_ci.sh
generate_osx_app_bundle "$py_version"
- name: Create dmg from bundle
run: |
source .ci/osx_ci.sh
generate_osx_app_dmg_from_bundle
- name: Upload dmg as artifact
uses: actions/upload-artifact@v3
with:
name: osx_app
path: app
osx_app_upload_test:
runs-on: macos-latest
needs: [osx_app_create, kivy_examples_create]
env:
KIVY_GL_BACKEND: 'mock'
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: actions/download-artifact@v3
with:
name: osx_app
path: app
- name: Rename app
if: github.event.ref_type != 'tag'
run: |
py_version=$(python3 -c "import platform; print(platform.python_version())")
source .ci/osx_ci.sh
rename_osx_app "$py_version"
- name: Upload app to server
env:
UBUNTU_UPLOAD_KEY: ${{ secrets.UBUNTU_UPLOAD_KEY }}
run: |
source .ci/ubuntu_ci.sh
upload_file_to_server "$SERVER_IP" "osx/app/" "*.dmg" "app"
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v0.1.14
if: startsWith(github.ref, 'refs/tags/')
with:
files: app/*
draft: true
- name: Mount Kivy.app
run: |
source .ci/osx_ci.sh
mount_osx_app
- uses: actions/download-artifact@v3
with:
name: osx_examples_wheel
path: dist
- name: Install test dependencies
run: |
source .ci/osx_ci.sh
source .ci/ubuntu_ci.sh
activate_osx_app_venv
install_kivy_test_wheel_run_pip_deps dev
install_kivy_examples_wheel dev
- name: Test Kivy app
run: |
source .ci/osx_ci.sh
source .ci/ubuntu_ci.sh
activate_osx_app_venv
test_kivy_install