Merge branch 'master' into deploy #67
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
# Python: "3.10" "3.11" "3.12" | |
# Older versions than 3.8 do not support f-strings | |
# Older versions than 3.10 do not support Numpy 2 | |
name: Python package | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ deploy ] | |
# pull_request: | |
# branches: [ deploy ] | |
jobs: | |
# # Does not produce manylinux that is required for twine | |
# build_unix: | |
# name: Build wheels on ${{ matrix.os }} | |
# runs-on: ${{ matrix.os }} | |
# strategy: | |
# fail-fast: true | |
# matrix: | |
# # os: [ubuntu-20.04,ubuntu-18.04] | |
# # python-version: ["3.8","3.9","3.10"] | |
# os: [ubuntu-18.04] | |
# python-version: ["3.9"] | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Set up Python ${{ matrix.python-version }} | |
# uses: actions/setup-python@v5 | |
# with: | |
# python-version: ${{ matrix.python-version }} | |
# - name: Install dependencies | |
# run: | | |
# python -m pip install --upgrade pip | |
# python -m pip install pytest pytest-benchmark build | |
# python -m pip install numpy scipy matplotlib>=3.0.0 | |
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
# - name: Compile and install | |
# run: | | |
# python -m pip install . -v | |
# ls ${{ github.workspace }}/build || true | |
# - name: Test installation | |
# run : | | |
# mv dtaidistance dtaidistance_pkg | |
# python ./util/check_installation.py | |
# mv dtaidistance_pkg dtaidistance | |
# - name: Test with pytest | |
# run: | | |
# mv dtaidistance dtaidistance_pkg | |
# pytest --ignore=venv --benchmark-skip | |
# mv dtaidistance_pkg dtaidistance | |
# - name: Build | |
# run: | | |
# python -m build | |
# - name: Store wheels | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: wheels | |
# path: dist/*.whl | |
build_unix: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
# os: [ubuntu-20.04,ubuntu-18.04] | |
# python-version: ["3.8","3.9","3.10"] | |
os: [ubuntu-22.04] | |
# cibuildwheel will automatically provide all Python versions | |
python-version: ["3.10"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install cibuildwheel==2.19.1 | |
- name: Build wheel | |
run: | | |
python -m cibuildwheel --output-dir dist/ | |
ls dist/ | |
env: | |
CIBW_BUILD_VERBOSITY: 2 | |
# cp36-* and cp37-* do not support f-strings | |
CIBW_SKIP: cp36-* cp37-* cp38-* cp39-* pp* *-manylinux_i686 *-musllinux_i686 *-musllinux_x86_64 | |
CIBW_TEST_EXTRAS: "dev" | |
CIBW_TEST_COMMAND: pytest --ignore=venv --benchmark-skip {project}/tests | |
- name: Store wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.os }}-${{ matrix.python-version }} | |
path: dist/*.whl | |
build_macos: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
# os: [macos-14, macos-14-arm64, macos-15, macos-15-arm64] | |
os: [macos-15] # macos-14 and macos-15 generate a wheel with the same name | |
python-version: ["3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install OpenMP | |
run: | | |
# OpenMP libraries are not installed by default on macos | |
clang --version | |
clang --version | grep "\(13\.\|14\.\|15\.\|16\.\)" | |
# hardcoded, not ideal | |
# https://mac.r-project.org/openmp/ | |
# This includes only the dynamic library | |
curl -O https://mac.r-project.org/openmp/openmp-13.0.0-darwin21-Release.tar.gz | |
sudo tar fvxz openmp-13.0.0-darwin21-Release.tar.gz -C / | |
ls /usr/local/lib | |
ls /usr/local/include | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pytest pytest-benchmark build | |
python -m pip install numpy scipy matplotlib>=3.0.0 | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Compile and install | |
run: | | |
export LDFLAGS="-L/usr/local/lib" | |
export CPPFLAGS="-I/usr/local/include" | |
python -m pip install . -v | |
ls ${{ github.workspace }}/build || true | |
- name: Test installation | |
run : | | |
python ./util/check_installation.py | |
- name: Test with pytest | |
run: | | |
export LDFLAGS="-L/usr/local/lib" | |
export CPPFLAGS="-I/usr/local/include" | |
pytest --ignore=venv --benchmark-skip | |
- name: Build | |
run: | | |
python -m build | |
ls dist/ | |
- name: Store wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.os }}-${{ matrix.python-version }} | |
path: dist/*.whl | |
build_windows: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ windows-2022 ] # windows-2019 (produces same filenames as 2022) | |
python-version: ["3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pytest pytest-benchmark pytest-env build cython | |
python -m pip install numpy scipy matplotlib>=3.0.0 | |
- name: Compile and install | |
run: | | |
python -m pip install . -v | |
ls ${{ github.workspace }}/build || true | |
- name: Test installation | |
run : | | |
python ./util/check_installation.py | |
- name: Test with pytest | |
run: | | |
pytest --ignore=venv --benchmark-skip -c pytest-noviz.ini | |
- name: Build | |
run: | | |
python -m build | |
ls dist/ | |
- name: Store wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.os }}-${{ matrix.python-version }} | |
path: dist/*.whl | |
build_sdist: | |
name: Prepare source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Build | |
run: | | |
python -m pip install build | |
python -m build --sdist | |
- name: Store artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-source | |
path: dist/*.tar.gz | |
upload_wheels: | |
name: Upload wheels to PyPi | |
runs-on: ubuntu-latest | |
# upload to PyPI on every tag starting with 'v' | |
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
needs: [build_unix,build_macos,build_windows,build_sdist] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: dist-* | |
merge-multiple: true | |
path: dist | |
- name: Install twine | |
run: python -m pip install --upgrade twine | |
- name: Check distribution with twine | |
run: twine check dist/* | |
- name: Publish package to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
packages_dir: dist/ | |