Publish #37
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
# This workflows will upload a Python Package using Twine when a release is created | |
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
name: Publish | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: {} | |
jobs: | |
package-source: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.8" | |
- name: Prepare C files to include | |
run: | | |
python -m pip install --upgrade pip build | |
python -m pip install -r requirements-cython.txt | |
# Make sure we install to have all c files to be shiped with bundle | |
python -m pip install -vv -U . # We set -vv to see compiler exceptions/warnings | |
- name: Build source package | |
run: python -m build --sdist | |
- name: Upload source package | |
uses: actions/upload-artifact@v2 | |
with: | |
name: dist | |
path: dist/ | |
package-wheel: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
arch: [auto] | |
include: | |
- os: ubuntu-latest | |
arch: aarch64 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.8" | |
- name: Set up QEMU | |
if: ${{ matrix.arch == 'aarch64' }} | |
uses: docker/setup-qemu-action@v1 | |
- name: Build wheels | |
env: | |
CIBW_ARCHS_LINUX: ${{matrix.arch}} | |
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-* | |
CIBW_SKIP: '*-musllinux*' | |
CIBW_BEFORE_BUILD_LINUX: pip install -r requirements-cython.txt && yum install -y zlib-devel | |
# On windows and mac we should have z library preinstalled | |
CIBW_BEFORE_BUILD: pip install -r requirements-cython.txt | |
CIBW_BUILD_VERBOSITY: 2 | |
run: | | |
python -m pip install --upgrade pip | |
pip install cibuildwheel | |
cibuildwheel --output-dir dist | |
shell: bash | |
- name: Upload wheels | |
uses: actions/upload-artifact@v2 | |
with: | |
name: dist | |
path: dist/ | |
test-wheels-windows: | |
needs: [package-source, package-wheel] | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
python: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
include: | |
- python: "3.8" | |
aiokafka_whl: dist/aiokafka-*-cp38-cp38-win_amd64.whl | |
- python: "3.9" | |
aiokafka_whl: dist/aiokafka-*-cp39-cp39-win_amd64.whl | |
- python: "3.10" | |
aiokafka_whl: dist/aiokafka-*-cp310-cp310-win_amd64.whl | |
- python: "3.11" | |
aiokafka_whl: dist/aiokafka-*-cp311-cp311-win_amd64.whl | |
- python: "3.12" | |
aiokafka_whl: dist/aiokafka-*-cp312-cp312-win_amd64.whl | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Download distributions | |
uses: actions/download-artifact@v2 | |
with: | |
name: dist | |
path: dist/ | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install -r requirements-win-test.txt | |
python -m pip install ${{ matrix.aiokafka_whl }} | |
shell: bash | |
- name: Run Unit Tests | |
run: | | |
# Remove source code to be sure we use wheel code | |
rm -rf aiokafka | |
make ci-test-unit | |
shell: bash | |
test-wheels-mac: | |
needs: [package-source, package-wheel] | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
python: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
include: | |
- python: "3.8" | |
aiokafka_whl: dist/aiokafka-*-cp38-cp38-macosx_10_9_x86_64.whl | |
- python: "3.9" | |
aiokafka_whl: dist/aiokafka-*-cp39-cp39-macosx_10_9_x86_64.whl | |
- python: "3.10" | |
aiokafka_whl: dist/aiokafka-*-cp310-cp310-macosx_10_9_x86_64.whl | |
- python: "3.11" | |
aiokafka_whl: dist/aiokafka-*-cp311-cp311-macosx_10_9_x86_64.whl | |
- python: "3.12" | |
aiokafka_whl: dist/aiokafka-*-cp312-cp312-macosx_10_9_x86_64.whl | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Download distributions | |
uses: actions/download-artifact@v2 | |
with: | |
name: dist | |
path: dist/ | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install python dependencies | |
run: | | |
pip install --upgrade pip setuptools wheel | |
pip install -r requirements-ci.txt | |
pip install ${{ matrix.aiokafka_whl }} | |
- name: Run Unit Tests | |
run: | | |
# Remove source code to be sure we use wheel code | |
rm -rf aiokafka | |
make ci-test-unit | |
test-wheels-linux: | |
needs: [package-source, package-wheel] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
include: | |
- python: "3.8" | |
aiokafka_whl: dist/aiokafka-*-cp38-cp38-manylinux*_x86_64.whl | |
- python: "3.9" | |
aiokafka_whl: dist/aiokafka-*-cp39-cp39-manylinux*_x86_64.whl | |
- python: "3.10" | |
aiokafka_whl: dist/aiokafka-*-cp310-cp310-manylinux*_x86_64.whl | |
- python: "3.11" | |
aiokafka_whl: dist/aiokafka-*-cp311-cp311-manylinux*_x86_64.whl | |
- python: "3.12" | |
aiokafka_whl: dist/aiokafka-*-cp312-cp312-manylinux*_x86_64.whl | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Download distributions | |
uses: actions/download-artifact@v2 | |
with: | |
name: dist | |
path: dist/ | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libkrb5-dev | |
- name: Install python dependencies | |
run: | | |
pip install --upgrade pip setuptools wheel | |
pip install -r requirements-ci.txt | |
pip install ${{ matrix.aiokafka_whl }} | |
- name: Run Unit Tests | |
run: | | |
# Remove source code to be sure we use wheel code | |
rm -rf aiokafka | |
make ci-test-unit | |
test-wheels-aarch64-linux: | |
needs: [package-source, package-wheel] | |
runs-on: ubuntu-latest | |
env: | |
py: /opt/python/${{ matrix.pyver }}/bin/python | |
img: quay.io/pypa/manylinux2014_aarch64 | |
strategy: | |
matrix: | |
include: | |
- pyver: cp38-cp38 | |
aiokafka_whl: dist/aiokafka-*-cp38-cp38-manylinux*_aarch64.whl | |
- pyver: cp39-cp39 | |
aiokafka_whl: dist/aiokafka-*-cp39-cp39-manylinux*_aarch64.whl | |
- pyver: cp310-cp310 | |
aiokafka_whl: dist/aiokafka-*-cp310-cp310-manylinux*_aarch64.whl | |
- pyver: cp311-cp311 | |
aiokafka_whl: dist/aiokafka-*-cp311-cp311-manylinux*_aarch64.whl | |
- pyver: cp312-cp312 | |
aiokafka_whl: dist/aiokafka-*-cp312-cp312-manylinux*_aarch64.whl | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up QEMU | |
id: qemu | |
uses: docker/setup-qemu-action@v1 | |
- name: Download distributions | |
uses: actions/download-artifact@v2 | |
with: | |
name: dist | |
path: dist/ | |
- name: Test Wheel | |
run: | | |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ | |
${{ env.img }} \ | |
bash -exc '${{ env.py }} -m venv .env && \ | |
source .env/bin/activate && \ | |
yum install -y epel-release && \ | |
yum-config-manager --enable epel && \ | |
yum install -y krb5-devel && \ | |
pip install --upgrade pip setuptools wheel && \ | |
pip install -r requirements-ci.txt && \ | |
pip install ${{ matrix.aiokafka_whl }} && \ | |
rm -rf aiokafka && \ | |
make ci-test-unit && \ | |
deactivate' | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [test-wheels-linux, test-wheels-aarch64-linux, test-wheels-mac, test-wheels-windows] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Download distributions | |
uses: actions/download-artifact@v2 | |
with: | |
name: dist | |
path: dist/ | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: ${{ secrets.PYPI_USERNAME }} | |
password: ${{ secrets.PYPI_PASSWORD }} |