Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/publish-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ jobs:
- uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1
with:
command: build
maturin-version: v1.9.4
maturin-version: v1.12.6
args: --release --out dist
manylinux: auto
working-directory: bindings/python
Expand All @@ -299,7 +299,7 @@ jobs:
- uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1
with:
command: sdist
maturin-version: v1.9.4
maturin-version: v1.12.6
args: --out dist
working-directory: bindings/python
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
Expand Down
27 changes: 20 additions & 7 deletions tests/package/node/smoke.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { mkdtemp, readFile, readdir, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { spawnSync } from "node:child_process";
import { createRequire } from "node:module";
import { pathToFileURL } from "node:url";

const [artifactDirectory, hostPlatform, expectedVersion = ""] = process.argv.slice(2);
if (!artifactDirectory || !hostPlatform) {
Expand Down Expand Up @@ -36,8 +34,10 @@ try {
cwd: temporaryDirectory,
encoding: "utf8",
env: { ...process.env, npm_config_cache: join(temporaryDirectory, ".npm-cache") },
shell: process.platform === "win32",
},
);
if (result.error) throw result.error;
if (result.status !== 0) throw new Error(`${result.stdout}${result.stderr}`);

const mainManifest = JSON.parse(
Expand All @@ -56,11 +56,24 @@ try {
await readFile(join(packageDirectory, `stdbr.${platform}.node`));
}

const require = createRequire(join(temporaryDirectory, "package.json"));
const stdbr = require("@stdbr/stdbr");
assert.equal(stdbr.cpfIsValid("52998224725"), true);
const esm = await import(pathToFileURL(join(temporaryDirectory, "node_modules", "@stdbr", "stdbr", "index.js")).href);
assert.equal(esm.cpfIsValid("52998224725"), true);
const probe = `
import { createRequire } from "node:module";
import { join } from "node:path";
import { pathToFileURL } from "node:url";
const installDirectory = process.argv[1];
const require = createRequire(join(installDirectory, "package.json"));
const stdbr = require("@stdbr/stdbr");
if (!stdbr.cpfIsValid("52998224725")) process.exit(1);
const esm = await import(pathToFileURL(join(installDirectory, "node_modules", "@stdbr", "stdbr", "index.js")).href);
if (!esm.cpfIsValid("52998224725")) process.exit(1);
`;
const probeResult = spawnSync(
process.execPath,
["--input-type=module", "--eval", probe, temporaryDirectory],
{ encoding: "utf8" },
);
if (probeResult.error) throw probeResult.error;
if (probeResult.status !== 0) throw new Error(`${probeResult.stdout}${probeResult.stderr}`);
const libc = process.platform === "linux"
? process.report.getReport().header.glibcVersionRuntime ? "-gnu" : "-musl"
: "";
Expand Down
Loading