@zackees/soldr 0.7.5 → 0.7.8
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.
- package/README.md +22 -10
- package/package.json +1 -1
- package/scripts/test-npm-package.js +47 -1
package/README.md
CHANGED
|
@@ -56,12 +56,11 @@ the published `SHA256SUMS` file, and exposes the `soldr` command.
|
|
|
56
56
|
|
|
57
57
|
## GitHub Actions setup
|
|
58
58
|
|
|
59
|
-
The current GitHub Actions entry point is the
|
|
59
|
+
The current GitHub Actions entry point is the public `setup-soldr` action:
|
|
60
60
|
|
|
61
61
|
```yaml
|
|
62
|
-
- uses: zackees/soldr
|
|
62
|
+
- uses: zackees/setup-soldr@v0
|
|
63
63
|
with:
|
|
64
|
-
version: 0.7.4
|
|
65
64
|
cache: true
|
|
66
65
|
|
|
67
66
|
- run: soldr cargo build --locked --release
|
|
@@ -74,17 +73,29 @@ That action:
|
|
|
74
73
|
- bootstraps `rustup` into the cached runner-local root when the runner does not already have it
|
|
75
74
|
- preinstalls the exact Rust toolchain from `rust-toolchain.toml` by default via `rustup`
|
|
76
75
|
- restores a cacheable runner-local root for Soldr, Cargo, and rustup state
|
|
77
|
-
- restores and saves the zccache compilation artifact cache
|
|
78
|
-
- restores and saves
|
|
76
|
+
- restores and saves the Soldr-owned zccache compilation artifact cache under `SOLDR_CACHE_DIR` by default; set `build-cache: false` to disable it
|
|
77
|
+
- restores and saves a bounded hot Cargo target cache by default for no-op CI fast paths; set `target-cache: false` to disable it, `target-cache-mode: full` to opt into whole-target caching, or `target-dir:` to choose another target directory
|
|
79
78
|
- puts `soldr` on `PATH` for later steps
|
|
80
|
-
|
|
79
|
+
|
|
80
|
+
For existing workflows where rewriting every `cargo ...` command is high-friction, opt into Cargo PATH shims:
|
|
81
|
+
|
|
82
|
+
```yaml
|
|
83
|
+
- uses: zackees/setup-soldr@v0
|
|
84
|
+
with:
|
|
85
|
+
tool-shims: cargo
|
|
86
|
+
|
|
87
|
+
- run: cargo build --locked --release
|
|
88
|
+
- run: cargo test --locked
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The shim mode is off by default. When enabled, the action resolves the real Cargo binary before prepending its shim directory, then exports that real path for Soldr so `cargo ...` can safely trampoline into `soldr cargo ...` without recursive PATH lookup.
|
|
81
92
|
|
|
82
93
|
If your project pins Rust in `rust-toolchain.toml`, let the action read that file or pass the exact value with `toolchain:`. Do not preinstall a different generic toolchain such as `stable` and assume `soldr` will reconcile it later. The action exports `RUSTUP_TOOLCHAIN` after installation so later `cargo`, `rustc`, and `soldr cargo ...` steps stay on the toolchain it just installed instead of asking `rustup` to resolve a pinned file lazily.
|
|
83
94
|
|
|
84
95
|
On GitHub-hosted runners, this means you usually do not need a separate toolchain setup action for the normal path. The action still uses `rustup` under the hood today, but it bootstraps `rustup` itself when the runner does not already have it.
|
|
85
96
|
On runners without `rustup`, the action downloads and installs it into the cached runner-local root before provisioning the requested toolchain.
|
|
86
97
|
|
|
87
|
-
|
|
98
|
+
The public action lives in [`zackees/setup-soldr`](https://github.com/zackees/setup-soldr) and is generated from this repository's root action source. This repository dogfoods `zackees/setup-soldr@v0` in [setup-soldr-action.yml](./.github/workflows/setup-soldr-action.yml). For fuller examples and fallback patterns, see [INTEGRATION.md](./INTEGRATION.md).
|
|
88
99
|
|
|
89
100
|
### CI cache lineage
|
|
90
101
|
|
|
@@ -124,13 +135,14 @@ If soldr solves that one problem well, it becomes a super tool: the command you
|
|
|
124
135
|
|
|
125
136
|
- **Tool acquisition** (the crgx half): Need `maturin`, `cargo-dylint`, or any crate binary? soldr fetches a pre-built binary from GitHub Releases in seconds. No `cargo install` from source. Cached locally for instant reuse. On `0.5.x`, this is still an upstream trust decision rather than a repo-side trust guarantee; see [docs/TRUST_BOUNDARIES.md](./docs/TRUST_BOUNDARIES.md).
|
|
126
137
|
|
|
127
|
-
- **Compilation caching** (the zccache half): `soldr cargo ...` now fetches and manages a pinned `zccache` release for Rust builds. soldr owns the zccache daemon/session wiring
|
|
138
|
+
- **Compilation caching** (the zccache half): `soldr cargo ...` now fetches and manages a pinned `zccache` release for Rust builds. soldr owns the zccache daemon/session wiring and keeps managed zccache artifacts under Soldr's cache root.
|
|
128
139
|
|
|
129
140
|
```bash
|
|
130
141
|
# Build through soldr's front door:
|
|
131
142
|
soldr cargo build --release
|
|
132
143
|
soldr cargo test
|
|
133
144
|
soldr --no-cache cargo test
|
|
145
|
+
soldr purge
|
|
134
146
|
SOLDR_RUSTC_WRAPPER=sccache soldr cargo build
|
|
135
147
|
SOLDR_RUSTC_WRAPPER=none soldr cargo build
|
|
136
148
|
|
|
@@ -160,8 +172,8 @@ soldr maturin build --release
|
|
|
160
172
|
- **One obvious command**: Fetch tools, pick the right Windows target, and run through managed zccache through the same entry point.
|
|
161
173
|
- **Front-door builds**: `soldr cargo ...` is the primary build UX.
|
|
162
174
|
- **Invisible caching**: `soldr cargo ...` uses a soldr-managed zccache by default, with `soldr --no-cache cargo ...` as the opt-out.
|
|
163
|
-
- **Real cache controls**: `soldr status`, `soldr cache`, and `soldr clean` report and manage the soldr-managed zccache state
|
|
164
|
-
- **One cache boundary
|
|
175
|
+
- **Real cache controls**: `soldr status`, `soldr cache`, and `soldr clean` report and manage the soldr-managed zccache state, while `soldr purge` removes all Soldr-managed cache artifacts for bug clearing and benchmarking.
|
|
176
|
+
- **One cache boundary**: soldr keeps its own tools, zccache session state, and managed zccache artifacts under `~/.soldr/` by default. Use `SOLDR_CACHE_DIR` to move that root.
|
|
165
177
|
- **Pre-built first**: Download a pre-built binary before compiling from source. Fall back gracefully.
|
|
166
178
|
- **Cargo-compatible**: soldr preserves normal cargo arguments instead of forcing a separate workflow.
|
|
167
179
|
- **Cross-platform**: Linux, macOS, Windows (x86_64 + aarch64).
|
package/package.json
CHANGED
|
@@ -9,11 +9,57 @@ const root = path.resolve(__dirname, "..");
|
|
|
9
9
|
const pkg = require(path.join(root, "package.json"));
|
|
10
10
|
const install = require(path.join(root, "scripts", "install.js"));
|
|
11
11
|
|
|
12
|
+
function tomlSection(toml, sectionName) {
|
|
13
|
+
const header = `[${sectionName}]`;
|
|
14
|
+
const lines = toml.split(/\r?\n/);
|
|
15
|
+
const body = [];
|
|
16
|
+
let found = false;
|
|
17
|
+
|
|
18
|
+
for (const line of lines) {
|
|
19
|
+
if (/^\s*\[.*\]\s*$/.test(line)) {
|
|
20
|
+
if (found) {
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
found = line.trim() === header;
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (found) {
|
|
28
|
+
body.push(line);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return found ? body.join("\n") : null;
|
|
33
|
+
}
|
|
34
|
+
|
|
12
35
|
const cargoToml = fs.readFileSync(path.join(root, "Cargo.toml"), "utf8");
|
|
13
36
|
const cargoVersion = cargoToml.match(/\[workspace\.package\][\s\S]*?^version = "([^"]+)"/m);
|
|
14
37
|
assert(cargoVersion, "workspace package version not found in Cargo.toml");
|
|
15
38
|
assert.strictEqual(pkg.version, cargoVersion[1], "package.json version must match Cargo.toml");
|
|
16
39
|
|
|
40
|
+
const pyprojectToml = fs.readFileSync(path.join(root, "pyproject.toml"), "utf8");
|
|
41
|
+
const pyprojectProject = tomlSection(pyprojectToml, "project");
|
|
42
|
+
assert(pyprojectProject, "[project] section not found in pyproject.toml");
|
|
43
|
+
|
|
44
|
+
assert(
|
|
45
|
+
!/^\s*version\s*=/.test(pyprojectProject),
|
|
46
|
+
'pyproject.toml [project] must not hardcode version; PyPI must derive it from Cargo.toml',
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const dynamicVersion = pyprojectProject.match(/^\s*dynamic\s*=\s*\[([^\]]*)\]\s*$/m);
|
|
50
|
+
assert(
|
|
51
|
+
dynamicVersion,
|
|
52
|
+
'pyproject.toml [project] must declare dynamic = ["version"] so PyPI derives from Cargo.toml',
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const dynamicItems = [...dynamicVersion[1].matchAll(/"([^"]+)"|'([^']+)'/g)].map(
|
|
56
|
+
(match) => match[1] || match[2],
|
|
57
|
+
);
|
|
58
|
+
assert(
|
|
59
|
+
dynamicItems.includes("version"),
|
|
60
|
+
'pyproject.toml [project] dynamic metadata must include "version"',
|
|
61
|
+
);
|
|
62
|
+
|
|
17
63
|
assert.strictEqual(pkg.name, "@zackees/soldr");
|
|
18
64
|
assert.strictEqual(pkg.license, "BSD-3-Clause");
|
|
19
65
|
assert.strictEqual(pkg.bin.soldr, "bin/soldr.js");
|
|
@@ -42,4 +88,4 @@ assert.strictEqual(
|
|
|
42
88
|
"abc123",
|
|
43
89
|
);
|
|
44
90
|
|
|
45
|
-
console.log("npm package checks passed");
|
|
91
|
+
console.log("npm package and PyPI version checks passed");
|