fix publishing job

This commit is contained in:
Zied Aouini 2025-11-18 12:53:24 +01:00
parent 4dc661b2ae
commit 087a522c17
No known key found for this signature in database

View file

@ -3,28 +3,64 @@ name: build_wheel_publish
on:
push:
branches: [ master ]
#tags:
# - "v*"
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
build_linux_x86:
name: Build Linux x86_64 wheels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
- name: Build wheels (Linux x86_64)
uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_BUILD_FRONTEND: "build"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_ARCHS_LINUX: x86_64
- name: Upload wheels artifact
uses: actions/upload-artifact@v4
with:
platforms: all
name: wheels-linux-x86_64
path: wheelhouse/*.whl
build_linux_aarch64:
name: Build Linux aarch64 wheels
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- name: Build wheels (Linux aarch64)
uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_BUILD_FRONTEND: "build"
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
CIBW_ARCHS_LINUX: aarch64
- name: Upload wheels artifact
uses: actions/upload-artifact@v4
with:
name: wheels-linux-aarch64
path: wheelhouse/*.whl
build_windows:
name: Build Windows wheels
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- name: Setup MSYS2 on Windows
if: startsWith(runner.os, 'Windows')
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
@ -32,30 +68,78 @@ jobs:
install: git unzip mingw-w64-x86_64-toolchain automake1.16 automake-wrapper autoconf libtool make mingw-w64-x86_64-json-c mingw-w64-x86_64-crt-git
- name: Install NPCAP OEM on Windows
if: startsWith(runner.os, 'Windows')
shell: pwsh
run: |
choco install wget --no-progress
wget --user ${{ secrets.NPCAP_OEM_USERNAME }} --password ${{ secrets.NPCAP_OEM_PASSWORD }} https://npcap.org/oem/dist/npcap-1.60-oem.exe
Start-Process npcap-1.60-oem.exe -ArgumentList "/loopback_support=yes /winpcap_mode=yes /dot11_support=yes /S" -wait
Start-Process npcap-1.60-oem.exe -ArgumentList "/loopback_support=yes /winpcap_mode=yes /dot11_support=yes /S" -Wait
- name: Build wheels
- name: Build wheels (Windows)
uses: pypa/cibuildwheel@v3.3.0
env:
MSYSTEM: MINGW64
MSYS2_PATH: D:/a/_temp/msys64
CIBW_BUILD_FRONTEND: "build"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_BEFORE_ALL_MACOS: brew install autoconf automake libtool pkg-config gettext json-c gcc
CIBW_ARCHS_LINUX: auto aarch64
CIBW_ARCHS_WINDOWS: auto64
- name: Upload wheels artifact
uses: actions/upload-artifact@v4
with:
name: wheels-windows
path: wheelhouse/*.whl
build_macos:
name: Build macOS wheels
runs-on: macos-latest
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- name: Build wheels (macOS)
uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_BUILD_FRONTEND: "build"
CIBW_BEFORE_ALL_MACOS: brew install autoconf automake libtool pkg-config gettext json-c gcc
CIBW_ARCHS_MACOS: x86_64 arm64
- name: Publish on Pypi
# if: startsWith(github.ref, 'refs/tags/')
- name: Upload wheels artifact
uses: actions/upload-artifact@v4
with:
name: wheels-macos
path: wheelhouse/*.whl
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs:
- build_linux_x86
- build_linux_aarch64
- build_windows
- build_macos
# only publish on tag refs, e.g. refs/tags/v1.2.3
# if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download wheels artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Twine
run: |
python -m pip install --upgrade pip
python -m pip install twine
- name: Publish on PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python3 -m pip install --upgrade pip --break-system-packages
python3 -m pip install -r dev_requirements.txt --break-system-packages
python3 -m twine upload --skip-existing ./wheelhouse/nfstream-*.whl
python -m twine upload --skip-existing dist/**/nfstream-*.whl