From 57fba142b57394cde2375dc9c42ae062a870088b Mon Sep 17 00:00:00 2001 From: Jerome Kelleher Date: Fri, 30 Jan 2026 13:29:38 +0000 Subject: [PATCH] Add reusable workflow for python packaging tests Closes #8 --- .github/workflows/python-packaging.yml | 57 ++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/python-packaging.yml diff --git a/.github/workflows/python-packaging.yml b/.github/workflows/python-packaging.yml new file mode 100644 index 0000000..baccb41 --- /dev/null +++ b/.github/workflows/python-packaging.yml @@ -0,0 +1,57 @@ +name: Reusable Python packaging tests + +on: + workflow_call: + additional_apt_packages: + description: 'Additional APT packages to install' + required: false + type: string + default: '' + working_directory: + description: 'Working directory to use (default if unspecified)' + required: false + type: string + default: '.' + cli_test_cmd: + description: 'CLI test command to run' + default: '' + type: string + +jobs: + name: Python packaging + runs-on: ubuntu-24.04 + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - uses: actions/checkout@v4.2.2 + + - name: Install additional APT packages + if: ${{ inputs.additional_apt_packages != '' }} + run: sudo apt-get update && sudo apt-get install -y ${{ inputs.additional_commands }} + + - uses: actions/setup-python@v5.4.0 + with: + python-version: '3.12' + + - name: Install build deps + run: | + pip install uv + uv pip install --system build twine validate-pyproject[all] + + - name: Check package + working-directory: ${{ inputs.working_directory }} + run: | + validate-pyproject pyproject.toml + python -m build + python -m twine check --strict dist/* + + - name: Install + working-directory: ${{ inputs.working_directory }} + run: python -m pip install dist/*.whl + + - name: Run CLI (if present) + if: ${{ inputs.cli_test_cmd != '' }} + run: ${{ inputs.cli_test_cmd }}