[build]: windows, ubuntu, macOS #150
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Wheels | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "docs/**" | |
tags: | |
- "v*.*.*" | |
workflow_dispatch: | |
jobs: | |
build_wheels: | |
if: contains(github.event.head_commit.message, '[build]') | |
name: Build wheels on ${{ matrix.os }} for ${{ matrix.python_version }} | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos, ubuntu, windows] | |
python_version: ["3.9", "3.10"] | |
steps: | |
- name: Set up Python ${{ matrix.python_version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Clone GitHub repository | |
run: | | |
git clone --recurse-submodules https://github.com/openPupil/PyPupilEXT | |
- name: Install dependencies | |
run: | | |
cd PyPupilEXT | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements.txt | |
- name: Get latest Cmake and ninja (All-Systems) | |
uses: lukka/get-cmake@latest | |
- uses: knicknic/os-specific-run@v1.0.4 | |
with: | |
macos: | | |
echo "Starting on macOS" | |
brew install pkg-config | |
brew install cmake | |
brew install nasm | |
brew install gcc | |
brew install llvm | |
brew install libomp | |
brew install libmpc | |
brew install tree | |
brew install libxcb | |
linux: | | |
echo "Starting on Linux" | |
sudo apt-get update | |
sudo apt-get install -y gcc g++ make cmake | |
sudo apt-get install -y wget git build-essential curl zip unzip tar pkg-config libopencv-dev ninja-build autoconf \ | |
automake libtool bison gperf libx11-dev libxft-dev libxext-dev libegl1-mesa-dev libgles2-mesa-dev libxrandr-dev \ | |
libglib2.0-dev libxrandr-dev libxcursor-dev libxinerama-dev libxi-dev libxcomposite-dev libatk1.0-dev libcairo2-dev libpango1.0-dev \ | |
libgdk-pixbuf2.0-dev libxdamage-dev nasm libomp-dev libomp5 libeigen3-dev | |
windows: | | |
echo "Starting on Windows" | |
cd PyPupilEXT/3rdparty/vcpkg | |
git checkout 9558037875497b9db8cf38fcd7db68ec661bffe7 | |
git pull | |
- name: Restore artifacts, or setup vcpkg (All-Systems) | |
if: matrix.os == 'windows' | |
uses: lukka/run-vcpkg@v11 | |
with: | |
vcpkgDirectory: "${{ github.workspace }}/PyPupilEXT/3rdparty/vcpkg" | |
vcpkgJsonGlob: "**/vcpkg.json" | |
runVcpkgInstall: false | |
vcpkgGitCommitId: 9558037875497b9db8cf38fcd7db68ec661bffe7 | |
- name: Restore artifacts, or setup vcpkg (All-Systems) | |
if: matrix.os == 'macos' || matrix.os == 'ubuntu' | |
uses: lukka/run-vcpkg@v10 | |
with: | |
vcpkgDirectory: "${{ github.workspace }}/PyPupilEXT/3rdparty/vcpkg" | |
vcpkgJsonGlob: "**/vcpkg.json" | |
runVcpkgInstall: false | |
vcpkgGitCommitId: "e99d9a4facea9d7e15a91212364d7a12762b7512" | |
- name: Build wheels for Python ${{ matrix.python_version }} in ${{ runner.os }} | |
run: | | |
cd PyPupilEXT | |
python setup.py sdist bdist_wheel | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ matrix.os }}-${{ matrix.python_version }} | |
path: PyPupilEXT/dist/ | |
create_release: | |
needs: [build_wheels] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Artifacts | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: actions/download-artifact@v4 | |
with: | |
name: "wheels-*" | |
path: dist/ | |
- name: Create GitHub Release | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
body_path: release_notes/release_notes_${{ github.ref }}.md | |
draft: false | |
prerelease: false | |
- name: Upload Release Assets | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: "dist/*" | |
asset_name: ${{ github.ref }}-$(basename ${{ runner.arch }}).whl | |
asset_content_type: application/zip | |
# - name: Publish to PyPI | |
# if: startsWith(github.ref, 'refs/tags/') | |
# run: | | |
# python -m pip install --upgrade twine | |
# python -m twine upload dist/* | |
# env: | |
# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |