Skip to content

Build & Test Python Wheels #391

Build & Test Python Wheels

Build & Test Python Wheels #391

Workflow file for this run

name: Build & Test Python Wheels
on:
push:
# branches: [ master ]
pull_request:
# branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
release:
types: [published]
# Cancels previous runs of this workflow for the same PR
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' || startsWith(github.ref_name, 'codex/') || github.ref_name == 'wip' }}
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-22.04]
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14-dev']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Define PYTHON_CMD
run: |
PYTHON_VER="`echo ${{ matrix.python-version }} | sed 's|-dev$||'`"
echo "PYTHON_CMD=python${PYTHON_VER}" >> $GITHUB_ENV
- name: Install dependencies
run: |
${PYTHON_CMD} -m pip install --upgrade pip
pip install --upgrade setuptools wheel
pip install -r requirements.txt
- name: Build, Install & Test
run: |
${PYTHON_CMD} setup.py build
${PYTHON_CMD} setup.py sdist
sudo "`which ${PYTHON_CMD}`" setup.py install
pip install dist/sippy*.gz
${PYTHON_CMD} -m unittest
set_env:
name: List Supported Arches
uses: sippy/cimagic/.github/workflows/GetContainerPlatforms.yml@v2
with:
image: sippylabs/rtpproxy:latest
voiptests:
name: Run VoIPTests
runs-on: ubuntu-latest
needs: [set_env, build]
env:
BASE_IMAGE: sippylabs/rtpproxy:latest
TARGETPLATFORM: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: ${{ fromJSON(needs.set_env.outputs.build-matrix) }}
steps:
- uses: actions/checkout@v4
- name: Checkout VoIPTests repo
uses: actions/checkout@v4
with:
repository: 'sippy/voiptests'
path: dist/voiptests
- name: Checkout RTPProxy repo
uses: actions/checkout@v4
with:
repository: 'sippy/rtpproxy'
path: dist/rtpproxy
- name: Set up QEMU
if: matrix.platform != 'linux/386' && matrix.platform != 'linux/amd64'
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ env.TARGETPLATFORM }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache wheels
uses: actions/cache@v4
with:
path: dist_out/root/.cache
key: voiptests-${{ matrix.platform }}-pipcache-${{ github.run_id }}
restore-keys: |
voiptests-${{ matrix.platform }}-pipcache
voiptests-${{ matrix.platform }}-pipcache-${{ github.run_id }}
- name: Small things
run: test -d dist_out || mkdir dist_out
- name: VoIP Tests
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_SUMMARY: false
DOCKER_BUILD_RECORD_UPLOAD: false
with:
context: .
file: ./docker/Dockerfile.voiptests
build-args: |
RTPPC_TYPE=unix
BASE_IMAGE=${{ env.BASE_IMAGE }}
platforms: ${{ env.TARGETPLATFORM }}
outputs: type=local,dest=dist_out
cache-from: type=gha
cache-to: type=gha,mode=max
publish_wheels:
name: Publish Puthon Wheels
needs: [build, voiptests]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/sippy
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel
pip install -r requirements.txt
- name: build
run: python setup.py sdist
- name: Publish package distributions to PyPI
if: github.event_name == 'release' && github.event.action == 'published'
uses: pypa/gh-action-pypi-publish@release/v1
roll_release:
name: Release
needs: [publish_wheels]
permissions:
contents: write
uses: sippy/cimagic/.github/workflows/RollReleaseDraft.yml@v2