[repo] Licences: the check covers every crate in Cargo.lock, SPDX rule tests; Fabrica test pipeline

This commit is contained in:
2026-11-17 00:47:02 +01:00
parent fcc9840fdc
commit f1f0234ffb
4 changed files with 224 additions and 149 deletions
+19
View File
@@ -0,0 +1,19 @@
# Pictor's core: every test, on the Windows runner (Fabrica on Mark's PC), in the background. pdfium is fetched by
# its pinned script; the optional hostile corpus too. LibreOffice, when installed, is used by the PDF-to-Word test.
name: test
on:
push: [main]
manual: true
runner: windows
env:
RUST_BACKTRACE: "1"
steps:
- id: pdfium
run: powershell -NoProfile -ExecutionPolicy Bypass -File scripts/fetch-pdfium.ps1
- id: corpus
run: powershell -NoProfile -ExecutionPolicy Bypass -File fixtures-fetch/fetch.ps1
- id: test
needs: [pdfium, corpus]
run: cargo test --workspace --release
- id: licences
run: node --test scripts/deps.test.mjs && node scripts/deps.mjs --check
+36 -1
View File
@@ -86,7 +86,7 @@ support depends on pdfium, which the brief chose).
Generated by `node scripts/deps.mjs` from `cargo metadata`; do not edit by hand.
<!-- deps:begin -->
141 crates; 0 outside the allowed set.
176 crates; 0 outside the allowed set.
| Crate | Version | Licence | Allowed |
| :-- | :-- | :-- | :-- |
@@ -94,6 +94,7 @@ Generated by `node scripts/deps.mjs` from `cargo metadata`; do not edit by hand.
| aes | 0.9.2 | MIT OR Apache-2.0 | yes |
| alloc-no-stdlib | 2.0.4 | BSD-3-Clause | yes |
| alloc-stdlib | 0.2.4 | BSD-3-Clause | yes |
| android_system_properties | 0.1.6 | MIT OR Apache-2.0 | yes |
| autocfg | 1.5.1 | Apache-2.0 OR MIT | yes |
| base64 | 0.22.1 | MIT OR Apache-2.0 | yes |
| bit-set | 0.11.1 | Apache-2.0 OR MIT | yes |
@@ -104,34 +105,46 @@ Generated by `node scripts/deps.mjs` from `cargo metadata`; do not edit by hand.
| borsh | 1.8.1 | MIT OR Apache-2.0 | yes |
| borsh-derive | 1.8.1 | Apache-2.0 | yes |
| brotli-decompressor | 5.0.3 | BSD-3-Clause/MIT | yes |
| bumpalo | 3.20.4 | MIT OR Apache-2.0 | yes |
| bytemuck | 1.25.2 | Zlib OR Apache-2.0 OR MIT | yes |
| byteorder | 1.5.0 | Unlicense OR MIT | yes |
| byteorder-lite | 0.1.0 | Unlicense OR MIT | yes |
| bytes | 1.12.1 | MIT | yes |
| cbc | 0.2.1 | MIT OR Apache-2.0 | yes |
| cc | 1.11.2 | MIT OR Apache-2.0 | yes |
| cfg_aliases | 0.2.2 | MIT | yes |
| cfg-if | 1.0.5 | MIT OR Apache-2.0 | yes |
| chacha20 | 0.10.2 | MIT OR Apache-2.0 | yes |
| chrono | 0.4.45 | MIT OR Apache-2.0 | yes |
| cipher | 0.5.2 | MIT OR Apache-2.0 | yes |
| color_quant | 1.1.0 | MIT | yes |
| console_error_panic_hook | 0.1.7 | Apache-2.0/MIT | yes |
| console_log | 1.1.0 | MIT/Apache-2.0 | yes |
| const-oid | 0.10.3 | Apache-2.0 OR MIT | yes |
| core_detect | 1.0.0 | MIT/Apache-2.0 | yes |
| core-foundation-sys | 0.8.7 | MIT OR Apache-2.0 | yes |
| cpubits | 0.1.1 | MIT OR Apache-2.0 | yes |
| cpufeatures | 0.3.1 | MIT OR Apache-2.0 | yes |
| crc32fast | 1.5.5 | MIT OR Apache-2.0 | yes |
| crunchy | 0.2.4 | MIT | yes |
| crypto-common | 0.2.2 | MIT OR Apache-2.0 | yes |
| digest | 0.11.3 | MIT OR Apache-2.0 | yes |
| docx-rs | 0.4.22 | MIT | yes |
| ecb | 0.2.1 | MIT OR Apache-2.0 | yes |
| either | 1.19.0 | MIT OR Apache-2.0 | yes |
| encoding_rs | 0.8.44 | (Apache-2.0 OR MIT) AND BSD-3-Clause | yes |
| equivalent | 1.0.3 | Apache-2.0 OR MIT | yes |
| errno | 0.3.15 | MIT OR Apache-2.0 | yes |
| fastrand | 2.5.0 | Apache-2.0 OR MIT | yes |
| fax | 0.2.7 | MIT | yes |
| fdeflate | 0.3.7 | MIT OR Apache-2.0 | yes |
| find-msvc-tools | 0.1.15 | MIT OR Apache-2.0 | yes |
| flate2 | 1.1.11 | MIT OR Apache-2.0 | yes |
| fnv | 1.0.7 | Apache-2.0 / MIT | yes |
| foldhash | 0.2.0 | Zlib | yes |
| futures-core | 0.3.34 | MIT OR Apache-2.0 | yes |
| futures-task | 0.3.34 | MIT OR Apache-2.0 | yes |
| futures-util | 0.3.34 | MIT OR Apache-2.0 | yes |
| g2gen | 1.2.2 | MIT/Apache-2.0 | yes |
| g2p | 1.2.2 | MIT/Apache-2.0 | yes |
| g2poly | 1.2.2 | MIT/Apache-2.0 | yes |
@@ -140,6 +153,8 @@ Generated by `node scripts/deps.mjs` from `cargo metadata`; do not edit by hand.
| half | 2.7.1 | MIT OR Apache-2.0 | yes |
| hashbrown | 0.17.1 | MIT OR Apache-2.0 | yes |
| hybrid-array | 0.4.15 | MIT OR Apache-2.0 | yes |
| iana-time-zone | 0.1.65 | MIT OR Apache-2.0 | yes |
| iana-time-zone-haiku | 0.1.2 | MIT OR Apache-2.0 | yes |
| image | 0.25.10 | MIT OR Apache-2.0 | yes |
| image-webp | 0.2.4 | MIT OR Apache-2.0 | yes |
| img-parts | 0.4.2 | MIT OR Apache-2.0 | yes |
@@ -147,8 +162,11 @@ Generated by `node scripts/deps.mjs` from `cargo metadata`; do not edit by hand.
| inout | 0.2.6 | MIT OR Apache-2.0 | yes |
| itertools | 0.15.0 | MIT OR Apache-2.0 | yes |
| itoa | 1.0.19 | MIT OR Apache-2.0 | yes |
| js-sys | 0.3.107 | MIT OR Apache-2.0 | yes |
| kamadak-exif | 0.6.2 | BSD-2-Clause | yes |
| libc | 0.2.191 | MIT OR Apache-2.0 | yes |
| libloading | 0.9.1 | ISC | yes |
| linux-raw-sys | 0.12.1 | Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT | yes |
| log | 0.4.35 | MIT OR Apache-2.0 | yes |
| lopdf | 0.47.0 | MIT | yes |
| lru | 0.18.5 | MIT | yes |
@@ -164,6 +182,7 @@ Generated by `node scripts/deps.mjs` from `cargo metadata`; do not edit by hand.
| num-traits | 0.2.19 | MIT OR Apache-2.0 | yes |
| once_cell | 1.21.4 | MIT OR Apache-2.0 | yes |
| pdfium-render | 0.9.5 | MIT OR Apache-2.0 | yes |
| pin-project-lite | 0.2.17 | Apache-2.0 OR MIT | yes |
| piston-float | 1.0.1 | MIT | yes |
| png | 0.18.1 | MIT OR Apache-2.0 | yes |
| proc-macro-crate | 3.5.0 | MIT OR Apache-2.0 | yes |
@@ -173,13 +192,16 @@ Generated by `node scripts/deps.mjs` from `cargo metadata`; do not edit by hand.
| qrcode | 0.14.1 | MIT OR Apache-2.0 | yes |
| quick-error | 1.2.3 | MIT/Apache-2.0 | yes |
| quick-error | 2.0.1 | MIT/Apache-2.0 | yes |
| quick-xml | 0.41.0 | MIT | yes |
| quote | 1.0.47 | MIT OR Apache-2.0 | yes |
| r-efi | 6.0.0 | MIT OR Apache-2.0 OR LGPL-2.1-or-later | yes |
| rand | 0.10.4 | MIT OR Apache-2.0 | yes |
| rand_core | 0.10.1 | MIT OR Apache-2.0 | yes |
| rand_xorshift | 0.5.0 | MIT OR Apache-2.0 | yes |
| rangemap | 1.8.0 | MIT/Apache-2.0 | yes |
| regex-syntax | 0.8.11 | MIT OR Apache-2.0 | yes |
| rqrr | 0.11.0 | (MIT OR Apache-2.0) AND ISC | yes |
| rustix | 1.1.6 | Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT | yes |
| rustversion | 1.0.23 | MIT OR Apache-2.0 | yes |
| rusty-fork | 0.3.1 | MIT/Apache-2.0 | yes |
| scopeguard | 1.2.0 | MIT OR Apache-2.0 | yes |
@@ -188,8 +210,11 @@ Generated by `node scripts/deps.mjs` from `cargo metadata`; do not edit by hand.
| serde_derive | 1.0.229 | MIT OR Apache-2.0 | yes |
| serde_json | 1.0.154 | MIT OR Apache-2.0 | yes |
| sha2 | 0.11.1 | MIT OR Apache-2.0 | yes |
| shlex | 2.0.1 | MIT OR Apache-2.0 | yes |
| simd-adler32 | 0.3.10 | MIT | yes |
| simdutf8 | 0.1.5 | MIT OR Apache-2.0 | yes |
| slab | 0.4.12 | MIT | yes |
| smallvec | 1.16.5 | MIT OR Apache-2.0 | yes |
| stringprep | 0.1.5 | MIT/Apache-2.0 | yes |
| syn | 2.0.119 | MIT OR Apache-2.0 | yes |
| syn | 3.0.10 | MIT OR Apache-2.0 | yes |
@@ -198,9 +223,11 @@ Generated by `node scripts/deps.mjs` from `cargo metadata`; do not edit by hand.
| thiserror-impl | 2.0.21 | MIT OR Apache-2.0 | yes |
| tiff | 0.11.3 | MIT | yes |
| tinyvec | 1.13.3 | Zlib OR Apache-2.0 OR MIT | yes |
| tokio | 1.54.1 | MIT | yes |
| toml_datetime | 1.1.3+spec-1.1.0 | MIT OR Apache-2.0 | yes |
| toml_edit | 0.25.19+spec-1.1.0 | MIT OR Apache-2.0 | yes |
| toml_parser | 1.1.5+spec-1.1.0 | MIT OR Apache-2.0 | yes |
| typed-path | 0.12.4 | MIT OR Apache-2.0 | yes |
| typenum | 1.20.1 | MIT OR Apache-2.0 | yes |
| unarray | 0.1.4 | MIT OR Apache-2.0 | yes |
| unicode-bidi | 0.3.18 | MIT OR Apache-2.0 | yes |
@@ -210,6 +237,12 @@ Generated by `node scripts/deps.mjs` from `cargo metadata`; do not edit by hand.
| utf16string | 0.2.0 | MIT OR Apache-2.0 | yes |
| vecmath | 1.0.0 | MIT | yes |
| wait-timeout | 0.2.1 | MIT/Apache-2.0 | yes |
| wasm-bindgen | 0.2.130 | MIT OR Apache-2.0 | yes |
| wasm-bindgen-futures | 0.4.80 | MIT OR Apache-2.0 | yes |
| wasm-bindgen-macro | 0.2.130 | MIT OR Apache-2.0 | yes |
| wasm-bindgen-macro-support | 0.2.130 | MIT OR Apache-2.0 | yes |
| wasm-bindgen-shared | 0.2.130 | MIT OR Apache-2.0 | yes |
| web-sys | 0.3.107 | MIT OR Apache-2.0 | yes |
| weezl | 0.1.12 | MIT OR Apache-2.0 | yes |
| weezl | 0.2.1 | MIT OR Apache-2.0 | yes |
| windows | 0.62.2 | MIT OR Apache-2.0 | yes |
@@ -227,8 +260,10 @@ Generated by `node scripts/deps.mjs` from `cargo metadata`; do not edit by hand.
| winnow | 1.0.5 | MIT | yes |
| zerocopy | 0.8.63 | BSD-2-Clause OR Apache-2.0 OR MIT | yes |
| zerocopy-derive | 0.8.63 | BSD-2-Clause OR Apache-2.0 OR MIT | yes |
| zip | 8.6.0 | MIT | yes |
| zlib-rs | 0.6.8 | Zlib | yes |
| zmij | 1.0.23 | MIT | yes |
| zopfli | 0.8.4 | Apache-2.0 | yes |
| zune-core | 0.5.3 | MIT OR Apache-2.0 OR Zlib | yes |
| zune-jpeg | 0.5.15 | MIT OR Apache-2.0 OR Zlib | yes |
<!-- deps:end -->
+4 -3
View File
@@ -32,11 +32,12 @@ export function allowed(expr) {
}
function main() {
const meta = JSON.parse(execFileSync('cargo', ['metadata', '--format-version', '1', '--locked', '--filter-platform', 'x86_64-pc-windows-msvc'], {
// Every package in Cargo.lock (all platforms): a crate that is locked must be listed, whatever it is built for.
const meta = JSON.parse(execFileSync('cargo', ['metadata', '--format-version', '1', '--locked'], {
cwd: root, maxBuffer: 1 << 28, encoding: 'utf8',
}));
// Only crates reachable on Windows x64 (the one target of V1), not every lockfile entry of every platform:
// with --filter-platform, resolve.nodes lists what the workspace really depends on there.
// resolve.nodes lists every package the lockfile resolves (all targets).
const used = new Set(meta.resolve.nodes.map((n) => n.id));
const workspace = new Set(meta.workspace_members);
const rows = meta.packages
+20
View File
@@ -0,0 +1,20 @@
// The licence rule's SPDX evaluator (scripts/deps.mjs). Run: node --test scripts/deps.test.mjs
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { allowed } from './deps.mjs';
test('the allowed licences pass', () => {
for (const l of ['MIT', 'Apache-2.0', 'BSD-3-Clause', 'Zlib', 'MPL-2.0', 'ISC', 'Unicode-3.0', 'MIT OR Apache-2.0', 'MIT/Apache-2.0', '(MIT OR Apache-2.0) AND Unicode-3.0', 'Apache-2.0 WITH LLVM-exception'])
assert.ok(allowed(l), l);
});
test('copyleft, non-commercial and missing licences fail', () => {
for (const l of ['GPL-3.0', 'AGPL-3.0-only', 'LGPL-2.1', 'CC-BY-NC-4.0', 'MIT AND GPL-2.0', '', undefined, 'SSPL-1.0', 'OpenSSL'])
assert.equal(allowed(l), false, String(l));
});
test('OR needs one allowed branch, AND needs all', () => {
assert.ok(allowed('GPL-2.0 OR MIT'));
assert.equal(allowed('GPL-2.0 AND MIT'), false);
assert.ok(allowed('(GPL-2.0 OR MIT) AND Apache-2.0'));
});