-
Notifications
You must be signed in to change notification settings - Fork 2
171 lines (136 loc) · 4.33 KB
/
test.yml
File metadata and controls
171 lines (136 loc) · 4.33 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
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
name: Test
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
test:
name: Unit tests
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: setup uv
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
- run: make test
integration-invalid-paths-xfail:
name: "Integration test (xfail): invalid paths input"
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: attest with invalid paths (expected to fail)
id: attest
uses: ./
with:
paths: ""
continue-on-error: true
- name: assert failure
run: |
if [ "${OUTCOME}" != "failure" ]; then
echo "Expected failure, got '${OUTCOME}'"
exit 1
fi
env:
OUTCOME: ${{ steps.attest.outcome }}
integration-insufficient-perms-xfail:
name: "Integration test (xfail): insufficient permissions for attestations"
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: setup-uv
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
with:
python-version: "3.14"
- name: generate package
working-directory: /tmp
run: |
uv init --lib fakepkg
- name: version package
working-directory: /tmp/fakepkg
run: |
version="0.0.$(uv run python -m random -i 4294967296)"
uv version "${version}"
- name: build package
working-directory: /tmp/fakepkg
run: uv build
- name: attest (expected to fail)
id: attest
uses: ./
with:
paths: /tmp/fakepkg/dist/*
continue-on-error: true
- name: assert failure
run: |
if [ "${OUTCOME}" != "failure" ]; then
echo "Expected failure, got '${OUTCOME}'"
exit 1
fi
env:
OUTCOME: ${{ steps.attest.outcome }}
integration-testpypi:
name: "Integration test: publish to TestPyPI with attestations"
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # for Trusted Publishing + attest-action
environment:
name: testpypi
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: setup-uv
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
with:
python-version: "3.14"
- name: generate package
working-directory: /tmp
run: |
uv init --lib astral-attest-action-test-pypi
- name: version package
working-directory: /tmp/astral-attest-action-test-pypi
run: |
version="0.0.$(uv run python -m random -i 4294967296)"
uv version "${version}"
- name: build package
working-directory: /tmp/astral-attest-action-test-pypi
run: uv build
- name: attest
uses: ./
with:
paths: /tmp/astral-attest-action-test-pypi/dist/*
# NOTE: This should be switched to use `uv publish` once we release
# a version that includes attestation uploading support.
- name: publish to TestPyPI
working-directory: /tmp/astral-attest-action-test-pypi
run: uv publish --trusted-publishing=always --publish-url https://test.pypi.org/legacy/
all-tests-pass:
name: All tests pass
runs-on: ubuntu-slim
needs:
- test
- integration-invalid-paths-xfail
- integration-insufficient-perms-xfail
- integration-testpypi
steps:
- name: All tests pass
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}