Upgrade actions/download-artifact to v4; Explicitly Check PEP 440 Compliance; Fix Workflows, Makefiles, and Boost Usage #117
Workflow file for this run
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/upload sdist and wheel Package to PyPI | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
paths-ignore: | |
- 'example/**' | |
- 'docs/**' | |
- 'data/**' | |
pull_request: | |
branches: | |
- master | |
- develop | |
paths-ignore: | |
- 'example/**' | |
- 'docs/**' | |
- 'data/**' | |
release: | |
types: | |
- published | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
arch: x86_64 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
architecture: 'x64' | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v1 | |
with: | |
platforms: arm64 | |
- name: Add tag to version.py file | |
run: | | |
git describe --abbrev=7 --dirty --always --tags | \ | |
sed 's/dirty/mod/g' | \ | |
sed 's/-/+/' | \ | |
sed 's/-/./g' | \ | |
sed 's/v//' > ./build/python/vina/version.py | |
cat ./build/python/vina/version.py | |
- name: Install Python dependencies | |
run: python -m pip install cibuildwheel==2.0.1 | |
- name: Build wheels | |
run: | | |
cp -R ./build/python/* . | |
python -m cibuildwheel --output-dir wheelhouse | |
env: | |
CIBW_SKIP: pp* | |
CIBW_ARCHS: auto64 | |
CIBW_ARCHS_LINUX: ${{ matrix.arch }} | |
CIBW_BEFORE_BUILD: | | |
pip install --upgrade pip setuptools | |
CIBW_BEFORE_ALL_MACOS: | | |
brew install boost swig | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
CIBW_BEFORE_ALL_LINUX: | | |
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo | |
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo | |
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo | |
yum clean all && yum -y update | |
yum install -y wget python-devel pcre-devel | |
# Install SWIG | |
wget https://downloads.sourceforge.net/swig/swig-4.0.2.tar.gz | |
tar -xvf swig-4*.tar.gz | |
cd swig-4* | |
./configure --prefix=/usr --without-maximum-compile-warnings && make | |
make install && install -v -m755 -d /usr/share/doc/swig-4.0.2 && cp -v -R Doc/* /usr/share/doc/swig-4.0.2 | |
cd .. | |
# Install Boost | |
wget https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.gz | |
tar -xzf boost_1_* | |
cd boost_1_* | |
./bootstrap.sh --prefix=/usr --with-python=python | |
./b2 install threading=multi link=shared | |
cd .. | |
# Clean up | |
rm -rf boost_1_* | |
rm -rf swig-4* | |
- name: Upload artifacts for inspection | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
architecture: 'x64' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools | |
- name: Install boost-devel and swig | |
run: | | |
sudo apt-get install -y libboost-all-dev swig | |
- name: Build sdist | |
run: | | |
cd ./build/python | |
python setup.py sdist | |
- name: Upload artifacts for inspection | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sdist | |
path: ./build/python/dist/*.tar.gz | |
upload_pypi: | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
architecture: 'x64' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools twine | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: ./dist | |
- name: Publish sdist and wheel to PyPI | |
run: | | |
twine upload dist/* | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_FORLILAB }} |