-
Notifications
You must be signed in to change notification settings - Fork 2
72 lines (61 loc) · 2.19 KB
/
python-packaging.yml
File metadata and controls
72 lines (61 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Reusable Python packaging tests
on:
workflow_call:
inputs:
additional-apt-packages:
description: 'Additional APT packages to install'
required: false
type: string
default: ''
pyproject-directory:
description: 'Directory to find pyproject.toml'
required: false
type: string
default: '.'
cli-test-cmd:
description: 'CLI test command to run'
default: ''
type: string
jobs:
python-packaging:
name: Python packaging tests
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
with:
submodules: true
fetch-depth: 0
- name: Install additional APT packages
if: ${{ inputs.additional-apt-packages != '' }}
run: sudo apt-get update && sudo apt-get install -y ${{ inputs.additional-apt-packages }}
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.10.0"
- name: Install packaging deps
working-directory: ${{ inputs.pyproject-directory }}
run: uv sync --locked --group packaging --no-default-groups
- name: Validate pyproject
working-directory: ${{ inputs.pyproject-directory }}
run: uv run --locked --group packaging --no-default-groups validate-pyproject pyproject.toml -v
- name: Build artefacts
working-directory: ${{ inputs.pyproject-directory }}
run: uv build
- name: Twine check
working-directory: ${{ inputs.pyproject-directory }}
run: uv run --locked --group packaging --no-default-groups twine check --strict dist/*
- name: Install into venv
working-directory: ${{ inputs.pyproject-directory }}
run: |
uv venv cli-test
uv pip install --python=cli-test dist/*.whl
- name: Run CLI (if present)
if: ${{ inputs.cli-test-cmd != '' }}
working-directory: ${{ inputs.pyproject-directory }}
run: |
source cli-test/bin/activate
./cli-test/bin/${{ inputs.cli-test-cmd }}