livingproof-common 1.0.51__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. livingproof_common-1.0.51/.devcontainer/devcontainer.json +8 -0
  2. livingproof_common-1.0.51/.dockerignore +5 -0
  3. livingproof_common-1.0.51/.github/PAGES.md +33 -0
  4. livingproof_common-1.0.51/.github/workflows/verify.yml +467 -0
  5. livingproof_common-1.0.51/.gitignore +8 -0
  6. livingproof_common-1.0.51/AGENTS.md +25 -0
  7. livingproof_common-1.0.51/Dockerfile +38 -0
  8. livingproof_common-1.0.51/LICENSE +201 -0
  9. livingproof_common-1.0.51/PKG-INFO +49 -0
  10. livingproof_common-1.0.51/README.md +40 -0
  11. livingproof_common-1.0.51/Taskfile.runtime.yml +44 -0
  12. livingproof_common-1.0.51/Taskfile.yml +42 -0
  13. livingproof_common-1.0.51/compose.yaml +32 -0
  14. livingproof_common-1.0.51/docs/contributing.md +17 -0
  15. livingproof_common-1.0.51/docs/development.md +49 -0
  16. livingproof_common-1.0.51/docs/license.md +7 -0
  17. livingproof_common-1.0.51/docs/mkdocs.yml +46 -0
  18. livingproof_common-1.0.51/docs/search.md +5 -0
  19. livingproof_common-1.0.51/docs/usage.md +86 -0
  20. livingproof_common-1.0.51/docs/verification.md +89 -0
  21. livingproof_common-1.0.51/hatch_build.py +19 -0
  22. livingproof_common-1.0.51/pyproject.toml +34 -0
  23. livingproof_common-1.0.51/renovate.json +17 -0
  24. livingproof_common-1.0.51/src/livingproof_common/__init__.py +1 -0
  25. livingproof_common-1.0.51/src/livingproof_common/_build_provenance.json +14 -0
  26. livingproof_common-1.0.51/src/livingproof_common/versioning.py +207 -0
  27. livingproof_common-1.0.51/tests/browser/manual_session.py +136 -0
  28. livingproof_common-1.0.51/tests/browser/test_manual.py +362 -0
  29. livingproof_common-1.0.51/tests/conftest.py +70 -0
  30. livingproof_common-1.0.51/tests/test_apt_resilience.py +293 -0
  31. livingproof_common-1.0.51/tests/test_artifacts.py +175 -0
  32. livingproof_common-1.0.51/tests/test_deploy_freshness_auth.py +381 -0
  33. livingproof_common-1.0.51/tests/test_documentation.py +57 -0
  34. livingproof_common-1.0.51/tests/test_guidelines_pins.py +199 -0
  35. livingproof_common-1.0.51/tests/test_manual_release.py +158 -0
  36. livingproof_common-1.0.51/tests/test_pypa_build_review.py +63 -0
  37. livingproof_common-1.0.51/tests/test_release_first.py +181 -0
  38. livingproof_common-1.0.51/tests/test_release_path_simulation.py +236 -0
  39. livingproof_common-1.0.51/tests/test_reporting.py +8 -0
  40. livingproof_common-1.0.51/tests/test_verification_gate.py +89 -0
  41. livingproof_common-1.0.51/tests/test_verify_job_timeout.py +23 -0
  42. livingproof_common-1.0.51/tests/test_versioning.py +314 -0
  43. livingproof_common-1.0.51/tools/api_reference.py +16 -0
  44. livingproof_common-1.0.51/tools/apt-install.sh +80 -0
  45. livingproof_common-1.0.51/tools/docs.py +208 -0
  46. livingproof_common-1.0.51/tools/evidence.py +14 -0
  47. livingproof_common-1.0.51/tools/links.py +43 -0
  48. livingproof_common-1.0.51/tools/manual_release.py +87 -0
  49. livingproof_common-1.0.51/tools/package.py +63 -0
  50. livingproof_common-1.0.51/tools/scenario_summary.py +37 -0
  51. livingproof_common-1.0.51/tools/smoke.sh +10 -0
  52. livingproof_common-1.0.51/tools/test.py +10 -0
  53. livingproof_common-1.0.51/uv.lock +750 -0
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "Living Proof Labs common library",
3
+ "dockerComposeFile": "../compose.yaml",
4
+ "service": "tooling",
5
+ "workspaceFolder": "/workspace/common",
6
+ "remoteUser": "vscode",
7
+ "postCreateCommand": "task -t Taskfile.runtime.yml setup"
8
+ }
@@ -0,0 +1,5 @@
1
+ .git
2
+ .venv
3
+ artifacts
4
+ dist
5
+ __pycache__
@@ -0,0 +1,33 @@
1
+ # Common library manual publication
2
+
3
+ Target: `https://docs.livingprooflabs.com/livingproof-common/`. No project CNAME,
4
+ custom domain, DNS or mail change is needed or authorized here.
5
+
6
+ Scoped approval covers main-only deployment. The deployment job has
7
+ `contents: read`, `pages: write`, and `id-token: write`. The main-freshness
8
+ read calls `gh api` with `GH_TOKEN: ${{ github.token }}`. `contents: read`
9
+ is enough, and the job does not get `contents: write`. Documentation builds
10
+ and pull requests use `contents: read`. The parent browser worker owns settings:
11
+
12
+ - Enable this repository's Pages source as GitHub Actions (`build_type: workflow`).
13
+ - Configure the `github-pages` environment to permit deployments from `main` only.
14
+ - Leave repository-wide token defaults, domains and other settings unchanged.
15
+
16
+ The release writer waits for the library matrix and the sealed candidate
17
+ manual's browser tests. The deployment renders and tests the manual anew using
18
+ the exact checkout and the matching wheel downloaded from the immutable
19
+ published release. The Pages job verifies the final archive by both same-run
20
+ artifact ID and attempt-qualified name. A read-only `gh api` check,
21
+ authenticated with the workflow token, compares that commit to current `main`
22
+ inside the deployment lock, immediately before publication. The job fails
23
+ closed if any of these checks fail. A branch can still advance after the final
24
+ check, so the successful deployment must be verified live.
25
+
26
+ For Pages delivery only, use the same workflow on `main` with its existing
27
+ published stable tag. This route does not create a tag or rebuild, edit, or
28
+ republish release assets.
29
+
30
+ A successful artifact upload is not a verified live manual. Record the deployed
31
+ revision/run/URL and exercise navigation, search and result opening, themes,
32
+ assets, a deep link and related manual links before declaring adoption complete.
33
+ Replace the README's temporary source-documentation link only after that evidence.
@@ -0,0 +1,467 @@
1
+ name: Library verification and release
2
+ on:
3
+ pull_request:
4
+ merge_group:
5
+ types: [checks_requested]
6
+ push:
7
+ branches: [main, ci/reporting-failure]
8
+ workflow_dispatch:
9
+ inputs:
10
+ release_tag:
11
+ description: Existing published stable release tag pointing to current main (Pages retry only)
12
+ required: true
13
+ type: string
14
+ permissions:
15
+ contents: read
16
+ jobs:
17
+ version:
18
+ # No forecast on a main push (releases.md L174-180): the release resolves the version.
19
+ # Pull requests into main and the workflow_dispatch retry of an existing tag still plan here.
20
+ if: >-
21
+ (github.event_name == 'pull_request' && github.base_ref == 'main') ||
22
+ (github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch')
23
+ permissions:
24
+ contents: read
25
+ uses: Living-Proof-Labs/collaboration-guidelines/.github/workflows/semantic-release-candidate.yml@v9.12.0
26
+ with:
27
+ replay-tag: ${{ inputs.release_tag || '' }}
28
+ verify:
29
+ needs: version
30
+ if: ${{ !cancelled() && (needs.version.result == 'success' || needs.version.result == 'skipped') }}
31
+ permissions:
32
+ contents: read
33
+ strategy:
34
+ fail-fast: false
35
+ matrix:
36
+ runner: [ubuntu-24.04, ubuntu-24.04-arm]
37
+ runs-on: ${{ matrix.runner }}
38
+ # Normal runs take 1.5-2.5 minutes; a hung step must not hold the job for
39
+ # GitHub's 6-hour default (PR 63 run 46431292274 hung 77 minutes in apt).
40
+ timeout-minutes: 20
41
+ env:
42
+ MANUAL_VERSION: ${{ needs.version.outputs.semver-version }}
43
+ MANUAL_WHEEL_VERSION: ${{ needs.version.outputs.pep440-version }}
44
+ PLAN_COMMIT: ${{ needs.version.outputs.commit }}
45
+ PLAN_RUN: ${{ needs.version.outputs.run-id }}
46
+ PLAN_ATTEMPT: ${{ needs.version.outputs.run-attempt }}
47
+ REPORTING_FAILURE_FIXTURE: ${{ github.ref == 'refs/heads/ci/reporting-failure' && '1' || '0' }}
48
+ steps:
49
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
50
+ with:
51
+ fetch-depth: 0
52
+ ref: ${{ github.event.pull_request.head.sha || github.sha }}
53
+ persist-credentials: false
54
+ - uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e
55
+ with:
56
+ version: '3.54.0'
57
+ - name: Match mounted checkout ownership
58
+ run: |
59
+ echo "LOCAL_UID=$(id -u)" >> "$GITHUB_ENV"
60
+ echo "LOCAL_GID=$(id -g)" >> "$GITHUB_ENV"
61
+ - name: Check candidate source and plan identity
62
+ env:
63
+ EXPECTED: ${{ github.event.pull_request.head.sha || github.sha }}
64
+ run: |
65
+ set -euo pipefail
66
+ test "$(git rev-parse HEAD)" = "$EXPECTED"
67
+ if [ -n "$MANUAL_VERSION" ] || [ -n "$PLAN_COMMIT" ]; then
68
+ test -n "$MANUAL_VERSION"
69
+ test -n "$MANUAL_WHEEL_VERSION"
70
+ test "$PLAN_COMMIT" = "$EXPECTED"
71
+ test "$PLAN_RUN" = "$GITHUB_RUN_ID"
72
+ test "$PLAN_ATTEMPT" = "$GITHUB_RUN_ATTEMPT"
73
+ fi
74
+ - run: task setup
75
+ - run: task check
76
+ - run: task test
77
+ - name: Publish consumer scenario outcomes
78
+ if: ${{ !cancelled() }}
79
+ run: |
80
+ task reports
81
+ cat artifacts/scenario-summary.md >> "$GITHUB_STEP_SUMMARY"
82
+ - name: Build manual with available test evidence
83
+ if: ${{ !cancelled() }}
84
+ run: task docs
85
+ - name: Seal verified candidate manual
86
+ if: ${{ !cancelled() && env.MANUAL_VERSION != '' }}
87
+ run: |
88
+ python3 tools/manual_release.py seal "$MANUAL_VERSION" "$MANUAL_WHEEL_VERSION" \
89
+ "$PLAN_COMMIT" "$PLAN_RUN" "$PLAN_ATTEMPT" candidate
90
+ - name: Publish individual test results and summary
91
+ if: ${{ !cancelled() }}
92
+ uses: dorny/test-reporter@d1b5dff021aa968b288b02285a8bf47471c5928a
93
+ with:
94
+ name: Library tests (${{ matrix.runner }})
95
+ path: artifacts/tests.xml
96
+ reporter: python-xunit
97
+ use-actions-summary: 'true'
98
+ collapsed: never
99
+ fail-on-error: 'true'
100
+ fail-on-empty: 'true'
101
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
102
+ if: always()
103
+ with:
104
+ name: library-reports-${{ matrix.runner }}-${{ github.run_attempt }}
105
+ path: |
106
+ artifacts/tests.xml
107
+ artifacts/scenarios.json
108
+ artifacts/coverage/
109
+ retention-days: 30
110
+ if-no-files-found: error
111
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
112
+ if: ${{ !cancelled() }}
113
+ with:
114
+ name: common-manual-${{ matrix.runner }}-${{ github.run_attempt }}-${{ env.MANUAL_VERSION || 'development' }}
115
+ path: |
116
+ artifacts/docs/html/
117
+ artifacts/docs/source/
118
+ artifacts/docs/seal.json
119
+ artifacts/docs-wheel/
120
+ retention-days: 14
121
+ if-no-files-found: error
122
+ - name: Link this run's review artifacts
123
+ if: ${{ !cancelled() }}
124
+ env:
125
+ RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
126
+ run: echo "[Run and artifacts]($RUN_URL) — manual previews 14 days; raw library reports 30 days." >> "$GITHUB_STEP_SUMMARY"
127
+ - run: task package
128
+ - run: task smoke
129
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
130
+ if: ${{ always() && hashFiles('dist/**') != '' }}
131
+ with:
132
+ name: library-packages-${{ matrix.runner }}-${{ github.run_attempt }}
133
+ path: dist/
134
+ retention-days: 30
135
+ release:
136
+ # Release-first (#60): verification (tests and the browser-tested development manual)
137
+ # gates the release; the released manual is built and sealed after it.
138
+ needs: [verify, documentation]
139
+ # !cancelled(): `version` is skipped on a main push, and without a status function
140
+ # the implicit success() would skip this job too. The results below stop it after
141
+ # any real failure.
142
+ if: >-
143
+ !cancelled() &&
144
+ github.event_name == 'push' && github.ref == 'refs/heads/main' &&
145
+ needs.verify.result == 'success' && needs.documentation.result == 'success'
146
+ permissions:
147
+ contents: write
148
+ uses: Living-Proof-Labs/collaboration-guidelines/.github/workflows/semantic-release.yml@v9.12.0
149
+ with:
150
+ draft-release: true
151
+ publish:
152
+ needs: release
153
+ if: >-
154
+ !cancelled() &&
155
+ github.event_name == 'push' && github.ref == 'refs/heads/main' &&
156
+ needs.release.result == 'success' &&
157
+ needs.release.outputs.draft-created == 'true' &&
158
+ needs.release.outputs.version != '' &&
159
+ needs.release.outputs.git-tag == format('v{0}', needs.release.outputs.version) &&
160
+ needs.release.outputs.commit == github.sha
161
+ runs-on: ubuntu-24.04
162
+ permissions:
163
+ contents: write
164
+ env:
165
+ VERSION: ${{ needs.release.outputs.version }}
166
+ RELEASE_TAG: ${{ needs.release.outputs.git-tag }}
167
+ steps:
168
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
169
+ with:
170
+ ref: ${{ needs.release.outputs.git-tag }}
171
+ fetch-depth: 0
172
+ fetch-tags: true
173
+ persist-credentials: false
174
+ - name: Require the tested version and exact release tag before packaging
175
+ run: |
176
+ set -euo pipefail
177
+ [[ "$VERSION" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]
178
+ test "$RELEASE_TAG" = "v$VERSION"
179
+ test "$(git rev-parse HEAD)" = "$GITHUB_SHA"
180
+ test "$(git rev-parse --verify "refs/tags/${RELEASE_TAG}^{commit}")" = "$GITHUB_SHA"
181
+ - uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e
182
+ with:
183
+ version: '3.54.0'
184
+ - run: |
185
+ echo "LOCAL_UID=$(id -u)" >> "$GITHUB_ENV"
186
+ echo "LOCAL_GID=$(id -g)" >> "$GITHUB_ENV"
187
+ - run: task setup
188
+ - run: task package
189
+ - run: task smoke
190
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
191
+ if: always()
192
+ with:
193
+ name: release-packages-${{ github.run_attempt }}
194
+ path: dist/
195
+ retention-days: 30
196
+ - name: Attach all assets, publish draft release, and verify public downloads
197
+ uses: Living-Proof-Labs/collaboration-guidelines/.github/actions/publish-draft-release@v9.12.0
198
+ with:
199
+ tag: ${{ needs.release.outputs.git-tag }}
200
+ assets: |
201
+ dist/*.whl
202
+ dist/*.tar.gz
203
+ dist/*.deb
204
+ dist/SHA256SUMS
205
+ documentation:
206
+ needs: [verify, version]
207
+ if: ${{ !cancelled() && needs.verify.result == 'success' }}
208
+ runs-on: ubuntu-24.04
209
+ outputs:
210
+ manual-seal: ${{ steps.manual-seal.outputs.digest }}
211
+ env:
212
+ MANUAL_VERSION: ${{ needs.version.outputs.semver-version }}
213
+ MANUAL_WHEEL_VERSION: ${{ needs.version.outputs.pep440-version }}
214
+ PLAN_COMMIT: ${{ needs.version.outputs.commit }}
215
+ PLAN_RUN: ${{ needs.version.outputs.run-id }}
216
+ PLAN_ATTEMPT: ${{ needs.version.outputs.run-attempt }}
217
+ permissions:
218
+ contents: read
219
+ steps:
220
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
221
+ with:
222
+ ref: ${{ github.event.pull_request.head.sha || github.sha }}
223
+ persist-credentials: false
224
+ - uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e
225
+ with:
226
+ version: '3.54.0'
227
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
228
+ with:
229
+ name: common-manual-ubuntu-24.04-${{ github.run_attempt }}-${{ env.MANUAL_VERSION || 'development' }}
230
+ path: artifacts/
231
+ - name: Match mounted checkout ownership
232
+ run: |
233
+ echo "LOCAL_UID=$(id -u)" >> "$GITHUB_ENV"
234
+ echo "LOCAL_GID=$(id -g)" >> "$GITHUB_ENV"
235
+ - run: task docs:test
236
+ - name: Verify the exact candidate manual that passed browser tests
237
+ if: env.MANUAL_VERSION != ''
238
+ id: manual-seal
239
+ run: |
240
+ set -euo pipefail
241
+ test "$(git rev-parse HEAD)" = "$PLAN_COMMIT"
242
+ test "$PLAN_RUN" = "$GITHUB_RUN_ID"
243
+ test "$PLAN_ATTEMPT" = "$GITHUB_RUN_ATTEMPT"
244
+ digest=$(python3 tools/manual_release.py verify "$MANUAL_VERSION" "$MANUAL_WHEEL_VERSION" \
245
+ "$PLAN_COMMIT" "$PLAN_RUN" "$PLAN_ATTEMPT" candidate)
246
+ [[ "$digest" =~ ^[0-9a-f]{64}$ ]]
247
+ echo "digest=$digest" >> "$GITHUB_OUTPUT"
248
+ - name: Publish browser cases
249
+ if: ${{ !cancelled() }}
250
+ uses: dorny/test-reporter@d1b5dff021aa968b288b02285a8bf47471c5928a
251
+ with:
252
+ name: Manual browser tests
253
+ path: artifacts/docs-tests.xml
254
+ reporter: python-xunit
255
+ use-actions-summary: 'true'
256
+ collapsed: never
257
+ fail-on-error: 'true'
258
+ fail-on-empty: 'true'
259
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
260
+ if: always()
261
+ with:
262
+ name: common-manual-browser-evidence-${{ github.run_attempt }}
263
+ path: |
264
+ artifacts/docs-tests.xml
265
+ artifacts/docs/screenshots/
266
+ retention-days: 14
267
+ if-no-files-found: error
268
+ verification-gate:
269
+ name: Repository verification gate
270
+ # Always runs, so a failed or cancelled job still reports this required check.
271
+ # Only the skips listed per event in ALLOWED_SKIPS pass; every other job must succeed.
272
+ # Adding a verification job to this workflow requires adding it to `needs` here.
273
+ if: always()
274
+ needs: [version, verify, documentation]
275
+ runs-on: ubuntu-24.04
276
+ timeout-minutes: 10
277
+ permissions: {}
278
+ env:
279
+ NEEDS_JSON: ${{ toJSON(needs) }}
280
+ ALLOWED_SKIPS: '{"push": ["version"], "merge_group": ["version"]}'
281
+ steps:
282
+ - name: Require complete successful verification evidence
283
+ run: |
284
+ python3 - <<'PYTHON'
285
+ import json
286
+ import os
287
+ import sys
288
+
289
+ needs = json.loads(os.environ["NEEDS_JSON"])
290
+ event = os.environ["GITHUB_EVENT_NAME"]
291
+ if event not in {"pull_request", "merge_group", "push", "workflow_dispatch", "schedule"}:
292
+ sys.exit("Unsupported verification event: " + event)
293
+ allowed = set(json.loads(os.environ["ALLOWED_SKIPS"]).get(event, []))
294
+ problems = []
295
+ for job, data in sorted(needs.items()):
296
+ result = data.get("result")
297
+ if result == "success" or (result == "skipped" and job in allowed):
298
+ continue
299
+ problems.append(job + ": " + str(result))
300
+ if not needs:
301
+ problems.append("no verification jobs")
302
+ if problems:
303
+ sys.exit("Incomplete verification: " + ", ".join(problems))
304
+ print("All verification jobs passed: " + ", ".join(sorted(needs)))
305
+ PYTHON
306
+ deploy-documentation:
307
+ needs: [verify, documentation, version, release, publish]
308
+ if: >-
309
+ !cancelled() && github.ref == 'refs/heads/main' &&
310
+ needs.verify.result == 'success' && needs.documentation.result == 'success' &&
311
+ ((github.event_name == 'push' && needs.release.result == 'success' &&
312
+ needs.publish.result == 'success' && needs.release.outputs.draft-created == 'true' &&
313
+ needs.release.outputs.version != '' &&
314
+ needs.release.outputs.git-tag == format('v{0}', needs.release.outputs.version) &&
315
+ needs.release.outputs.commit == github.sha) ||
316
+ (github.event_name == 'workflow_dispatch' && inputs.release_tag != '' &&
317
+ needs.release.result == 'skipped' && needs.publish.result == 'skipped' &&
318
+ needs.documentation.outputs.manual-seal != '' &&
319
+ needs.version.result == 'success' && needs.version.outputs.commit == github.sha &&
320
+ needs.version.outputs.run-id == github.run_id &&
321
+ needs.version.outputs.run-attempt == github.run_attempt))
322
+ runs-on: ubuntu-24.04
323
+ permissions:
324
+ contents: read
325
+ pages: write
326
+ id-token: write
327
+ concurrency:
328
+ group: common-pages
329
+ cancel-in-progress: false
330
+ environment:
331
+ name: github-pages
332
+ url: ${{ steps.deployment.outputs.page_url }}
333
+ env:
334
+ # A main push takes its identity only from the release; the replay from its plan.
335
+ MANUAL_VERSION: ${{ github.event_name == 'push' && needs.release.outputs.version || needs.version.outputs.semver-version }}
336
+ MANUAL_WHEEL_VERSION: ${{ github.event_name == 'push' && needs.release.outputs.version || needs.version.outputs.pep440-version }}
337
+ MANUAL_RELEASE_TAG: ${{ github.event_name == 'push' && needs.release.outputs.git-tag || inputs.release_tag }}
338
+ steps:
339
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
340
+ with:
341
+ ref: ${{ github.sha }}
342
+ fetch-depth: 0
343
+ fetch-tags: true
344
+ persist-credentials: false
345
+ - name: Download only the exact immutable published release and its wheel
346
+ env:
347
+ GH_TOKEN: ${{ github.token }}
348
+ run: |
349
+ set -euo pipefail
350
+ [[ "$MANUAL_VERSION" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]
351
+ test "$MANUAL_WHEEL_VERSION" = "$MANUAL_VERSION"
352
+ test "$MANUAL_RELEASE_TAG" = "v$MANUAL_VERSION"
353
+ test "$(git rev-parse HEAD)" = "$GITHUB_SHA"
354
+ test "$(git rev-parse --verify "refs/tags/${MANUAL_RELEASE_TAG}^{commit}")" = "$GITHUB_SHA"
355
+ mkdir -p artifacts/released-wheel
356
+ gh api "repos/$GITHUB_REPOSITORY/releases/tags/$MANUAL_RELEASE_TAG" > artifacts/released-wheel/release.json
357
+ python3 -c 'import json, sys
358
+ info = json.load(open("artifacts/released-wheel/release.json"))
359
+ if not (info["tag_name"] == sys.argv[1] and info["draft"] is False and
360
+ info["prerelease"] is False and info["immutable"] is True and info["published_at"]):
361
+ raise SystemExit("Expected the exact immutable published stable release")
362
+ ' "$MANUAL_RELEASE_TAG"
363
+ gh release download "$MANUAL_RELEASE_TAG" --repo "$GITHUB_REPOSITORY" --dir artifacts/released-wheel \
364
+ --pattern "livingproof_common-${MANUAL_VERSION}-py3-none-any.whl" --pattern SHA256SUMS
365
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
366
+ with:
367
+ name: library-reports-ubuntu-24.04-${{ github.run_attempt }}
368
+ path: artifacts/
369
+ - uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e
370
+ with:
371
+ version: '3.54.0'
372
+ - name: Match mounted checkout ownership
373
+ run: |
374
+ echo "LOCAL_UID=$(id -u)" >> "$GITHUB_ENV"
375
+ echo "LOCAL_GID=$(id -g)" >> "$GITHUB_ENV"
376
+ - run: task setup
377
+ - run: task docs
378
+ - run: task docs:test
379
+ - name: Bind the production tar to the tested released manual
380
+ id: pages-package
381
+ run: |
382
+ set -euo pipefail
383
+ python3 tools/manual_release.py seal "$MANUAL_VERSION" "$MANUAL_WHEEL_VERSION" \
384
+ "$GITHUB_SHA" "$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT" release
385
+ cd artifacts/docs/html
386
+ tar --dereference --hard-dereference -cf "$RUNNER_TEMP/artifact.tar" .
387
+ digest=$(sha256sum "$RUNNER_TEMP/artifact.tar")
388
+ echo "tar-sha256=${digest%% *}" >> "$GITHUB_OUTPUT"
389
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
390
+ id: pages-artifact
391
+ with:
392
+ name: github-pages-${{ github.run_attempt }}
393
+ path: ${{ runner.temp }}/artifact.tar
394
+ retention-days: 1
395
+ if-no-files-found: error
396
+ # Use the same-run Actions artifact client (like deploy-pages), not the REST index.
397
+ # An exact ID and name must both resolve to the sealed Pages tar before deploying.
398
+ - name: Require a valid Pages artifact ID
399
+ shell: bash
400
+ env:
401
+ UPLOADED_ID: ${{ steps.pages-artifact.outputs.artifact-id }}
402
+ run: |
403
+ [[ "$UPLOADED_ID" =~ ^[1-9][0-9]*$ ]]
404
+ - name: Read exact Pages artifact by ID
405
+ id: pages-id-first
406
+ continue-on-error: true
407
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
408
+ with:
409
+ artifact-ids: ${{ steps.pages-artifact.outputs.artifact-id }}
410
+ path: ${{ runner.temp }}/common-pages-id-first
411
+ - name: Allow the ID lookup to settle
412
+ if: steps.pages-id-first.outcome == 'failure'
413
+ run: sleep 4
414
+ - name: Retry read by ID once
415
+ id: pages-id-retry
416
+ if: steps.pages-id-first.outcome == 'failure'
417
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
418
+ with:
419
+ artifact-ids: ${{ steps.pages-artifact.outputs.artifact-id }}
420
+ path: ${{ runner.temp }}/common-pages-id-retry
421
+ - name: Read exact Pages artifact by name
422
+ id: pages-name-first
423
+ continue-on-error: true
424
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
425
+ with:
426
+ name: github-pages-${{ github.run_attempt }}
427
+ path: ${{ runner.temp }}/common-pages-name-first
428
+ - name: Allow the name lookup to settle
429
+ if: steps.pages-name-first.outcome == 'failure'
430
+ run: sleep 4
431
+ - name: Retry read by name once
432
+ id: pages-name-retry
433
+ if: steps.pages-name-first.outcome == 'failure'
434
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
435
+ with:
436
+ name: github-pages-${{ github.run_attempt }}
437
+ path: ${{ runner.temp }}/common-pages-name-retry
438
+ - name: Require matching ID and name readback of the exact tar
439
+ shell: bash
440
+ env:
441
+ EXPECTED_TAR: ${{ steps.pages-package.outputs.tar-sha256 }}
442
+ EXPECTED_NAME: github-pages-${{ github.run_attempt }}
443
+ ID_READBACK: ${{ steps.pages-id-first.outcome == 'success' && steps.pages-id-first.outputs.download-path || steps.pages-id-retry.outputs.download-path }}
444
+ NAME_READBACK: ${{ steps.pages-name-first.outcome == 'success' && steps.pages-name-first.outputs.download-path || steps.pages-name-retry.outputs.download-path }}
445
+ run: |
446
+ set -euo pipefail
447
+ [[ "$EXPECTED_TAR" =~ ^[0-9a-f]{64}$ ]]
448
+ test -n "$ID_READBACK"
449
+ test -n "$NAME_READBACK"
450
+ for path in "$ID_READBACK/$EXPECTED_NAME" "$NAME_READBACK"; do
451
+ test -f "$path/artifact.tar"
452
+ digest=$(sha256sum "$path/artifact.tar")
453
+ test "${digest%% *}" = "$EXPECTED_TAR"
454
+ done
455
+ - name: Require current main before deploying this run's artifact
456
+ env:
457
+ GH_TOKEN: ${{ github.token }}
458
+ CANDIDATE: ${{ github.sha }}
459
+ run: |
460
+ set -euo pipefail
461
+ current=$(gh api repos/Living-Proof-Labs/livingproof-common/git/ref/heads/main --jq .object.sha)
462
+ test "$current" = "$CANDIDATE"
463
+ - name: Deploy verified manual
464
+ id: deployment
465
+ uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e
466
+ with:
467
+ artifact_name: github-pages-${{ github.run_attempt }}
@@ -0,0 +1,8 @@
1
+ .venv/
2
+ __pycache__/
3
+ .pytest_cache/
4
+ .ruff_cache/
5
+ .coverage
6
+ artifacts/
7
+ dist/
8
+ src/livingproof_common/_build_provenance.json
@@ -0,0 +1,25 @@
1
+ # Living Proof Labs common library
2
+
3
+ Read and apply [collaboration-guidelines v7.8.2](https://github.com/Living-Proof-Labs/collaboration-guidelines/blob/v7.8.2/AGENTS.md)
4
+ and relevant procedures at that exact tag. Resolved adoption commit:
5
+ `1470bd46deffd62d6badf568996225e56872258a`.
6
+
7
+ Local additions: this is an Apache-2.0 library, without a CLI or plugin manager.
8
+ Keep consumer identity explicit. Do not inspect caller working directories or
9
+ expose unapproved branch names. Use Rivet for GitHub writes. The engineering
10
+ lead (Rivet) may merge once required checks pass on the exact head revision
11
+ and verification evidence is recorded. Protections come from required checks,
12
+ rulesets, and automated tests, not a human approval gate. No credential or
13
+ global settings changes. Run host `task setup` then `task verify`; inside the
14
+ development container use `task -t Taskfile.runtime.yml` instead. Retain raw
15
+ test reports for 30 days and publish individual results even for failing runs.
16
+
17
+ Documentation previews use the shared 14-day retention. Raw library test reports
18
+ retain the existing 30-day window for consumer release diagnosis. Pages deployment is authorized only from verified main; write permissions stay
19
+ on the deployment job. The parent owns repository settings and live acceptance.
20
+
21
+ Current rendered-manual, organization-root and source-directory links are bounded
22
+ navigation exceptions to cross-repository version pinning. They do not float
23
+ guidance, dependencies, templates, workflows or executable download examples.
24
+ The organization root owns vision and the directory; this repository owns only
25
+ its library usage, APIs, verification and contributor operations.
@@ -0,0 +1,38 @@
1
+ # Installed package only; no source checkout, Task or runtime network requirement.
2
+ ARG PYTHON_IMAGE=python:3.12.12-slim-bookworm
3
+ FROM ${PYTHON_IMAGE} AS python-base
4
+
5
+ FROM ghcr.io/astral-sh/uv:0.12.23 AS uv-tools
6
+
7
+ FROM python-base AS development
8
+ COPY --from=uv-tools /uv /uvx /usr/local/bin/
9
+ ARG TASK_VERSION=3.54.0
10
+ RUN apt-get update && apt-get install -y --no-install-recommends bash ca-certificates curl git dpkg-dev && rm -rf /var/lib/apt/lists/*
11
+ RUN --mount=type=secret,id=ca,required=false set -eu; \
12
+ if [ -f /run/secrets/ca ]; then export CURL_CA_BUNDLE=/run/secrets/ca; fi; \
13
+ arch="$(dpkg --print-architecture)"; \
14
+ mkdir /tmp/task; cd /tmp/task; \
15
+ curl -fsSLO "https://github.com/go-task/task/releases/download/v${TASK_VERSION}/task_linux_${arch}.tar.gz"; \
16
+ curl -fsSLO "https://github.com/go-task/task/releases/download/v${TASK_VERSION}/task_checksums.txt"; \
17
+ sha256sum --ignore-missing -c task_checksums.txt; \
18
+ tar -xzf "task_linux_${arch}.tar.gz" task; \
19
+ install task /usr/local/bin/task; rm -rf /tmp/task
20
+ RUN useradd --create-home --uid 1000 --shell /bin/bash vscode
21
+ ENV UV_PROJECT_ENVIRONMENT=/opt/common-venv UV_CACHE_DIR=/opt/common-cache
22
+ WORKDIR /workspace/common
23
+ RUN mkdir -p /opt/common-venv /opt/common-cache && chmod 1777 /opt/common-venv /opt/common-cache
24
+ USER vscode
25
+ CMD ["sleep", "infinity"]
26
+
27
+
28
+ # Browser system libraries are development-only; the common library remains pure Python.
29
+ FROM development AS documentation-test
30
+ USER root
31
+ COPY pyproject.toml uv.lock /tmp/common-tools/
32
+ RUN cd /tmp/common-tools && \
33
+ UV_CACHE_DIR=/tmp/common-tools/cache UV_PROJECT_ENVIRONMENT=/tmp/common-tools/venv uv sync --locked --no-install-project --group docs-test --no-python-downloads && \
34
+ /tmp/common-tools/venv/bin/playwright install-deps chromium && \
35
+ rm -rf /tmp/common-tools
36
+ ENV PLAYWRIGHT_BROWSERS_PATH=/opt/common-browsers
37
+ RUN mkdir -p /opt/common-browsers && chmod 1777 /opt/common-browsers
38
+ USER vscode