-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (90 loc) · 2.8 KB
/
python-uv-build-zip.yml
File metadata and controls
105 lines (90 loc) · 2.8 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
on:
workflow_call:
inputs:
python-version:
required: false
type: string
default: '3.12'
working-directory:
required: false
type: string
default: '.'
build-path:
description: Path of the build output relative to {working-directory}
required: false
type: string
default: 'dist'
uv-sync-extras:
description: Extras to include when syncing uv dependencies
required: false
type: string
default: ''
build-globs:
description: Glob(s) of the files to zip relative to the {build-path} (relative path will be reflected in the zip artifact)
required: false
type: string
default: '*'
artifact-name:
required: false
type: string
default: python-app
pre-run-script:
required: false
type: string
post-run-script:
required: false
type: string
pre-build-script:
required: false
type: string
post-build-script:
required: false
type: string
build-script:
required: false
type: string
default: uv build
jobs:
python-ci:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ${{ inputs.working-directory }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Set up uv with caching
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Set up Python ${{ inputs.python-version }}
run: uv python install ${{ inputs.python-version }}
- name: Pre-run
if: ${{ inputs.pre-run-script }}
run: ${{ inputs.pre-run-script }}
- name: Sync uv dependencies
run: uv sync --locked ${{ inputs.uv-sync-extras }}
- name: Pre build
if: ${{ inputs.pre-build-script }}
run: ${{ inputs.pre-build-script }}
- name: Build
run: ${{ inputs.build-script }}
- name: Post build
if: ${{ inputs.post-build-script }}
run: ${{ inputs.post-build-script }}
- name: Zip build folder
run: |
pushd ${{ inputs.build-path }}
zip -q -r ${{ runner.temp }}/${{ inputs.artifact-name }}.zip ${{ inputs.build-globs }}
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: ${{ inputs.artifact-name }}
path: ${{ runner.temp }}/${{ inputs.artifact-name }}.zip
if-no-files-found: error
- name: Post-run
if: ${{ inputs.post-run-script }}
run: ${{ inputs.post-run-script }}