Skip to content

Use 3.7 + patch

Use 3.7 + patch #85

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
branches:
- develop/*
pull_request:
branches:
- master
release:
types: [ published ]
defaults:
run:
shell: bash
jobs:
build_wheels_windows:
name: Build wheels on Windows
runs-on: windows-latest
strategy:
fail-fast: False
matrix:
python-version: [ '3.7' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: debug
run: |
dir /p C:\hostedtoolcache\windows\Python\3.7.9
dir /p C:\hostedtoolcache\windows\Python\3.7.9\x64
- name: Build wheels
run: |
python -m pip install -U pip numpy swig wheel setuptools
python setup.py bdist_wheel -d dist
ls -al ./dist
- name: Place wheels in artifacts folder
uses: actions/upload-artifact@v2
with:
path: ./dist/*.whl
build_wheels_unix:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: False
matrix:
os: [ ubuntu-latest, macos-latest ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python 3.7
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Build wheels
env:
# only build CPython-3.7+ and skip 32-bit builds and skip windows
CIBW_BUILD: cp37-*
CIBW_SKIP: "*-win* *-manylinux_i686 *-musllinux*"
# use latest build
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux2014_x86_64
CIBW_BEFORE_ALL_MACOS: brew install swig
CIBW_BEFORE_BUILD: pip install numpy swig
run: |
python -m pip install -U pip cibuildwheel
python -m cibuildwheel --output-dir dist
ls -R dist
- name: Place wheels in artifacts folder
uses: actions/upload-artifact@v2
with:
path: ./dist/*.whl
test-wheels:
name: Test wheels
needs: [ build_wheels_windows, build_wheels_unix ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-latest, ubuntu-latest, macos-latest ]
python-version: [ '3.11' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Retrieve packages
uses: actions/download-artifact@v2
with:
path: dist
- name: Test Package Installation
run: |
python -m pip install --upgrade pip
# list all files in the dist folder
ls -R dist
# finds path to the right wheel or source file to install later
os=$(echo ${{ runner.os }} | awk '{print tolower($0)}' | head -c3)
# version refers to the python version. So 3.8 -> 38
version=$(echo ${{ matrix.python-version }} | sed 's/\.//g')
# this finds files like
# nlopt-2.6.2-cp36-cp36m-win_amd64.whl
# nlopt-2.6.2-cp36-cp36m-manylinux10_amd64.whl
# nlopt-2.7.1-cp310-cp310-win_amd64.whl
file=$(find dist -name "nlopt-*${version}*${os}*.whl" -type f);
echo "Installing file: ${file}"
pip install ${file}
python extern/nlopt/test/t_python.py
deploy:
name: deploy packages
runs-on: ubuntu-latest
needs: test-wheels
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Retrieve packages
uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- name: Install twine
run: pip install twine
- name: Upload packages to testpypi
env:
TWINE_USERNAME: ${{ secrets.PYPI_TEST_UID }}
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_PWD }}
run: python -m twine upload --skip-existing --repository testpypi dist/*
- name: Upload packages to pypi
env:
TWINE_USERNAME: ${{ secrets.PYPI_UID }}
TWINE_PASSWORD: ${{ secrets.PYPI_PWD }}
run: python -m twine upload --skip-existing dist/*