Skip to content

Commit fc8f9cc

Browse files
committed
Refresh packaging and release tooling
Switch checks and release workflows to Pyrefly and generated recovery-kit bundles, remove stale prompt/Playwright packaging hooks, and verify sdists alongside wheels. Untrack generated recovery kit bundle artifacts so CI can rebuild them for packages and releases.
1 parent 694340b commit fc8f9cc

19 files changed

Lines changed: 304 additions & 298 deletions

.github/workflows/ci.yml

Lines changed: 52 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ on:
1616
- "pyproject.toml"
1717
- "uv.lock"
1818
- "ethernity.spec"
19-
- "pyrightconfig.json"
2019
- "README_PYPI.md"
2120
- "LICENSE"
2221
pull_request:
@@ -34,7 +33,6 @@ on:
3433
- "pyproject.toml"
3534
- "uv.lock"
3635
- "ethernity.spec"
37-
- "pyrightconfig.json"
3836
- "README_PYPI.md"
3937
- "LICENSE"
4038
workflow_dispatch:
@@ -71,38 +69,16 @@ jobs:
7169
- name: Ruff format
7270
run: uv run ruff format --check src tests tooling
7371

74-
mypy:
72+
typecheck:
7573
runs-on: ubuntu-latest
7674
timeout-minutes: 20
7775
steps:
7876
- name: Checkout
7977
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
8078
- name: Setup Python
8179
uses: ./.github/actions/setup-python
82-
- name: Mypy
83-
run: uv run mypy src tooling
84-
85-
pyright:
86-
runs-on: ubuntu-latest
87-
timeout-minutes: 20
88-
steps:
89-
- name: Checkout
90-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
91-
- name: Setup Python
92-
uses: ./.github/actions/setup-python
93-
- name: Pyright
94-
run: uv run pyright
95-
96-
schema:
97-
runs-on: ubuntu-latest
98-
timeout-minutes: 15
99-
steps:
100-
- name: Checkout
101-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
102-
- name: Setup Python
103-
uses: ./.github/actions/setup-python
104-
- name: Validate CLI API schema
105-
run: uv run check-jsonschema --check-metaschema docs/cli_api.schema.json
80+
- name: Pyrefly
81+
run: uv run pyrefly check --output-format=github
10682

10783
typos:
10884
runs-on: ubuntu-latest
@@ -236,27 +212,51 @@ jobs:
236212
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
237213
- name: Setup Python
238214
uses: ./.github/actions/setup-python
215+
- name: Setup Node.js
216+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
217+
with:
218+
node-version: "20"
219+
cache: "npm"
220+
cache-dependency-path: kit/package-lock.json
221+
- name: Install kit dependencies
222+
working-directory: kit
223+
run: npm ci
224+
- name: Generate kit bundles for package artifacts
225+
working-directory: kit
226+
run: node build_kit.mjs
227+
- name: Verify generated kit bundles
228+
run: |
229+
for BUNDLE in \
230+
src/ethernity/resources/kit/recovery_kit.bundle.html \
231+
src/ethernity/resources/kit/recovery_kit.scanner.bundle.html
232+
do
233+
test -s "$BUNDLE"
234+
SIZE=$(stat -c%s "$BUNDLE" 2>/dev/null || stat -f%z "$BUNDLE")
235+
echo "Generated bundle size ($BUNDLE): $SIZE bytes"
236+
if [ "$SIZE" -lt 1000 ]; then
237+
echo "ERROR: Generated bundle seems too small, may be corrupted: $BUNDLE"
238+
exit 1
239+
fi
240+
done
239241
- name: Build wheel and sdist
240242
run: uv build --wheel --sdist --out-dir dist
241-
- name: Verify wheel contents
242-
run: python3 scripts/check_wheel_contents.py dist/*.whl
243+
- name: Verify package contents
244+
run: python3 scripts/check_wheel_contents.py dist/*.whl dist/*.tar.gz
243245
- name: Install built wheel
244246
run: python3 -m pip install --force-reinstall dist/*.whl
245247
- name: Smoke test installed package
246-
env:
247-
ETHERNITY_SKIP_PLAYWRIGHT_INSTALL: "1"
248248
run: |
249-
python3 -c "import ethernity, ethernity.cli.bootstrap.app; print(ethernity.__file__)"
249+
python3 -c "import ethernity, ethernity.main; print(ethernity.__file__)"
250250
python3 -m ethernity --help > /dev/null
251251
SMOKE_OUT="${RUNNER_TEMP:-/tmp}/ethernity-wheel-smoke"
252252
rm -rf "$SMOKE_OUT"
253253
mkdir -p "$SMOKE_OUT"
254-
python3 -m ethernity recover \
254+
python3 -m ethernity run restore \
255255
--scan tests/fixtures/v1_2/extension_golden/raw/gzip_replacement_chain/chain/qr_document.pdf \
256256
--scan tests/fixtures/v1_2/extension_golden/raw/gzip_replacement_chain/chain/extensions/01/qr_document-01-*.pdf \
257257
--passphrase stable-v1_2-extension-passphrase \
258258
--output "$SMOKE_OUT/recovered" \
259-
--quiet
259+
--yes
260260
test -d "$SMOKE_OUT/recovered"
261261
262262
kit-verify:
@@ -273,50 +273,23 @@ jobs:
273273
cache: "npm"
274274
cache-dependency-path: kit/package-lock.json
275275

276-
- name: Verify committed bundles exist
276+
- name: Verify generated bundles are not committed
277277
run: |
278-
for BUNDLE in \
278+
TRACKED="$(git ls-files -- \
279279
src/ethernity/resources/kit/recovery_kit.bundle.html \
280-
src/ethernity/resources/kit/recovery_kit.scanner.bundle.html
281-
do
282-
if [ ! -f "$BUNDLE" ]; then
283-
echo "ERROR: No committed bundle found at $BUNDLE"
284-
echo "Run 'cd kit && node build_kit.mjs' and commit the bundles."
285-
exit 1
286-
fi
287-
SIZE=$(stat -c%s "$BUNDLE" 2>/dev/null || stat -f%z "$BUNDLE")
288-
echo "Committed bundle size ($BUNDLE): $SIZE bytes"
289-
if [ "$SIZE" -lt 1000 ]; then
290-
echo "ERROR: Bundle seems too small, may be corrupted: $BUNDLE"
291-
exit 1
292-
fi
293-
done
280+
src/ethernity/resources/kit/recovery_kit.scanner.bundle.html)"
281+
if [ -n "$TRACKED" ]; then
282+
echo "ERROR: recovery kit bundles are generated release artifacts and must not be committed."
283+
echo "$TRACKED"
284+
exit 1
285+
fi
294286
295287
- name: Install kit dependencies
296288
working-directory: kit
297289
run: npm ci
298290

299-
- name: Run kit tests
291+
- name: Generate kit bundles
300292
working-directory: kit
301-
run: npm test
302-
303-
- name: Setup Python
304-
uses: ./.github/actions/setup-python
305-
306-
- name: Run kit interoperability tests
307-
env:
308-
ETHERNITY_SKIP_PLAYWRIGHT_INSTALL: "1"
309-
run: uv run pytest tests/unit/test_kit_vectors.py tests/unit/test_kit_interop.py -v
310-
311-
- name: Install libdeflate tools
312-
run: |
313-
sudo apt-get update
314-
sudo apt-get install -y libdeflate-tools
315-
316-
- name: Verify kit builds successfully
317-
working-directory: kit
318-
env:
319-
ETHERNITY_KIT_GZIP_COMPRESSOR: libdeflate
320293
run: node build_kit.mjs
321294

322295
- name: Verify build output
@@ -326,11 +299,15 @@ jobs:
326299
ls -la src/ethernity/resources/kit/recovery_kit.scanner.bundle.html
327300
ls -la kit/dist/
328301
329-
- name: Verify bundles are up to date
330-
run: |
331-
git diff --exit-code -- \
332-
src/ethernity/resources/kit/recovery_kit.bundle.html \
333-
src/ethernity/resources/kit/recovery_kit.scanner.bundle.html
302+
- name: Run kit tests
303+
working-directory: kit
304+
run: npm test
305+
306+
- name: Setup Python
307+
uses: ./.github/actions/setup-python
308+
309+
- name: Run kit interoperability tests
310+
run: uv run pytest tests/unit/test_kit_vectors.py tests/unit/test_kit_interop.py -v
334311

335312
pip-audit:
336313
runs-on: ubuntu-latest

.github/workflows/pyinstaller.yml

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,52 @@ jobs:
233233
time.sleep(poll_seconds)
234234
PY
235235
236-
build:
236+
kit-bundles:
237237
needs: precheck
238+
runs-on: ubuntu-latest
239+
timeout-minutes: 20
240+
permissions:
241+
contents: read
242+
steps:
243+
- name: Checkout
244+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
245+
with:
246+
ref: ${{ needs.precheck.outputs.commit_sha }}
247+
248+
- name: Set up Node.js
249+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
250+
with:
251+
node-version: "20"
252+
cache: "npm"
253+
cache-dependency-path: kit/package-lock.json
254+
255+
- name: Install kit dependencies
256+
working-directory: kit
257+
run: npm ci
258+
259+
- name: Generate kit bundles
260+
working-directory: kit
261+
run: node build_kit.mjs
262+
263+
- name: Prepare kit bundle artifact
264+
run: |
265+
set -euo pipefail
266+
mkdir -p release-kit-bundles
267+
cp \
268+
src/ethernity/resources/kit/recovery_kit.bundle.html \
269+
src/ethernity/resources/kit/recovery_kit.scanner.bundle.html \
270+
release-kit-bundles/
271+
ls -la release-kit-bundles/
272+
273+
- name: Upload kit bundle artifact
274+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v6
275+
with:
276+
name: release-kit-bundles
277+
if-no-files-found: error
278+
path: release-kit-bundles/*.html
279+
280+
build:
281+
needs: [precheck, kit-bundles]
238282
runs-on: ${{ matrix.runner }}
239283
timeout-minutes: 60
240284
strategy:
@@ -283,6 +327,29 @@ jobs:
283327
- name: Install build dependencies
284328
run: uv sync --extra build --frozen
285329

330+
- name: Download generated kit bundles
331+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
332+
with:
333+
name: release-kit-bundles
334+
path: src/ethernity/resources/kit
335+
336+
- name: Verify generated kit bundles
337+
shell: bash
338+
run: |
339+
set -euo pipefail
340+
for BUNDLE in \
341+
src/ethernity/resources/kit/recovery_kit.bundle.html \
342+
src/ethernity/resources/kit/recovery_kit.scanner.bundle.html
343+
do
344+
test -s "$BUNDLE"
345+
SIZE=$(wc -c < "$BUNDLE")
346+
echo "Generated bundle size ($BUNDLE): $SIZE bytes"
347+
if [ "$SIZE" -lt 1000 ]; then
348+
echo "ERROR: Generated bundle seems too small, may be corrupted: $BUNDLE"
349+
exit 1
350+
fi
351+
done
352+
286353
- name: Build with PyInstaller (onedir)
287354
run: uv run pyinstaller --clean --noconfirm ethernity.spec
288355

@@ -300,12 +367,12 @@ jobs:
300367
SMOKE_OUT="${RUNNER_TEMP:-/tmp}/ethernity-pyinstaller-smoke"
301368
rm -rf "$SMOKE_OUT"
302369
mkdir -p "$SMOKE_OUT"
303-
"$BIN" recover \
370+
"$BIN" run restore \
304371
--scan tests/fixtures/v1_2/extension_golden/raw/gzip_replacement_chain/chain/qr_document.pdf \
305372
--scan tests/fixtures/v1_2/extension_golden/raw/gzip_replacement_chain/chain/extensions/01/qr_document-01-*.pdf \
306373
--passphrase stable-v1_2-extension-passphrase \
307374
--output "$SMOKE_OUT/recovered" \
308-
--quiet
375+
--yes
309376
test -d "$SMOKE_OUT/recovered"
310377
311378
- name: Package release archive

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ htmlcov/
3535
# Node tooling
3636
node_modules/
3737

38-
# Kit build outputs (dev only, canonical bundle is in src/ethernity/resources/kit/)
38+
# Kit build outputs
3939
kit/dist/
40+
src/ethernity/resources/kit/recovery_kit*.bundle.html
41+
test-debug/
4042
backup-*/
4143
generated_backups/
4244
generated_backups_input.txt

.pre-commit-config.yaml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ repos:
88
- id: check-toml
99
- id: check-added-large-files
1010
args: ["--maxkb=5000"]
11-
exclude: '^src/ethernity/resources/kit/recovery_kit(\.scanner)?\.bundle\.html$'
1211
- id: check-merge-conflict
1312

1413
- repo: https://github.com/astral-sh/ruff-pre-commit
@@ -20,14 +19,9 @@ repos:
2019

2120
- repo: local
2221
hooks:
23-
- id: pyright
24-
name: pyright
25-
entry: uv run pyright
26-
language: system
27-
pass_filenames: false
28-
- id: check-jsonschema-cli-api
29-
name: check-jsonschema cli api
30-
entry: uv run check-jsonschema --check-metaschema docs/cli_api.schema.json
22+
- id: pyrefly
23+
name: pyrefly
24+
entry: uv run pyrefly check
3125
language: system
3226
pass_filenames: false
3327
- id: typos

0 commit comments

Comments
 (0)