-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (67 loc) · 1.98 KB
/
python-build.yml
File metadata and controls
77 lines (67 loc) · 1.98 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
73
74
75
76
77
name: Python Build Workflow
on:
workflow_call:
inputs:
python-version:
description: The python version to use, default '3.12'
required: false
type: string
default: 3.12
include-test-results:
description: A flag to publish test results
required: false
type: boolean
default: true
outputs:
app-version:
description: The application version
value: ${{ jobs.test.outputs.version }}
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
test:
name: "Build and Publish artifacts"
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: read
issues: read
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: '0'
submodules: 'recursive'
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
cache: 'pip'
- name: Install build dependencies with UV
run: |
python -m pip install --upgrade pip
pip install uv
uv sync
./.venv/bin/python -m build
- name: PyTest
run: uv run pytest tests --junit-xml pytest.xml
- name: Publish Test Results
if: ${{ inputs.include-test-results }}
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: "pytest.xml"
- name: Get Version
id: set-version
run: echo version=$(uv run toml get --toml-path=pyproject.toml project.version) >> $GITHUB_OUTPUT
- name: Print Version
run: echo "Version ${{ steps.set-version.outputs.version }}"
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
dist/*.whl
dist/*.gz