Skip to content

Commit d82bf42

Browse files
Add reusable workflow for python packaging tests
Closes #8
1 parent 8099fb5 commit d82bf42

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
Name: Reusable Python packaging tests
2+
3+
on:
4+
workflow_call:
5+
additional_apt_packages:
6+
description: 'Additional APT packages to install'
7+
required: false
8+
type: string
9+
default: ''
10+
working_directory:
11+
description: 'Working directory to use (default if unspecified)'
12+
required: false
13+
type: string
14+
default: '.'
15+
cli_test_cmd:
16+
description: 'CLI test command to run'
17+
default: ''
18+
type: string
19+
20+
jobs:
21+
name: Python packaging
22+
runs-on: ubuntu-24.04
23+
steps:
24+
- name: Cancel Previous Runs
25+
uses: styfle/cancel-workflow-action@0.12.1
26+
with:
27+
access_token: ${{ github.token }}
28+
29+
- uses: actions/checkout@v4.2.2
30+
31+
- name: Install additional APT packages
32+
if: ${{ inputs.additional_apt_packages != '' }}
33+
run: sudo apt-get update && sudo apt-get install -y ${{ inputs.additional_commands }}
34+
35+
- uses: actions/setup-python@v5.4.0
36+
with:
37+
python-version: '3.12'
38+
39+
- name: Install build deps
40+
run: |
41+
pip install uv
42+
uv pip install --system build twine validate-pyproject[all]
43+
44+
- name: Check package
45+
working-directory: ${{ inputs.working_directory }}
46+
run: |
47+
validate-pyproject pyproject.toml
48+
python -m build
49+
python -m twine check --strict dist/*
50+
51+
- name: Install
52+
working-directory: ${{ inputs.working_directory }}
53+
run: python -m pip install dist/*.whl
54+
55+
- name: Run CLI (if present)
56+
if: ${{ inputs.cli_test_cmd != '' }}
57+
run: ${{ inputs.cli_test_cmd }}

0 commit comments

Comments
 (0)