-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (62 loc) · 2.03 KB
/
build.python.yml
File metadata and controls
70 lines (62 loc) · 2.03 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
on:
workflow_call:
inputs:
python_version:
required: false
type: string
description: "What Python version to use."
default: "3.13"
working-directory:
required: false
type: string
default: "."
git-sha:
required: false
type: string
default: ${{ github.event.pull_request.head.sha || github.sha }}
runs-on:
required: false
type: string
default: "ubuntu-latest"
outputs:
artifact-name:
description: The name of the artifact generated by the build
value: ${{ jobs.build.outputs.artifact-name }}
jobs:
build:
name: Build Python
runs-on: ${{ inputs.runs-on }}
outputs:
artifact-name: ${{ steps.artifact-name.outputs.artifact-name }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0' # Fetch all history for all branches and tags (for branches)
ref: ${{ inputs.git-sha }}
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "${{ inputs.working-directory }}/uv.lock"
- uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python_version }}
- name: Install dependencies
working-directory: ${{ inputs.working-directory }}
run: |
uv build
uv pip install dist/*.whl --target ./out
find ./out/ -name "__pycache__" -type d -exec rm -rf {} \;
- name: Determine artifact name
id: artifact-name
run: |
ARTIFACT_NAME="${{ inputs.working-directory }}-${{ inputs.artifact-name }}"
ARTIFACT_NAME="${ARTIFACT_NAME//\//-}"
echo "artifact-name=$ARTIFACT_NAME" >> $GITHUB_OUTPUT
- name: Store build as Artifact
uses: actions/upload-artifact@v6
id: upload-artifact
with:
name: ${{ steps.artifact-name.outputs.artifact-name }}
path: ${{ inputs.working-directory }}/out
retention-days: 5