ebook-rs 0.18.0__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.
- ebook_rs-0.18.0/.github/workflows/ci.yml +61 -0
- ebook_rs-0.18.0/.github/workflows/deploy-docs.yml +61 -0
- ebook_rs-0.18.0/.github/workflows/fuzz-stress.yml +77 -0
- ebook_rs-0.18.0/.github/workflows/npm.yml +76 -0
- ebook_rs-0.18.0/.github/workflows/pypi.yml +85 -0
- ebook_rs-0.18.0/.gitignore +15 -0
- ebook_rs-0.18.0/API.md +926 -0
- ebook_rs-0.18.0/CHANGELOG.md +771 -0
- ebook_rs-0.18.0/Cargo.lock +2039 -0
- ebook_rs-0.18.0/Cargo.toml +97 -0
- ebook_rs-0.18.0/LICENSE +21 -0
- ebook_rs-0.18.0/PKG-INFO +410 -0
- ebook_rs-0.18.0/README.md +378 -0
- ebook_rs-0.18.0/SECURITY.md +91 -0
- ebook_rs-0.18.0/WIKI.md +26 -0
- ebook_rs-0.18.0/audit.toml +10 -0
- ebook_rs-0.18.0/docs/API.md +764 -0
- ebook_rs-0.18.0/docs/MCP_SERVER.md +124 -0
- ebook_rs-0.18.0/docs/index.html +727 -0
- ebook_rs-0.18.0/examples/corpus_stress.rs +236 -0
- ebook_rs-0.18.0/pyproject.toml +42 -0
- ebook_rs-0.18.0/scripts/fetch_gutenberg.ps1 +86 -0
- ebook_rs-0.18.0/scripts/fetch_gutenberg.sh +113 -0
- ebook_rs-0.18.0/src/analytics.rs +68 -0
- ebook_rs-0.18.0/src/annotations.rs +152 -0
- ebook_rs-0.18.0/src/archive.rs +666 -0
- ebook_rs-0.18.0/src/book.rs +1661 -0
- ebook_rs-0.18.0/src/cbz.rs +265 -0
- ebook_rs-0.18.0/src/cfi.rs +434 -0
- ebook_rs-0.18.0/src/citation.rs +206 -0
- ebook_rs-0.18.0/src/deobfuscate.rs +192 -0
- ebook_rs-0.18.0/src/docx.rs +509 -0
- ebook_rs-0.18.0/src/dom.rs +1331 -0
- ebook_rs-0.18.0/src/error.rs +64 -0
- ebook_rs-0.18.0/src/fb2.rs +414 -0
- ebook_rs-0.18.0/src/ffi.rs +260 -0
- ebook_rs-0.18.0/src/fingerprint.rs +190 -0
- ebook_rs-0.18.0/src/footnote.rs +228 -0
- ebook_rs-0.18.0/src/kfx/container.rs +188 -0
- ebook_rs-0.18.0/src/kfx/mod.rs +8 -0
- ebook_rs-0.18.0/src/kfx/reader.rs +474 -0
- ebook_rs-0.18.0/src/kfx/symbols.rs +14 -0
- ebook_rs-0.18.0/src/kfx/writer.rs +64 -0
- ebook_rs-0.18.0/src/layout.rs +329 -0
- ebook_rs-0.18.0/src/lcp.rs +387 -0
- ebook_rs-0.18.0/src/lib.rs +118 -0
- ebook_rs-0.18.0/src/lit.rs +443 -0
- ebook_rs-0.18.0/src/locations.rs +166 -0
- ebook_rs-0.18.0/src/main.rs +190 -0
- ebook_rs-0.18.0/src/mcp.rs +1177 -0
- ebook_rs-0.18.0/src/media_overlay.rs +517 -0
- ebook_rs-0.18.0/src/metadata.rs +116 -0
- ebook_rs-0.18.0/src/mobi.rs +713 -0
- ebook_rs-0.18.0/src/nav.rs +409 -0
- ebook_rs-0.18.0/src/odt.rs +324 -0
- ebook_rs-0.18.0/src/opds.rs +275 -0
- ebook_rs-0.18.0/src/opf.rs +310 -0
- ebook_rs-0.18.0/src/optimizer.rs +743 -0
- ebook_rs-0.18.0/src/paginator.rs +225 -0
- ebook_rs-0.18.0/src/pdf.rs +295 -0
- ebook_rs-0.18.0/src/python.rs +223 -0
- ebook_rs-0.18.0/src/rag.rs +546 -0
- ebook_rs-0.18.0/src/rtf.rs +655 -0
- ebook_rs-0.18.0/src/sample_builder.rs +171 -0
- ebook_rs-0.18.0/src/search.rs +528 -0
- ebook_rs-0.18.0/src/section.rs +1452 -0
- ebook_rs-0.18.0/src/server.rs +1003 -0
- ebook_rs-0.18.0/src/stream_zip.rs +182 -0
- ebook_rs-0.18.0/src/treesitter.rs +275 -0
- ebook_rs-0.18.0/src/txt.rs +681 -0
- ebook_rs-0.18.0/src/uniffi_api.rs +171 -0
- ebook_rs-0.18.0/src/validator.rs +390 -0
- ebook_rs-0.18.0/src/wasm.rs +180 -0
- ebook_rs-0.18.0/src/web_ui.rs +1737 -0
- ebook_rs-0.18.0/src/webpub.rs +126 -0
- ebook_rs-0.18.0/tests/test_blackbox_advanced_features_v16.rs +242 -0
- ebook_rs-0.18.0/tests/test_blackbox_annotations_and_state.rs +60 -0
- ebook_rs-0.18.0/tests/test_blackbox_cbr_error_handling.rs +18 -0
- ebook_rs-0.18.0/tests/test_blackbox_cfi_and_locations.rs +47 -0
- ebook_rs-0.18.0/tests/test_blackbox_docx_and_rtf.rs +237 -0
- ebook_rs-0.18.0/tests/test_blackbox_epub3_advanced.rs +27 -0
- ebook_rs-0.18.0/tests/test_blackbox_epub3_exporter.rs +28 -0
- ebook_rs-0.18.0/tests/test_blackbox_epub_parsing.rs +88 -0
- ebook_rs-0.18.0/tests/test_blackbox_fuzzy_xml_repair.rs +25 -0
- ebook_rs-0.18.0/tests/test_blackbox_fxl_and_viewports.rs +40 -0
- ebook_rs-0.18.0/tests/test_blackbox_kfx_parser.rs +37 -0
- ebook_rs-0.18.0/tests/test_blackbox_legacy_encodings.rs +14 -0
- ebook_rs-0.18.0/tests/test_blackbox_mmap_reader.rs +22 -0
- ebook_rs-0.18.0/tests/test_blackbox_multi_format.rs +153 -0
- ebook_rs-0.18.0/tests/test_blackbox_opds_catalog.rs +49 -0
- ebook_rs-0.18.0/tests/test_blackbox_rag_and_ffi.rs +118 -0
- ebook_rs-0.18.0/tests/test_blackbox_readium_and_lcp.rs +114 -0
- ebook_rs-0.18.0/tests/test_blackbox_reflow_paginator.rs +26 -0
- ebook_rs-0.18.0/tests/test_blackbox_search_and_analytics.rs +74 -0
- ebook_rs-0.18.0/tests/test_blackbox_treesitter_and_sanitization.rs +59 -0
- ebook_rs-0.18.0/tests/test_blackbox_tts_synchronizer.rs +47 -0
- ebook_rs-0.18.0/tests/test_kfx_clean_room.rs +75 -0
- ebook_rs-0.18.0/tests/test_regression_fixes.rs +518 -0
- ebook_rs-0.18.0/tests/test_security_regressions.rs +426 -0
- ebook_rs-0.18.0/tests/test_wasm_integration.rs +34 -0
- ebook_rs-0.18.0/website/astro.config.mjs +95 -0
- ebook_rs-0.18.0/website/package-lock.json +6927 -0
- ebook_rs-0.18.0/website/package.json +16 -0
- ebook_rs-0.18.0/website/src/assets/logo.svg +15 -0
- ebook_rs-0.18.0/website/src/content/docs/api/reference.md +59 -0
- ebook_rs-0.18.0/website/src/content/docs/benchmarks/conversion.md +21 -0
- ebook_rs-0.18.0/website/src/content/docs/benchmarks/parity.md +29 -0
- ebook_rs-0.18.0/website/src/content/docs/core/cfi.md +18 -0
- ebook_rs-0.18.0/website/src/content/docs/core/dom.md +8 -0
- ebook_rs-0.18.0/website/src/content/docs/core/lcp.md +7 -0
- ebook_rs-0.18.0/website/src/content/docs/core/rag.md +19 -0
- ebook_rs-0.18.0/website/src/content/docs/core/search.md +18 -0
- ebook_rs-0.18.0/website/src/content/docs/core/tts-smil.md +7 -0
- ebook_rs-0.18.0/website/src/content/docs/exporters/epub3.md +21 -0
- ebook_rs-0.18.0/website/src/content/docs/exporters/kfx.md +14 -0
- ebook_rs-0.18.0/website/src/content/docs/exporters/optimizer.md +9 -0
- ebook_rs-0.18.0/website/src/content/docs/exporters/zstd.md +14 -0
- ebook_rs-0.18.0/website/src/content/docs/formats/comics.md +9 -0
- ebook_rs-0.18.0/website/src/content/docs/formats/docx-rtf.md +14 -0
- ebook_rs-0.18.0/website/src/content/docs/formats/epub.md +13 -0
- ebook_rs-0.18.0/website/src/content/docs/formats/fb2.md +11 -0
- ebook_rs-0.18.0/website/src/content/docs/formats/kfx.md +11 -0
- ebook_rs-0.18.0/website/src/content/docs/formats/lit.md +11 -0
- ebook_rs-0.18.0/website/src/content/docs/formats/mobi-azw3.md +11 -0
- ebook_rs-0.18.0/website/src/content/docs/formats/overview.md +21 -0
- ebook_rs-0.18.0/website/src/content/docs/formats/pdf.md +11 -0
- ebook_rs-0.18.0/website/src/content/docs/getting-started/cli.md +73 -0
- ebook_rs-0.18.0/website/src/content/docs/getting-started/installation.md +66 -0
- ebook_rs-0.18.0/website/src/content/docs/getting-started/quickstart.md +107 -0
- ebook_rs-0.18.0/website/src/content/docs/index.mdx +71 -0
- ebook_rs-0.18.0/website/src/content/docs/mcp/clients.md +45 -0
- ebook_rs-0.18.0/website/src/content/docs/mcp/overview.md +19 -0
- ebook_rs-0.18.0/website/src/content/docs/sdk/python.md +32 -0
- ebook_rs-0.18.0/website/src/content/docs/sdk/uniffi.md +9 -0
- ebook_rs-0.18.0/website/src/content/docs/sdk/wasm.md +29 -0
- ebook_rs-0.18.0/website/src/content.config.ts +7 -0
- ebook_rs-0.18.0/website/src/styles/custom.css +79 -0
- ebook_rs-0.18.0/wiki/API-Reference.md +110 -0
- ebook_rs-0.18.0/wiki/CFI-and-Locations.md +54 -0
- ebook_rs-0.18.0/wiki/Getting-Started.md +55 -0
- ebook_rs-0.18.0/wiki/Home.md +35 -0
- ebook_rs-0.18.0/wiki/Multi-Format-Architecture.md +35 -0
- ebook_rs-0.18.0/wiki/WASM-and-Server-Integration.md +65 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: Rust CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main, master ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main, master ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Test & Lint
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Install Rust toolchain
|
|
17
|
+
uses: dtolnay/rust-toolchain@stable
|
|
18
|
+
with:
|
|
19
|
+
components: clippy, rustfmt
|
|
20
|
+
|
|
21
|
+
- name: Check Formatting
|
|
22
|
+
run: cargo fmt --all -- --check
|
|
23
|
+
|
|
24
|
+
- name: Clippy
|
|
25
|
+
run: cargo clippy --all-targets --all-features -- -D warnings
|
|
26
|
+
|
|
27
|
+
# The binary and the library share an output filename on MSVC (cargo normalizes
|
|
28
|
+
# `ebook-rs` -> `ebook_rs`, colliding with the `ebook_rs` lib PDB). Building lib, bin,
|
|
29
|
+
# tests and examples in one `cargo test --all-targets` invocation could then fail
|
|
30
|
+
# intermittently with:
|
|
31
|
+
# crate `write_fonts` required to be available in rlib format, but was not found in this form
|
|
32
|
+
# Building the binary separately keeps test compilation deterministic.
|
|
33
|
+
- name: Run Tests
|
|
34
|
+
run: cargo test --lib --tests --all-features --no-fail-fast
|
|
35
|
+
|
|
36
|
+
- name: Build Binary
|
|
37
|
+
run: cargo build --all-features --bins
|
|
38
|
+
|
|
39
|
+
- name: Build Examples
|
|
40
|
+
run: cargo build --all-features --examples
|
|
41
|
+
|
|
42
|
+
- name: Dependency Vulnerability Audit
|
|
43
|
+
run: |
|
|
44
|
+
cargo install cargo-audit --locked
|
|
45
|
+
cargo audit
|
|
46
|
+
|
|
47
|
+
- name: Random 25 Project Gutenberg Books Stress Test
|
|
48
|
+
run: |
|
|
49
|
+
chmod +x scripts/fetch_gutenberg.sh
|
|
50
|
+
./scripts/fetch_gutenberg.sh 25 corpus/ci_gutenberg --random
|
|
51
|
+
cargo run --release --all-features --example corpus_stress -- corpus/ci_gutenberg
|
|
52
|
+
|
|
53
|
+
- name: Install wasm-pack & Target
|
|
54
|
+
run: |
|
|
55
|
+
rustup target add wasm32-unknown-unknown
|
|
56
|
+
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh || cargo install wasm-pack || true
|
|
57
|
+
|
|
58
|
+
- name: Build & Check WASM
|
|
59
|
+
run: |
|
|
60
|
+
wasm-pack test --node -- --no-default-features --features wasm || cargo check --target wasm32-unknown-unknown --no-default-features --features wasm
|
|
61
|
+
wasm-pack build --target web --out-dir pkg -- --no-default-features --features wasm
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: Deploy Documentation to GitHub Pages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths:
|
|
7
|
+
- 'website/**'
|
|
8
|
+
- '.github/workflows/deploy-docs.yml'
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
pages: write
|
|
14
|
+
id-token: write
|
|
15
|
+
|
|
16
|
+
concurrency:
|
|
17
|
+
group: 'pages'
|
|
18
|
+
cancel-in-progress: false
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
build:
|
|
22
|
+
name: Build Documentation
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- name: Checkout repository
|
|
26
|
+
uses: actions/checkout@v4
|
|
27
|
+
|
|
28
|
+
- name: Setup Node.js
|
|
29
|
+
uses: actions/setup-node@v4
|
|
30
|
+
with:
|
|
31
|
+
# Astro 7 requires Node >= 22.23.4; the runner's cached 22.23.3 made
|
|
32
|
+
# `npm run build` abort with "Node.js v22.23.3 is not supported".
|
|
33
|
+
node-version: '24'
|
|
34
|
+
check-latest: true
|
|
35
|
+
cache: 'npm'
|
|
36
|
+
cache-dependency-path: 'website/package.json'
|
|
37
|
+
|
|
38
|
+
- name: Install dependencies
|
|
39
|
+
working-directory: ./website
|
|
40
|
+
run: npm ci || npm install
|
|
41
|
+
|
|
42
|
+
- name: Build Astro site
|
|
43
|
+
working-directory: ./website
|
|
44
|
+
run: npm run build
|
|
45
|
+
|
|
46
|
+
- name: Upload Pages Artifact
|
|
47
|
+
uses: actions/upload-pages-artifact@v3
|
|
48
|
+
with:
|
|
49
|
+
path: ./website/dist
|
|
50
|
+
|
|
51
|
+
deploy:
|
|
52
|
+
name: Deploy to GitHub Pages
|
|
53
|
+
needs: build
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
environment:
|
|
56
|
+
name: github-pages
|
|
57
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
58
|
+
steps:
|
|
59
|
+
- name: Deploy to GitHub Pages
|
|
60
|
+
id: deployment
|
|
61
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
name: Continuous Real-World Corpus Stress & Fuzzing
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: '0 4 * * 0' # Every Sunday at 04:00 UTC
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
corpus-stress-test:
|
|
10
|
+
name: Real-World Corpus & Corruption Stress Test
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout Repository
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Install Rust Toolchain
|
|
17
|
+
uses: dtolnay/rust-toolchain@stable
|
|
18
|
+
|
|
19
|
+
- name: Cache Project Gutenberg Corpus
|
|
20
|
+
id: cache-gutenberg
|
|
21
|
+
uses: actions/cache@v4
|
|
22
|
+
with:
|
|
23
|
+
path: corpus/gutenberg
|
|
24
|
+
key: gutenberg-corpus-v1
|
|
25
|
+
|
|
26
|
+
- name: Fetch Project Gutenberg Books
|
|
27
|
+
run: |
|
|
28
|
+
chmod +x scripts/fetch_gutenberg.sh
|
|
29
|
+
./scripts/fetch_gutenberg.sh 25 corpus/gutenberg --random
|
|
30
|
+
|
|
31
|
+
- name: Run Sample Suite Stress Test
|
|
32
|
+
run: |
|
|
33
|
+
echo "## 🧪 Local Golden Sample Stress Test" >> $GITHUB_STEP_SUMMARY
|
|
34
|
+
cargo run --release --all-features --example corpus_stress -- samples > sample_report.md
|
|
35
|
+
cat sample_report.md >> $GITHUB_STEP_SUMMARY
|
|
36
|
+
|
|
37
|
+
- name: Run Project Gutenberg Mass Stress Test
|
|
38
|
+
run: |
|
|
39
|
+
echo -e "\n## 📚 Project Gutenberg Mass Stress Test (25 Random Real-World Books)" >> $GITHUB_STEP_SUMMARY
|
|
40
|
+
cargo run --release --all-features --example corpus_stress -- corpus/gutenberg > gutenberg_report.md
|
|
41
|
+
cat gutenberg_report.md >> $GITHUB_STEP_SUMMARY
|
|
42
|
+
|
|
43
|
+
- name: Upload Stress Test Reports
|
|
44
|
+
uses: actions/upload-artifact@v4
|
|
45
|
+
with:
|
|
46
|
+
name: stress-test-reports
|
|
47
|
+
path: |
|
|
48
|
+
sample_report.md
|
|
49
|
+
gutenberg_report.md
|
|
50
|
+
|
|
51
|
+
mutation-fuzzing:
|
|
52
|
+
name: 10-Minute Continuous libFuzzer Mutation Run
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
steps:
|
|
55
|
+
- name: Checkout Repository
|
|
56
|
+
uses: actions/checkout@v4
|
|
57
|
+
|
|
58
|
+
- name: Install Nightly Rust Toolchain
|
|
59
|
+
uses: dtolnay/rust-toolchain@nightly
|
|
60
|
+
|
|
61
|
+
- name: Install cargo-fuzz
|
|
62
|
+
run: cargo install cargo-fuzz --locked
|
|
63
|
+
|
|
64
|
+
- name: Seed Fuzz Corpus
|
|
65
|
+
run: |
|
|
66
|
+
mkdir -p fuzz/corpus/fuzz_from_bytes
|
|
67
|
+
# Seed with sample files up to 256KB to prime coverage-guided mutation engine
|
|
68
|
+
for file in samples/*; do
|
|
69
|
+
if [ -f "$file" ]; then
|
|
70
|
+
head -c 262144 "$file" > "fuzz/corpus/fuzz_from_bytes/$(basename "$file")" || true
|
|
71
|
+
fi
|
|
72
|
+
done
|
|
73
|
+
|
|
74
|
+
- name: Run Coverage-Guided Fuzzing (10 minutes)
|
|
75
|
+
run: |
|
|
76
|
+
cd fuzz
|
|
77
|
+
cargo +nightly fuzz run fuzz_from_bytes -- -max_total_time=600 -rss_limit_mb=4096
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
# Publishing is driven by the GitHub Release so that the npm version, the
|
|
5
|
+
# PyPI version and the release notes all come from the same tag. The old
|
|
6
|
+
# `push: tags` trigger is intentionally gone: together with `release` it
|
|
7
|
+
# produced two concurrent publishes per release, and the loser failed.
|
|
8
|
+
release:
|
|
9
|
+
types: [published]
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
# Never run two publishes at once; npm rejects duplicate versions.
|
|
13
|
+
concurrency:
|
|
14
|
+
group: npm-${{ github.ref }}
|
|
15
|
+
cancel-in-progress: false
|
|
16
|
+
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
|
|
20
|
+
env:
|
|
21
|
+
# The registry rejects the unscoped name `ebook-rs` with
|
|
22
|
+
# `400 Bad Request - That word is not allowed`, so the package lives under
|
|
23
|
+
# the user scope. wasm-pack regenerates pkg/package.json on every build and
|
|
24
|
+
# ignores [package.metadata.wasm-pack.package], so the name is patched here.
|
|
25
|
+
NPM_PACKAGE_NAME: '@svstark/ebook-rs'
|
|
26
|
+
NPM_REPOSITORY_URL: 'https://github.com/SV-stark/ebook-rs'
|
|
27
|
+
|
|
28
|
+
jobs:
|
|
29
|
+
publish-npm:
|
|
30
|
+
name: Publish to npm
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
permissions:
|
|
33
|
+
contents: read
|
|
34
|
+
# Required for npm Trusted Publishing (OIDC) and for the provenance
|
|
35
|
+
# attestation npm attaches to the tarball.
|
|
36
|
+
id-token: write
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v4
|
|
39
|
+
|
|
40
|
+
- name: Install Rust toolchain
|
|
41
|
+
uses: dtolnay/rust-toolchain@stable
|
|
42
|
+
with:
|
|
43
|
+
targets: wasm32-unknown-unknown
|
|
44
|
+
|
|
45
|
+
- name: Install wasm-pack
|
|
46
|
+
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
47
|
+
|
|
48
|
+
- name: Build WebAssembly package
|
|
49
|
+
run: wasm-pack build --target web --out-dir pkg -- --no-default-features --features wasm
|
|
50
|
+
|
|
51
|
+
- name: Setup Node.js
|
|
52
|
+
uses: actions/setup-node@v4
|
|
53
|
+
with:
|
|
54
|
+
# Trusted publishing needs Node >= 22.14 and npm >= 11.5.1.
|
|
55
|
+
node-version: '24'
|
|
56
|
+
registry-url: 'https://registry.npmjs.org'
|
|
57
|
+
|
|
58
|
+
# wasm-pack derives `name` from the crate name and ignores the
|
|
59
|
+
# [package.metadata.wasm-pack.package] table in Cargo.toml.
|
|
60
|
+
- name: Fix package manifest for npm
|
|
61
|
+
working-directory: pkg
|
|
62
|
+
run: |
|
|
63
|
+
npm pkg set "name=$NPM_PACKAGE_NAME"
|
|
64
|
+
npm pkg set "repository.type=git" "repository.url=$NPM_REPOSITORY_URL"
|
|
65
|
+
|
|
66
|
+
- name: Show package manifest
|
|
67
|
+
working-directory: pkg
|
|
68
|
+
run: |
|
|
69
|
+
node -e "const p=require('./package.json'); console.log(p.name + '@' + p.version); console.log('repository:', p.repository && p.repository.url)"
|
|
70
|
+
|
|
71
|
+
# No NODE_AUTH_TOKEN and no NPM_TOKEN: the npm CLI detects the GitHub
|
|
72
|
+
# Actions OIDC environment and exchanges the ID token for short-lived
|
|
73
|
+
# publish credentials (npm Trusted Publishing).
|
|
74
|
+
- name: Publish to npm
|
|
75
|
+
working-directory: pkg
|
|
76
|
+
run: npm publish --access public
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
name: Publish Python Wheels to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
# Never run two publishes at once; PyPI rejects duplicate filenames.
|
|
10
|
+
concurrency:
|
|
11
|
+
group: pypi-${{ github.ref }}
|
|
12
|
+
cancel-in-progress: false
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
wheels:
|
|
19
|
+
name: Build wheels on ${{ matrix.os }} (${{ matrix.target || 'default' }})
|
|
20
|
+
runs-on: ${{ matrix.os }}
|
|
21
|
+
strategy:
|
|
22
|
+
fail-fast: false
|
|
23
|
+
matrix:
|
|
24
|
+
include:
|
|
25
|
+
- os: ubuntu-latest
|
|
26
|
+
target: x86_64
|
|
27
|
+
- os: ubuntu-latest
|
|
28
|
+
target: aarch64
|
|
29
|
+
- os: windows-latest
|
|
30
|
+
target: x64
|
|
31
|
+
- os: macos-latest
|
|
32
|
+
target: x86_64
|
|
33
|
+
- os: macos-latest
|
|
34
|
+
target: aarch64
|
|
35
|
+
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@v4
|
|
38
|
+
|
|
39
|
+
- name: Setup Python
|
|
40
|
+
uses: actions/setup-python@v5
|
|
41
|
+
with:
|
|
42
|
+
python-version: '3.11'
|
|
43
|
+
|
|
44
|
+
- name: Build wheels
|
|
45
|
+
uses: PyO3/maturin-action@v1
|
|
46
|
+
with:
|
|
47
|
+
target: ${{ matrix.target }}
|
|
48
|
+
args: --release --features python --strip
|
|
49
|
+
|
|
50
|
+
# maturin-action@v1 has no `sdist` input (it was silently ignored), so the
|
|
51
|
+
# sdist is built as its own step. It lands in target/wheels and is uploaded
|
|
52
|
+
# with the linux-x86_64 artifact.
|
|
53
|
+
- name: Build sdist
|
|
54
|
+
if: matrix.os == 'ubuntu-latest' && matrix.target == 'x86_64'
|
|
55
|
+
uses: PyO3/maturin-action@v1
|
|
56
|
+
with:
|
|
57
|
+
command: sdist
|
|
58
|
+
args: --out target/wheels
|
|
59
|
+
|
|
60
|
+
- name: Upload wheels artifact
|
|
61
|
+
uses: actions/upload-artifact@v4
|
|
62
|
+
with:
|
|
63
|
+
name: wheels-${{ matrix.os }}-${{ matrix.target }}
|
|
64
|
+
path: target/wheels/*
|
|
65
|
+
|
|
66
|
+
publish:
|
|
67
|
+
name: Publish to PyPI
|
|
68
|
+
runs-on: ubuntu-latest
|
|
69
|
+
needs: [wheels]
|
|
70
|
+
# Trusted Publishing: maturin exchanges this OIDC token for a short-lived
|
|
71
|
+
# PyPI API token. No PYPI_API_TOKEN secret is needed (or wanted).
|
|
72
|
+
permissions:
|
|
73
|
+
id-token: write
|
|
74
|
+
steps:
|
|
75
|
+
- uses: actions/download-artifact@v4
|
|
76
|
+
with:
|
|
77
|
+
pattern: wheels-*
|
|
78
|
+
merge-multiple: true
|
|
79
|
+
|
|
80
|
+
- name: Publish wheels to PyPI
|
|
81
|
+
uses: PyO3/maturin-action@v1
|
|
82
|
+
with:
|
|
83
|
+
command: upload
|
|
84
|
+
# --skip-existing makes re-runs after a partial upload idempotent.
|
|
85
|
+
args: --non-interactive --skip-existing *
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/target
|
|
2
|
+
/boko
|
|
3
|
+
scratch/
|
|
4
|
+
website/node_modules/
|
|
5
|
+
website/dist/
|
|
6
|
+
website/.astro/
|
|
7
|
+
fuzz/corpus/
|
|
8
|
+
fuzz/artifacts/
|
|
9
|
+
fuzz/target/
|
|
10
|
+
corpus/
|
|
11
|
+
# wasm-pack output (regenerated by CI and locally)
|
|
12
|
+
/pkg/
|
|
13
|
+
# machine-local cargo config (disables the global kache wrapper for this repo)
|
|
14
|
+
/.cargo/
|
|
15
|
+
hp.pdf
|