-
Notifications
You must be signed in to change notification settings - Fork 1
213 lines (187 loc) · 6.73 KB
/
Copy pathpython-package.yml
File metadata and controls
213 lines (187 loc) · 6.73 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
name: python-package
on:
push:
branches: [main, dev]
paths:
- ".github/workflows/python-package.yml"
- "LICENSE"
- "plugins/claude-code/**"
- "python/**"
- "scripts/run-no-key-mvp-demo.py"
- "scripts/sync-python-package-assets.py"
- "scripts/validate-python-distribution.py"
pull_request:
branches: [main, dev]
paths:
- ".github/workflows/python-package.yml"
- "LICENSE"
- "plugins/claude-code/**"
- "python/**"
- "scripts/run-no-key-mvp-demo.py"
- "scripts/sync-python-package-assets.py"
- "scripts/validate-python-distribution.py"
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: Build Python distributions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.13"
- name: Install pinned release tooling
run: python -m pip install build==1.5.0 twine==6.2.0
- name: Verify packaged assets are synchronized
run: python scripts/sync-python-package-assets.py --check
- name: Build wheel and source distribution
run: python -m build --outdir dist .
working-directory: python
- name: Validate distribution contents and metadata
run: |
python scripts/validate-python-distribution.py --dist-dir python/dist
python -m twine check --strict python/dist/*
- name: Verify release tag and main ancestry
if: github.event_name == 'release'
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
python scripts/validate-python-distribution.py \
--dist-dir python/dist \
--expected-tag "$RELEASE_TAG"
git merge-base --is-ancestor "$GITHUB_SHA" origin/main
- name: Record artifact digests
run: sha256sum python/dist/*
- name: Store distributions
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: python-package-distributions
path: python/dist/
if-no-files-found: error
retention-days: 14
package-smoke:
name: Wheel smoke (Python ${{ matrix.python-version }})
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.13"]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: ${{ matrix.python-version }}
- name: Retrieve distributions
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: python-package-distributions
path: dist
- name: Install the wheel
run: python -m pip install dist/ardur-*-py3-none-any.whl
- name: Prove imports resolve outside the source checkout
working-directory: ${{ runner.temp }}
env:
SOURCE_ROOT: ${{ github.workspace }}
run: |
python - <<'PY'
import os
from pathlib import Path
import vibap
installed = Path(vibap.__file__).resolve()
source = Path(os.environ["SOURCE_ROOT"]).resolve()
assert not installed.is_relative_to(source), (installed, source)
print(f"installed-package={installed}")
PY
ardur --version
- name: Run the installed PERMIT and DENY lifecycle
working-directory: ${{ runner.temp }}
run: python "$GITHUB_WORKSPACE/scripts/run-no-key-mvp-demo.py"
- name: Verify packaged plugin protection path
working-directory: ${{ runner.temp }}
run: |
mkdir package-project package-tmp
cd package-project
ardur profile init --template read-only --path ARDUR.md --json
TMPDIR="$RUNNER_TEMP/package-tmp" ardur protect claude-code \
--scope "$PWD" \
--profile "$PWD/ARDUR.md" \
--mode read-only \
--home "$RUNNER_TEMP/ardur-home" \
--json
python-3-9-guard:
name: Python 3.9 requirement guard
needs: build
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.9
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.9"
- name: Retrieve distributions
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: python-package-distributions
path: dist
- name: Require a clear Python 3.10 or newer error
run: |
set +e
output="$(python -m pip install --no-deps dist/ardur-*-py3-none-any.whl 2>&1)"
status=$?
set -e
printf '%s\n' "$output"
test "$status" -ne 0
grep -F "requires a different Python" <<<"$output"
grep -F ">=3.10" <<<"$output"
publish-testpypi:
name: Publish to TestPyPI
if: github.event_name == 'workflow_dispatch'
needs: [build, package-smoke, python-3-9-guard]
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/ardur
permissions:
id-token: write
steps:
- name: Retrieve distributions
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: python-package-distributions
path: dist
- name: Publish distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
with:
packages-dir: dist/
repository-url: https://test.pypi.org/legacy/
publish-pypi:
name: Publish reviewed release to PyPI
if: github.event_name == 'release' && github.event.release.prerelease == false
needs: [build, package-smoke, python-3-9-guard]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/ardur
permissions:
id-token: write
steps:
- name: Retrieve distributions
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: python-package-distributions
path: dist
- name: Publish distributions to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
with:
packages-dir: dist/