Skip to content

add wheel building action #78

add wheel building action

add wheel building action #78

Workflow file for this run

name: Build Wheels for Python SDK
on:
pull_request:
branches:
- main
# Allow manual triggering of the workflow
workflow_dispatch:
inputs:
build-wheels:
description: 'Do you want to build wheels for the Python SDK?'
type: boolean
default: false
jobs:
build_wheels:
name: Build wheels for Python SDK on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macOS 13 is an Intel runner and macOS 14 is an Apple Silicon runner
os: [ubuntu-22.04, ubuntu-22.04-arm, windows-latest, macos-13, macos-14]
steps:
- uses: actions/checkout@v4
# Need to grab the SDK version for the wheel name
- name: Extract SDK Version
run: echo "SDK_VERSION=$(python -c 'import version; print(version.SDK_VERSION)')" >> $GITHUB_ENV
- name: Build wheels
env:
CIBW_SKIP: pp* *-musllinux_*
CIBW_MANYLINUX_X86_64_IMAGE: "quay.io/pypa/manylinux_2_34_x86_64"
CIBW_MANYLINUX_AARCH64_IMAGE: "quay.io/pypa/manylinux_2_34_aarch64"
CIBW_ARCHS: "native"
CIBW_TEST_REQUIRES: "pydantic pytest pytest-asyncio"
CIBW_TEST_COMMAND: "python -m pytest {project}/src/onepassword/test_client.py"
MACOSX_DEPLOYMENT_TARGET: 11.0 # Required for building on macOS
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.TEST_SERVICE_ACCOUNT_TOKEN }}
CIBW_ENVIRONMENT_PASS_LINUX: OP_SERVICE_ACCOUNT_TOKEN # to pass in the SA token, for some reason Linux doesn't read the env variables correctly
uses: pypa/[email protected]
- uses: actions/upload-artifact@v4
with:
name: onepassword-sdk-${{ env.SDK_VERSION }}-${{ matrix.os }}
path: ./wheelhouse/*.whl
build-sdist:
name: Build source distribution for Python SDK
runs-on: ubuntu-latest
steps:
# Need to grab the SDK version for the wheel name
- name: Extract SDK Version
run: echo "SDK_VERSION=$(python -c 'import version; print(version.SDK_VERSION)')" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Install dependencies
run: pip install build pydantic pytest pytest-asyncio
- name: Build source distribution
run: python -m build --sdist
- name: Test Source Distribution
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.TEST_SERVICE_ACCOUNT_TOKEN }}
run: |
python -m pip install dist/*.tar.gz
python -m pytest src/onepassword/test_client.py
- uses: actions/upload-artifact@v4
with:
name: onepassword-sdk-${{ env.SDK_VERSION }}
path: ./wheelhouse/*.tar.gz