2021-10-04 16:12:49 +03:00
|
|
|
name: PyPI 📦 Distribution
|
|
|
|
|
2021-10-07 00:24:02 +03:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
paths-ignore:
|
|
|
|
- ".gitignore"
|
|
|
|
- "docs/**"
|
|
|
|
- "README"
|
|
|
|
- "CREDITS.TXT"
|
|
|
|
- "COPYING_GLIB"
|
|
|
|
- "COPYING.LGPL2"
|
|
|
|
- "AUTHORS.TXT"
|
|
|
|
- "CHANGELOG"
|
|
|
|
- "COPYING"
|
|
|
|
pull_request:
|
2021-10-04 16:12:49 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ${{ matrix.config.os }}
|
|
|
|
name: ${{ matrix.config.name }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
config:
|
|
|
|
- {
|
|
|
|
os: windows-latest,
|
|
|
|
arch: x64,
|
|
|
|
python-ver: '3.8',
|
|
|
|
name: 'win_amd64'
|
|
|
|
}
|
|
|
|
- {
|
|
|
|
os: windows-latest,
|
|
|
|
arch: x32,
|
|
|
|
python-ver: '3.8',
|
|
|
|
name: 'win32'
|
|
|
|
}
|
|
|
|
- {
|
|
|
|
os: ubuntu-latest,
|
|
|
|
arch: x64,
|
|
|
|
python-ver: '3.8',
|
|
|
|
name: 'manylinux2014_x86_64'
|
|
|
|
}
|
|
|
|
- {
|
|
|
|
os: ubuntu-latest,
|
|
|
|
arch: x32,
|
|
|
|
python-ver: '3.8',
|
|
|
|
name: 'manylinux2014_i686'
|
|
|
|
}
|
|
|
|
- {
|
|
|
|
os: ubuntu-latest,
|
|
|
|
arch: x64,
|
|
|
|
python-ver: '3.8',
|
|
|
|
name: 'sdist'
|
|
|
|
}
|
|
|
|
- {
|
|
|
|
os: macos-latest,
|
|
|
|
arch: x64,
|
|
|
|
python-ver: '3.8',
|
|
|
|
name: 'macos_x86_64'
|
|
|
|
}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: '🛠️ Set up Python'
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.config.python-ver }}
|
|
|
|
|
|
|
|
- name: '🛠️ Add msbuild to PATH'
|
|
|
|
if: contains(matrix.config.name, 'win')
|
|
|
|
uses: microsoft/setup-msbuild@v1.0.3
|
|
|
|
with:
|
|
|
|
vs-version: '16.5'
|
|
|
|
|
|
|
|
- name: '🛠️ Win build dependencies'
|
|
|
|
if: contains(matrix.config.name, 'win')
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
choco install ninja cmake
|
|
|
|
|
|
|
|
- name: '🛠️ Install dependencies'
|
|
|
|
run: |
|
|
|
|
pip install setuptools wheel
|
|
|
|
|
|
|
|
- name: '🚧 Build distribution'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
if [ ${{ matrix.config.name }} == 'win32' ]; then
|
|
|
|
cd bindings/python && python setup.py build -p win32 sdist bdist_wheel -p win32
|
|
|
|
rm dist/*.tar.gz
|
2021-10-06 12:07:55 +03:00
|
|
|
elif [ ${{ matrix.config.name }} == 'manylinux2014_i686' ]; then
|
2021-10-04 16:12:49 +03:00
|
|
|
docker run --rm -v `pwd`/:/work dockcross/manylinux2014-x86 > ./dockcross
|
|
|
|
chmod +x ./dockcross
|
|
|
|
./dockcross bindings/python/build_wheel.sh
|
2021-10-06 12:07:55 +03:00
|
|
|
elif [ ${{ matrix.config.name }} == 'manylinux2014_x86_64' ]; then
|
2021-10-04 16:12:49 +03:00
|
|
|
docker run --rm -v `pwd`/:/work dockcross/manylinux2014-x64 > ./dockcross
|
|
|
|
chmod +x ./dockcross
|
|
|
|
./dockcross bindings/python/build_wheel.sh
|
|
|
|
elif [ ${{ matrix.config.name }} == 'sdist' ]; then
|
|
|
|
cd bindings/python && python setup.py sdist
|
|
|
|
else
|
|
|
|
cd bindings/python && python setup.py bdist_wheel
|
|
|
|
fi
|
|
|
|
- name: '📤 Upload artifact'
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
path: ${{ github.workspace }}/bindings/python/dist/*
|
|
|
|
|
|
|
|
publish:
|
|
|
|
needs: [build]
|
|
|
|
runs-on: ubuntu-latest
|
2021-10-05 15:48:54 +03:00
|
|
|
if: startsWith(github.ref, 'refs/tags')
|
2021-10-04 16:12:49 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
name: artifact
|
|
|
|
path: dist
|
|
|
|
|
|
|
|
- name: '📦 Publish distribution to PyPI'
|
|
|
|
uses: pypa/gh-action-pypi-publish@master
|
|
|
|
with:
|
|
|
|
user: __token__
|
|
|
|
password: ${{ secrets.pypi_pass }}
|