Maialib v.1.7.2 #142
This file contains 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 | |
defaults: | |
run: | |
working-directory: . | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
release: | |
types: | |
- published | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macOS-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
# Used to host cibuildwheel | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.8" | |
- name: Upgrade pip to the latest version | |
run: | | |
if [[ "${{ matrix.os }}" == "macos-12" ]]; then | |
python3.8 -m pip install --upgrade pip | |
else | |
python -m pip install --upgrade pip | |
fi | |
shell: bash | |
- name: Clean previous builds | |
run: | | |
rm -rf build/ | |
rm -rf dist/ | |
rm -rf stubs/ | |
rm -rf wheelhouse/ | |
rm -rf *.egg-info | |
rm -rf /tmp/cibuildwheel/ | |
rm -rf /project/build/ | |
rm -rf /home/runner/work/maialib/maialib/build/ | |
find . -name "CMakeCache.txt" -delete | |
shell: bash | |
- name: Install pybind11-stubgen and mypy | |
run: python -m pip install pybind11-stubgen==2.5.1 mypy setuptools | |
- name: Install maialib | |
run: python -m pip install . | |
- name: Generate stubs from Maiacore | |
run: pybind11-stubgen maialib.maiacore '--output-dir=./stubs/' --ignore-all-errors | |
- name: Generate stubs from Maiapy | |
run: stubgen --no-analysis ./maialib/maiapy/ -o ./stubs/ --include-docstrings --ignore-errors | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel==2.18.1 | |
- name: Build wheels | |
run: python -m cibuildwheel --output-dir wheelhouse | |
env: | |
CIBW_ARCHS_MACOS: universal2 | |
MACOSX_DEPLOYMENT_TARGET: 10.15 | |
CIBW_BEFORE_ALL_LINUX: | | |
if [ -d ./stubs ]; then cp -rf ./stubs/* .; fi | |
rm -rf build/ *.egg-info /tmp/cibuildwheel/ /project/build/ /home/runner/work/maialib/maialib/build/ | |
find . -name "CMakeCache.txt" -delete | |
find . -name "CMakeFiles" -exec rm -rf {} + | |
find . -name "cmake_install.cmake" -delete | |
find . -name "Makefile" -delete | |
CIBW_BEFORE_ALL_MACOS: | | |
if [ -d ./stubs ]; then cp -rf ./stubs/* .; fi | |
CIBW_BEFORE_ALL_WINDOWS: | | |
if exist .\stubs\ (xcopy /e /k /y .\stubs\* .) | |
CIBW_SKIP: cp36-* cp37-* pp37-* *-win32 *-manylinux_i686 *-manylinux_ppc64le *-manylinux_s390x *-musllinux_s390x | |
CIBW_ENVIRONMENT: | | |
CMAKE_ARGS="-DMAIALIB_VERSION_INFO=${{ steps.version.outputs.version }}" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
path: ./wheelhouse/*.whl | |
retention-days: 3 | |
upload_all: | |
name: Upload All | |
needs: build_wheels | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-wheels-* | |
path: dist | |
merge-multiple: true | |
- name: Verify downloaded wheels | |
run: ls -l dist | |
- name: Verify files | |
run: sha256sum dist/*.whl | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.pypi_password }} | |
env: | |
TWINE_VERBOSE: 1 |