Rewrite compile.bat and Update GA workflow to build binaries on Windows: Use Git Version, Use MSBuild, and Allow custom Boost and MSBuild paths #166
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@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
architecture: 'x64' | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v2 | |
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 setuptools wheel packaging | |
- name: Check setuptools version | |
run: | | |
echo "checking setuptools version" | |
python -c "import setuptools; print(setuptools.__version__)" | |
- 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 wheel packaging | |
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 | |
wget https://archives.boost.io/release/1.82.0/source/boost_1_82_0.tar.gz | |
tar -xzf boost_1_82_0.tar.gz | |
cd boost_1_82_0 | |
ls | |
./bootstrap.sh --prefix=/usr --with-python=python | |
./b2 install threading=multi link=shared | |
cd .. | |
export CXXFLAGS="-I/usr/include" | |
export LDFLAGS="-L/usr/lib64" | |
# Clean up | |
rm -rf boost_1_* | |
rm -rf swig-4* | |
- name: Upload artifacts for inspection | |
if: ${{ env.ACT }} != 'true' # Skip this step if running locally using 'act' | |
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@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
architecture: 'x64' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel packaging | |
- 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@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
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 }} |