Skip to content

CyRK v0.8.0

CyRK v0.8.0 #16

name: Build Wheels for PyPI
on:
workflow_dispatch:
release:
types:
- published
jobs:
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true # Optional, use if you have submodules
- name: Build SDist
run: pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
build_macos_wheel:
name: Build MacOS wheel for Python ${{ matrix.python }}
runs-on: macos-latest
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
steps:
- name: Checkout CyRK
uses: actions/checkout@v3
- name: Install Anaconda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: cyrk_test
auto-update-conda: true
python-version: ${{ matrix.python }}
auto-activate-base: false
- name: Conda info
shell: bash -el {0}
run: conda info
- name: Install llvm and libomp
shell: bash -el {0}
run: |
brew reinstall llvm libomp
- name: Install Dependencies
shell: bash -el {0}
run: |
conda install numpy scipy cython llvm-openmp pytest
python -m pip install --upgrade build
- name: Install package
shell: bash -el {0}
run: |
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
export PATH="/usr/local/opt/llvm/bin:$PATH"
export CPPFLAGS="$CPPFLAGS -Xpreprocessor -fopenmp -I/usr/local/opt/llvm/include"
export CFLAGS="$CFLAGS -I/usr/local/opt/libomp/include"
export CXXFLAGS="$CXXFLAGS -I/usr/local/opt/libomp/include"
export LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/local/opt/libomp/lib -L/usr/local/opt/libomp/lib -lomp -L/usr/local/opt/llvm/lib"
python -m build --wheel --outdir ./wheelhouse/
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
build_other_wheels:
name: Build ${{ matrix.platform }} wheels
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
# - macos-12 ## macos is not playing nice with cibuildwheel with openmp from cython.
- windows-2022
- ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build wheels
uses: pypa/[email protected]
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
check_dist:
name: Check dist
needs: [make_sdist, build_macos_wheel, build_other_wheels]
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- run: pipx run twine check --strict dist/*
upload_all:
name: Upload wheels to PyPI
needs: [build_macos_wheel, build_other_wheels, make_sdist, check_dist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}