-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (161 loc) · 6.13 KB
/
errors.yml
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# Test the error message when the trusted publishing configuration is incorrect
name: Release wrong name
on:
push:
tags:
# Publish on any tag starting with a `v`, e.g. v1.2.3
- v*
workflow_dispatch:
inputs:
ref:
description: "The commit SHA, tag, or branch of uv. Uses the last release if not specified."
default: ""
type: string
jobs:
get-binary-linux:
runs-on: ubuntu-latest
name: Get binary
steps:
- if: ${{ inputs.ref }}
uses: actions/checkout@v4
repository: "astral-sh/uv"
with:
ref: ${{ inputs.ref }}
- if: ${{ inputs.ref }}
uses: rui314/setup-mold@v1
- if: ${{ inputs.ref }}
name: Setup musl
run: |
sudo apt-get install musl-tools
rustup target add x86_64-unknown-linux-musl
- if: ${{ inputs.ref }}
uses: Swatinem/rust-cache@v2
- if: ${{ inputs.ref }}
name: Build uv
run: cargo build --target x86_64-unknown-linux-musl
- if: ${{ inputs.ref }}
name: Strip uv
run: strip ./target/x86_64-unknown-linux-musl/debug/uv
- if: ${{ inputs.ref }}
name: Upload uv
uses: actions/upload-artifact@v4
with:
name: uv
path: ./target/x86_64-unknown-linux-musl/debug/uv
- if: ${{ !inputs.ref }}
run: |
wget https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-unknown-linux-musl.tar.gz
tar xf uv-x86_64-unknown-linux-musl.tar.gz
- if: ${{ !inputs.ref }}
name: Upload uv
uses: actions/upload-artifact@v4
with:
name: uv
path: ./uv-x86_64-unknown-linux-musl/uv
pypi-wrong-name:
name: Publish wrong name
needs: get-binary-linux
runs-on: ubuntu-latest
# Environment and permissions trusted publishing.
environment:
# Create this environment in the GitHub repository under Settings -> Environments
name: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Download uv
uses: actions/download-artifact@v4
with:
name: uv
- name: Prepare uv
run: chmod +x ./uv
- run: ./uv build
# Check that basic features work and we didn't miss to include crucial files
- name: Smoke test (wheel)
run: ./uv run --isolated --no-project -p 3.13 --with dist/*.whl tests/smoke_test.py
- name: Smoke test (source distribution)
run: ./uv run --isolated --no-project -p 3.13 --with dist/*.tar.gz tests/smoke_test.py
- run: ./uv publish --trusted-publishing always
# The part below with testpypi only because it's a demo repo, remove the next two lines for production usage
env:
UV_PUBLISH_URL: https://test.pypi.org/legacy/
# Fails because the workflow name is wrong, but without `--trusted-publishing always`
pypi-wrong-name-no-trusted-publishing:
name: Publish wrong name alt
needs: get-binary-linux
runs-on: ubuntu-latest
# Environment and permissions trusted publishing.
environment:
# Create this environment in the GitHub repository under Settings -> Environments
name: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Download uv
uses: actions/download-artifact@v4
with:
name: uv
- name: Prepare uv
run: chmod +x ./uv
- uses: astral-sh/setup-uv@v3
- run: ./uv build
# Check that basic features work and we didn't miss to include crucial files
- name: Smoke test (wheel)
run: ./uv run --isolated --no-project -p 3.13 --with dist/*.whl tests/smoke_test.py
- name: Smoke test (source distribution)
run: ./uv run --isolated --no-project -p 3.13 --with dist/*.tar.gz tests/smoke_test.py
- run: ./uv publish
# The part below with testpypi only because it's a demo repo, remove the next two lines for production usage
env:
UV_PUBLISH_URL: https://test.pypi.org/legacy/
# Fails because the permission section is missing
pypi-missing-permissions:
name: Publish missing permissions
needs: get-binary-linux
runs-on: ubuntu-latest
# Environment trusted publishing.
environment:
# Create this environment in the GitHub repository under Settings -> Environments
name: release
# Here the permission section is skipped
steps:
- uses: actions/checkout@v4
- name: Download uv
uses: actions/download-artifact@v4
with:
name: uv
- name: Prepare uv
run: chmod +x ./uv
- run: ./uv build
# Check that basic features work and we didn't miss to include crucial files
- name: Smoke test (wheel)
run: ./uv run --isolated --no-project -p 3.13 --with dist/*.whl tests/smoke_test.py
- name: Smoke test (source distribution)
run: ./uv run --isolated --no-project -p 3.13 --with dist/*.tar.gz tests/smoke_test.py
- run: ./uv publish --trusted-publishing always
# The part below with testpypi only because it's a demo repo, remove the next two lines for production usage
env:
UV_PUBLISH_URL: https://test.pypi.org/legacy/
# Fails because the environment section is missing
pypi-missing-environment:
name: Publish missing environment
runs-on: ubuntu-latest
# Here the environment section is skipped
# Permissions trusted publishing.
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
- run: ./uv build
# Check that basic features work and we didn't miss to include crucial files
- name: Smoke test (wheel)
run: ./uv run --isolated --no-project -p 3.13 --with dist/*.whl tests/smoke_test.py
- name: Smoke test (source distribution)
run: ./uv run --isolated --no-project -p 3.13 --with dist/*.tar.gz tests/smoke_test.py
- run: ./uv publish --trusted-publishing always
# The part below with testpypi only because it's a demo repo, remove the next two lines for production usage
env:
UV_PUBLISH_URL: https://test.pypi.org/legacy/