unicorn/.github/workflows/PyPI-publishing.yml

158 lines
4.5 KiB
YAML
Raw Normal View History

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:
- {
2022-02-17 12:47:31 +03:00
os: windows-2019,
2021-10-04 16:12:49 +03:00
arch: x64,
python-ver: '3.8',
name: 'win_amd64'
}
- {
2022-02-17 12:47:31 +03:00
os: windows-2019,
2021-10-04 16:12:49 +03:00
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'
}
2022-10-01 02:01:22 +03:00
- {
os: ubuntu-latest,
2022-10-01 02:02:04 +03:00
arch: aarch64,
2022-10-01 02:01:22 +03:00
python-ver: '3.8',
name: 'manylinux2014_aarch64'
}
2021-10-04 16:12:49 +03:00
- {
os: ubuntu-latest,
arch: x64,
python-ver: '3.8',
name: 'sdist'
}
- {
2024-02-11 07:41:53 +03:00
os: macos-12,
2021-10-04 16:12:49 +03:00
arch: x64,
python-ver: '3.8',
name: 'macos_x86_64'
}
2024-02-11 07:41:53 +03:00
- {
os: macos-14,
arch: aarch64,
2024-02-11 08:19:25 +03:00
python-ver: '3.10',
name: 'macos_aarch64'
2024-02-11 07:41:53 +03:00
}
2021-10-04 16:12:49 +03:00
steps:
2024-07-19 06:06:53 +03:00
- uses: actions/checkout@v4
2021-10-04 16:12:49 +03:00
- name: '🛠️ Set up Python'
2024-02-11 07:58:58 +03:00
uses: actions/setup-python@v5
2021-10-04 16:12:49 +03:00
with:
python-version: ${{ matrix.config.python-ver }}
- name: '🛠️ Add msbuild to PATH'
if: contains(matrix.config.name, 'win')
2024-07-19 06:06:53 +03:00
uses: microsoft/setup-msbuild@v2
2021-10-04 16:12:49 +03:00
with:
vs-version: '16.5'
2022-05-03 01:03:48 +03:00
- name: '🛠️ Win MSVC 32 dev cmd setup'
if: contains(matrix.config.name, 'win32')
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86
- name: '🛠️ Win MSVC 64 dev cmd setup'
if: contains(matrix.config.name, 'win_amd64')
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
2021-10-04 16:12:49 +03:00
- name: '🛠️ Win build dependencies'
if: contains(matrix.config.name, 'win')
shell: bash
run: |
choco install ninja cmake
2023-02-20 22:51:37 +03:00
- name: '🛠️ macOS dependencies'
if: contains(matrix.config.name, 'macos')
run: |
2024-07-19 06:06:53 +03:00
brew install ninja
2023-02-20 22:51:37 +03:00
- name: '🛠️ pip dependencies'
2021-10-04 16:12:49 +03:00
run: |
pip install --upgrade setuptools wheel
2021-10-04 16:12:49 +03:00
- 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
2022-10-01 02:04:49 +03:00
docker run --rm -v `pwd`/:/work dockcross/manylinux2014-x86 > ./dockcross
2021-10-04 16:12:49 +03:00
chmod +x ./dockcross
./dockcross bindings/python/build_wheel.sh
2022-10-01 02:04:49 +03:00
elif [ ${{ matrix.config.name }} == 'manylinux2014_aarch64' ]; then
2022-10-01 02:31:13 +03:00
docker run --rm -v `pwd`/:/work dockcross/manylinux2014-aarch64 > ./dockcross
chmod +x ./dockcross
./dockcross bindings/python/build_wheel.sh --plat-name manylinux2014_aarch64
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'
2024-07-19 06:06:53 +03:00
uses: actions/upload-artifact@v4
2021-10-04 16:12:49 +03:00
with:
2024-07-19 06:06:53 +03:00
name: ${{ matrix.config.name }}
2021-10-04 16:12:49 +03:00
path: ${{ github.workspace }}/bindings/python/dist/*
publish:
needs: [build]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
2021-10-04 16:12:49 +03:00
steps:
2024-07-19 06:06:53 +03:00
- uses: actions/download-artifact@v4
2021-10-04 16:12:49 +03:00
with:
2024-07-19 06:06:53 +03:00
merge-multiple: true
2021-10-04 16:12:49 +03:00
path: dist
- name: '📦 Publish distribution to PyPI'
2024-07-19 06:06:53 +03:00
uses: pypa/gh-action-pypi-publish@release/v1
2021-10-04 16:12:49 +03:00
with:
user: __token__
password: ${{ secrets.pypi_pass }}