mirror of
https://github.com/openziti/zrok.git
synced 2025-06-23 03:01:54 +02:00
Merge pull request #906 from openziti/v1-github-ubuntu-runner
v1 publish python distributions
This commit is contained in:
commit
15342e1672
4
.flake8
4
.flake8
@ -1,5 +1,5 @@
|
|||||||
[flake8]
|
[flake8]
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
exclude =
|
exclude =
|
||||||
./build/**
|
sdk/python/src/zrok_api/*
|
||||||
|
sdk/python/src/test/*
|
||||||
|
73
.github/workflows/build-wheels.yml
vendored
73
.github/workflows/build-wheels.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: build wheels
|
name: Publish Python Distributions
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
@ -23,83 +23,86 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
build_wheels:
|
build_distributions:
|
||||||
|
name: Building Python Distributions
|
||||||
needs: enforce_stable_semver
|
needs: enforce_stable_semver
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
working-directory: sdk/python/src
|
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:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.13'
|
python-version: '3.13'
|
||||||
|
cache: 'pip'
|
||||||
|
|
||||||
- name: Install Python Tools
|
- name: Build Python distributions
|
||||||
run: python -m pip install -U pip setuptools
|
|
||||||
|
|
||||||
- name: Build distro
|
|
||||||
env:
|
env:
|
||||||
ZROK_VERSION: ${{ github.event.release.tag_name }}
|
ZROK_VERSION: ${{ github.event.release.tag_name }}
|
||||||
ZROK_PY_NAME: ${{ vars.ZROK_PY_NAME || null }}
|
ZROK_PY_NAME: ${{ vars.ZROK_PY_NAME || null }}
|
||||||
|
shell: bash
|
||||||
run: |
|
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
|
- uses: actions/upload-artifact@v4
|
||||||
if: startsWith(matrix.spec.name, 'linux')
|
|
||||||
with:
|
with:
|
||||||
name: zrok_sdk_${{ matrix.spec.target }}
|
name: zrok_sdk_distributions
|
||||||
path: dist/*
|
path: sdk/python/src/dist/*
|
||||||
|
|
||||||
publish-testpypi:
|
publish_testpypi:
|
||||||
runs-on: ubuntu-20.04
|
name: Publish TestPyPI
|
||||||
needs: [ build_wheels ]
|
runs-on: ubuntu-24.04
|
||||||
|
needs: [ build_distributions ]
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: ./dist
|
path: sdk/python/src/dist
|
||||||
merge-multiple: true
|
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
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
repository-url: https://test.pypi.org/legacy/
|
repository-url: https://test.pypi.org/legacy/
|
||||||
packages-dir: dist
|
packages-dir: sdk/python/src/dist
|
||||||
skip-existing: true
|
skip-existing: true
|
||||||
verbose: true
|
verbose: true
|
||||||
|
|
||||||
publish-pypi:
|
publish_pypi:
|
||||||
runs-on: ubuntu-20.04
|
name: Publish PyPI
|
||||||
needs: [ publish-testpypi ]
|
runs-on: ubuntu-24.04
|
||||||
|
needs: [ publish_testpypi ]
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: ./dist
|
path: sdk/python/src/dist
|
||||||
merge-multiple: true
|
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
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
packages-dir: dist
|
packages-dir: sdk/python/src/dist
|
||||||
verbose: true
|
verbose: true
|
||||||
|
39
.github/workflows/ci-build.yml
vendored
39
.github/workflows/ci-build.yml
vendored
@ -61,19 +61,6 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: go test -v ./...
|
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
|
- name: solve GOBIN
|
||||||
id: solve_go_bin
|
id: solve_go_bin
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -89,14 +76,14 @@ jobs:
|
|||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
pytest:
|
pytest:
|
||||||
|
name: Test the Python SDK
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: sdk/python/src
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: sdk/python
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@ -114,9 +101,10 @@ jobs:
|
|||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install -e "$PWD"
|
pip install -r src/requirements.txt
|
||||||
pip install -r requirements.txt
|
pip install -r src/test-requirements.txt
|
||||||
pip install -r test-requirements.txt
|
pip install -r src/build-requirements.txt
|
||||||
|
pip install -e src/
|
||||||
|
|
||||||
- name: Test with pytest
|
- name: Test with pytest
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -125,7 +113,16 @@ jobs:
|
|||||||
set -o pipefail
|
set -o pipefail
|
||||||
set -o xtrace
|
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*"
|
# build a release candidate container image for branches named "main" or like "v*"
|
||||||
rc-container-build:
|
rc-container-build:
|
||||||
|
3
sdk/python/src/build-requirements.txt
Normal file
3
sdk/python/src/build-requirements.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
build
|
||||||
|
wheel
|
||||||
|
versioneer
|
3
sdk/python/src/pyproject.toml
Normal file
3
sdk/python/src/pyproject.toml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=42", "wheel", "versioneer>=0.28"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
@ -1,5 +1,5 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = zrok
|
# "name" property is determined by setup.py based on environment variable
|
||||||
author = NetFoundry
|
author = NetFoundry
|
||||||
author_email = developers@openziti.org
|
author_email = developers@openziti.org
|
||||||
description = zrok Python SDK
|
description = zrok Python SDK
|
||||||
|
Loading…
x
Reference in New Issue
Block a user