mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 12:28:42 +00:00
104 lines
3.1 KiB
YAML
104 lines
3.1 KiB
YAML
name: Python Package
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
push:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build_wheels:
|
|
name: Build wheels on ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, ubuntu-24.04-arm, macos-15]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
# Run locally with: pipx run cibuildwheel --platform linux python
|
|
- name: Build wheels
|
|
uses: pypa/cibuildwheel@v4.3.4
|
|
with:
|
|
package-dir: python
|
|
|
|
- uses: actions/upload-artifact@v7
|
|
with:
|
|
name: opendht-wheels-${{ matrix.os }}
|
|
path: ./wheelhouse/*.whl
|
|
|
|
build_wheels_windows:
|
|
name: Build wheels on Windows
|
|
runs-on: windows-latest
|
|
env:
|
|
VCPKG_DISABLE_METRICS: "1"
|
|
VCPKG_DEFAULT_TRIPLET: x64-windows-release
|
|
VCPKG_INSTALLED_DIR: ${{ github.workspace }}\vcpkg_installed
|
|
VCPKG_BINARY_SOURCES: clear;files,${{ github.workspace }}/vcpkg-binary-cache,readwrite
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Set up vcpkg
|
|
uses: lukka/run-vcpkg@v11
|
|
with:
|
|
vcpkgJsonGlob: vcpkg.json
|
|
vcpkgConfigurationJsonGlob: vcpkg-configuration.json
|
|
|
|
- name: Cache vcpkg binary packages
|
|
uses: actions/cache@v6
|
|
with:
|
|
path: ${{ github.workspace }}/vcpkg-binary-cache
|
|
key: ${{ runner.os }}-vcpkg-binary-${{ env.VCPKG_DEFAULT_TRIPLET }}-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json', 'ports/**') }}-${{ github.run_id }}-${{ github.run_attempt }}
|
|
restore-keys: |
|
|
${{ runner.os }}-vcpkg-binary-${{ env.VCPKG_DEFAULT_TRIPLET }}-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json', 'ports/**') }}-
|
|
${{ runner.os }}-vcpkg-binary-${{ env.VCPKG_DEFAULT_TRIPLET }}-
|
|
|
|
- name: Build wheels
|
|
run: |
|
|
pip install cython delvewheel build
|
|
cmake -S . -B build `
|
|
-DCMAKE_BUILD_TYPE=Release `
|
|
-DVCPKG_TARGET_TRIPLET=${{ env.VCPKG_DEFAULT_TRIPLET }} `
|
|
"-DCMAKE_TOOLCHAIN_FILE=$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" `
|
|
-DVCPKG_INSTALLED_DIR=${{ env.VCPKG_INSTALLED_DIR }} `
|
|
-DBUILD_TESTING=OFF `
|
|
-DOPENDHT_C=OFF `
|
|
-DOPENDHT_TOOLS=OFF `
|
|
-DOPENDHT_PYTHON=ON `
|
|
-DOPENDHT_DOCUMENTATION=OFF `
|
|
-DOPENDHT_PROXY_CLIENT=ON `
|
|
-DOPENDHT_PROXY_SERVER=ON
|
|
cd build
|
|
pipx run cibuildwheel python
|
|
shell: pwsh
|
|
|
|
- uses: actions/upload-artifact@v7
|
|
with:
|
|
name: opendht-wheels-win_amd64
|
|
path: ./build/wheelhouse/*.whl
|
|
|
|
publish:
|
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
|
runs-on: ubuntu-latest
|
|
needs: [build_wheels, build_wheels_windows]
|
|
environment:
|
|
name: pypi
|
|
url: https://pypi.org/p/opendht
|
|
permissions:
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
pattern: opendht-wheels-*
|
|
path: dist
|
|
merge-multiple: true
|
|
|
|
- name: Publish package
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|