Skip to content

Make proper changes for action/upload-artifact@v4 (wheels) (#8712) #5307

Make proper changes for action/upload-artifact@v4 (wheels) (#8712)

Make proper changes for action/upload-artifact@v4 (wheels) (#8712) #5307

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@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Create wheel
run: |
source .ci/ubuntu_ci.sh
create_kivy_examples_wheel
- name: Upload kivy-examples wheel as artifact
uses: actions/upload-artifact@v4
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 cp312-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@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Cache macOS deps downloads
uses: actions/cache@v4
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 build dependencies
run: |
brew install pkg-config cmake ninja
- name: Build universal Kivy dependencies
run: |
./tools/build_macos_dependencies.sh
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==2.17.0
- name: Build wheels
run: |
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@v4
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@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: actions/download-artifact@v4
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@v2.0.4
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:
# macos-latest (ATM macos-14) runs on Apple Silicon,
# macos-13 runs on Intel
runs_on: ['macos-latest', 'macos-13']
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
env:
KIVY_GL_BACKEND: 'mock'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }} on ${{ matrix.runs_on }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: actions/download-artifact@v4
with:
name: osx_wheels
path: dist
- name: Install Kivy wheel
run: |
source .ci/ubuntu_ci.sh
install_kivy_wheel dev
- uses: actions/download-artifact@v4
with:
name: osx_examples_wheel
path: dist
- name: Install kivy-examples wheel
run: |
source .ci/ubuntu_ci.sh
install_kivy_examples_wheel dev
- name: Test Kivy wheel
run: |
source .ci/ubuntu_ci.sh
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@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Cache macOS deps downloads
uses: actions/cache@v4
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 build dependencies
run: |
brew install pkg-config cmake ninja
- name: Install dependencies
run: |
source .ci/ubuntu_ci.sh
source .ci/osx_ci.sh
install_platypus
- name: Make app bundle
run: |
source .ci/osx_ci.sh
generate_osx_app_bundle
- 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@v4
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@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: actions/download-artifact@v4
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@v2.0.4
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@v4
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_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