Merge pull request #906 from openziti/v1-github-ubuntu-runner

v1 publish python distributions
This commit is contained in:
Kenneth Bingham 2025-03-04 22:07:27 -05:00 committed by GitHub
commit 15342e1672
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 68 additions and 62 deletions

View File

@ -1,5 +1,5 @@
[flake8]
max-line-length = 120
exclude =
./build/**
sdk/python/src/zrok_api/*
sdk/python/src/test/*

View File

@ -1,4 +1,4 @@
name: build wheels
name: Publish Python Distributions
on:
release:
@ -23,83 +23,86 @@ jobs:
exit 1
fi
build_wheels:
build_distributions:
name: Building Python Distributions
needs: enforce_stable_semver
runs-on: ubuntu-24.04
defaults:
run:
working-directory: sdk/python/src
strategy:
fail-fast: false
matrix:
spec:
- { name: 'linux x86_64', runner: ubuntu-20.04, target: manylinux_2_27_x86_64 }
- { name: 'macOS x86_64', runner: macos-13, target: macosx_10_14_x86_64 }
- { name: 'Windows x86_64', runner: windows-2019, target: win_amd64 }
name: building ${{ matrix.spec.name }}
runs-on: ${{ matrix.spec.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
cache: 'pip'
- name: Install Python Tools
run: python -m pip install -U pip setuptools
- name: Build distro
- name: Build Python distributions
env:
ZROK_VERSION: ${{ github.event.release.tag_name }}
ZROK_PY_NAME: ${{ vars.ZROK_PY_NAME || null }}
shell: bash
run: |
python setup.py sdist
set -o pipefail
set -o xtrace
# Install build requirements
pip install --upgrade pip
pip install -r build-requirements.txt
# Build source distribution and wheel
python -m build
# List built distributions
ls -lAR ./dist
- uses: actions/upload-artifact@v4
if: startsWith(matrix.spec.name, 'linux')
with:
name: zrok_sdk_${{ matrix.spec.target }}
path: dist/*
name: zrok_sdk_distributions
path: sdk/python/src/dist/*
publish-testpypi:
runs-on: ubuntu-20.04
needs: [ build_wheels ]
publish_testpypi:
name: Publish TestPyPI
runs-on: ubuntu-24.04
needs: [ build_distributions ]
permissions:
id-token: write
id-token: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./dist
path: sdk/python/src/dist
merge-multiple: true
pattern: zrok_sdk_*
pattern: zrok_sdk_distributions
- name: Publish wheels (TestPYPI)
- name: Publish Distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: dist
packages-dir: sdk/python/src/dist
skip-existing: true
verbose: true
publish-pypi:
runs-on: ubuntu-20.04
needs: [ publish-testpypi ]
publish_pypi:
name: Publish PyPI
runs-on: ubuntu-24.04
needs: [ publish_testpypi ]
permissions:
id-token: write
id-token: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./dist
path: sdk/python/src/dist
merge-multiple: true
pattern: zrok_sdk_*
pattern: zrok_sdk_distributions
- name: Publish wheels (PyPI)
- name: Publish Distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
packages-dir: sdk/python/src/dist
verbose: true

View File

@ -61,19 +61,6 @@ jobs:
shell: bash
run: go test -v ./...
- name: setup python
uses: actions/setup-python@v3
with:
python-version: '3.13'
- name: python deps
shell: bash
run: python -m pip install -U pip flake8
- name: python lint
shell: bash
run: flake8 sdk/python/src
- name: solve GOBIN
id: solve_go_bin
shell: bash
@ -89,14 +76,14 @@ jobs:
if-no-files-found: error
pytest:
name: Test the Python SDK
runs-on: ubuntu-24.04
defaults:
run:
working-directory: sdk/python/src
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
defaults:
run:
working-directory: sdk/python
steps:
- uses: actions/checkout@v4
@ -114,9 +101,10 @@ jobs:
set -o xtrace
python -m pip install --upgrade pip
pip install -e "$PWD"
pip install -r requirements.txt
pip install -r test-requirements.txt
pip install -r src/requirements.txt
pip install -r src/test-requirements.txt
pip install -r src/build-requirements.txt
pip install -e src/
- name: Test with pytest
shell: bash
@ -125,7 +113,16 @@ jobs:
set -o pipefail
set -o xtrace
pytest --cov=zrok_api --verbose
pytest --cov=zrok_api --verbose src/
- name: Lint the Python SDK
shell: bash
run: |
set -o pipefail
set -o xtrace
flake8 .
# build a release candidate container image for branches named "main" or like "v*"
rc-container-build:

View File

@ -0,0 +1,3 @@
build
wheel
versioneer

View File

@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools>=42", "wheel", "versioneer>=0.28"]
build-backend = "setuptools.build_meta"

View File

@ -1,5 +1,5 @@
[metadata]
name = zrok
# "name" property is determined by setup.py based on environment variable
author = NetFoundry
author_email = developers@openziti.org
description = zrok Python SDK