Hopefully fixes builds on 3.12. #176
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 | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
tags: | |
- '*' | |
jobs: | |
cleanup-runs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: rokroskar/workflow-run-cleanup-action@master | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'" | |
build_mkl: | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, macos-latest ] # windows-latest not finding MKL | |
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11" ] | |
env: | |
PYTHON_VERSION: ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
channels: conda-forge,anaconda | |
- name: Install dependencies | |
run: | | |
conda install mkl scipy numpy pytest | |
- name: Test | |
run: | | |
python legacy_setup.py install --scs --mkl | |
pytest | |
rm -rf build/ | |
build_openmp: | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest ] | |
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11" ] | |
env: | |
PYTHON_VERSION: ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
channels: conda-forge,anaconda | |
- name: Install dependencies | |
run: | | |
conda install scipy numpy pytest | |
- name: Test | |
run: | | |
python legacy_setup.py install --scs --openmp | |
pytest | |
rm -rf build/ | |
build: | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11", "3.12"] | |
env: | |
PYTHON_VERSION: ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set Additional Envs | |
shell: bash | |
run: | | |
echo "DEPLOY=$( [[ $GITHUB_EVENT_NAME == 'push' && $GITHUB_REF == 'refs/tags'* ]] && echo 'True' || echo 'False' )" >> $GITHUB_ENV | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
channels: conda-forge,anaconda | |
- name: Install dependencies | |
run: | | |
if [[ "$PYTHON_VERSION" == "3.7" ]] || [[ "$PYTHON_VERSION" == "3.8" ]] || [[ "$PYTHON_VERSION" == "3.9" ]]; then | |
conda install scipy=1.5 numpy=1.19 mkl openblas lapack | |
elif [[ "$PYTHON_VERSION" == "3.10" ]]; then | |
conda install openblas numpy=1.21 | |
elif [[ "$PYTHON_VERSION" == "3.11" ]]; then | |
conda install openblas numpy=1.23.4 | |
elif [[ "$PYTHON_VERSION" == "3.12" ]]; then | |
conda install openblas numpy | |
fi | |
- name: Build | |
run: | | |
if [[ "$PYTHON_VERSION" == "3.7" ]] || [[ "$PYTHON_VERSION" == "3.8" ]]; then | |
python legacy_setup.py install | |
elif [[ "$PYTHON_VERSION" != "3.7" ]] && [[ "$PYTHON_VERSION" != "3.8" ]]; then | |
python -c "import numpy as np; print('NUMPY BLAS INFOS'); print(np.show_config())" | |
python -m pip install --verbose . | |
fi | |
- name: Test | |
run: | | |
python -m pip install pytest | |
pytest | |
rm -rf build/ | |
- name: Build and test windows wheels | |
if: ${{env.DEPLOY == 'True' && startsWith(matrix.os, 'windows')}} | |
run: | | |
python -m pip install build | |
python -m build -Csetup-args="-Dlink_blas_statically=True" | |
python -m pip install delvewheel | |
delvewheel repair dist/*whl | |
conda remove openblas # to check static linkage | |
pip install wheelhouse/*whl --force-reinstall | |
pytest | |
- name: Upload artifacts to github | |
if: ${{env.DEPLOY == 'True' && startsWith(matrix.os, 'windows')}} | |
uses: actions/upload-artifact@v1 | |
with: | |
name: wheels | |
path: ./wheelhouse | |
build_wheels: | |
needs: build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, macos-latest ] | |
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11", "3.12"] | |
env: | |
RUNNER_OS: ${{ matrix.os }} | |
PYTHON_VERSION: ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set Additional Envs | |
shell: bash | |
run: | | |
echo "PYTHON_SUBVERSION=$(echo $PYTHON_VERSION | cut -c 3-)" >> $GITHUB_ENV | |
echo "SINGLE_ACTION_CONFIG=$( [[ $PYTHON_VERSION == 3.8 && $RUNNER_OS == 'macOS' ]] && echo 'True' || echo 'False' )" >> $GITHUB_ENV | |
echo "DEPLOY=$( [[ $GITHUB_EVENT_NAME == 'push' && $GITHUB_REF == 'refs/tags'* ]] && echo 'True' || echo 'False' )" >> $GITHUB_ENV | |
- name: Build wheels | |
if: ${{env.DEPLOY == 'True'}} | |
env: | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
CIBW_BUILD: "cp3${{env.PYTHON_SUBVERSION}}-*" | |
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux*" | |
CIBW_BEFORE_ALL_LINUX: yum install -y openblas-devel | |
CIBW_BEFORE_ALL_MACOS: > | |
brew install openblas && | |
cp -r /usr/local/opt/openblas/lib/* /usr/local/lib && | |
cp /usr/local/opt/openblas/include/* /usr/local/include | |
CIBW_ENVIRONMENT_MACOS: CFLAGS='-Wno-error=implicit-function-declaration' | |
CIBW_BUILD_VERBOSITY: 3 | |
CIBW_TEST_REQUIRES: pytest | |
CIBW_TEST_COMMAND: pytest {package} | |
uses: joerick/[email protected] | |
- name: Build source | |
if: ${{env.DEPLOY == 'True' && env.SINGLE_ACTION_CONFIG == 'True'}} | |
run: | | |
python -m pip install build | |
python -m build -Csetup-args="-Dlink_blas_statically=True" --outdir=wheelhouse | |
- name: Upload artifacts to github | |
if: ${{env.DEPLOY == 'True'}} | |
uses: actions/upload-artifact@v1 | |
with: | |
name: wheels | |
path: ./wheelhouse | |
upload_wheels: | |
needs: build_wheels | |
runs-on: ubuntu-latest | |
env: | |
PYPI_SERVER: ${{ secrets.PYPI_SERVER }} | |
PYPI_USER: ${{ secrets.PYPI_USER }} | |
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Set Additional Envs | |
shell: bash | |
run: | | |
echo "DEPLOY=$( [[ $GITHUB_EVENT_NAME == 'push' && $GITHUB_REF == 'refs/tags'* ]] && echo 'True' || echo 'False' )" >> $GITHUB_ENV | |
- uses: actions/download-artifact@v2 | |
if: ${{env.DEPLOY == 'True'}} | |
with: | |
name: wheels | |
path: ./wheelhouse | |
- name: Release to pypi | |
if: ${{env.DEPLOY == 'True'}} | |
shell: bash | |
run: | | |
python -m pip install --upgrade twine | |
twine check wheelhouse/* | |
twine upload --skip-existing --repository-url $PYPI_SERVER wheelhouse/* -u $PYPI_USER -p $PYPI_PASSWORD |