fix ci release version fixtures

This commit is contained in:
Andrey Avtomonov 2026-05-21 00:52:49 +02:00
parent 4c71ff545f
commit 9b176bdc2e
5 changed files with 38 additions and 33 deletions

View file

@ -139,12 +139,12 @@ async function writeWorkspaceFixture(root) {
}
describe('publicNpmPackageLayout', () => {
it('uses the first public npm release version for the tarball name', () => {
it('uses the public npm release version for the tarball name', () => {
const layout = publicNpmPackageLayout('/repo/ktx');
const expectedTarballName = `kaelio-ktx-${PUBLIC_NPM_PACKAGE_VERSION}.tgz`;
assert.equal(PUBLIC_NPM_PACKAGE_VERSION, '0.1.0-rc.1');
assert.equal(publicNpmPackageTarballName(), 'kaelio-ktx-0.1.0-rc.1.tgz');
assert.equal(layout.tarballPath, '/repo/ktx/dist/artifacts/npm/kaelio-ktx-0.1.0-rc.1.tgz');
assert.equal(publicNpmPackageTarballName(), expectedTarballName);
assert.equal(layout.tarballPath, `/repo/ktx/dist/artifacts/npm/${expectedTarballName}`);
});
});
@ -211,7 +211,7 @@ describe('publicNpmPackageJson', () => {
);
assert.equal(packageJson.name, PUBLIC_NPM_PACKAGE_NAME);
assert.equal(packageJson.version, '0.1.0-rc.1');
assert.equal(packageJson.version, PUBLIC_NPM_PACKAGE_VERSION);
assert.equal(packageJson.private, false);
assert.deepEqual(packageJson.bin, { ktx: './dist/bin.js' });
assert.deepEqual(packageJson.dependencies, { commander: '14.0.3' });
@ -268,6 +268,7 @@ describe('createPublicNpmPackageTree', () => {
describe('publicNpmPackCommand', () => {
it('packs the assembled public package with pnpm', () => {
const layout = publicNpmPackageLayout('/repo/ktx');
const expectedTarballName = `kaelio-ktx-${PUBLIC_NPM_PACKAGE_VERSION}.tgz`;
assert.deepEqual(publicNpmPackCommand(layout), {
command: 'pnpm',
@ -275,7 +276,7 @@ describe('publicNpmPackCommand', () => {
'--config.node-linker=hoisted',
'pack',
'--out',
'/repo/ktx/dist/artifacts/npm/kaelio-ktx-0.1.0-rc.1.tgz',
`/repo/ktx/dist/artifacts/npm/${expectedTarballName}`,
],
cwd: '/repo/ktx/dist/public-npm-package',
});

View file

@ -52,7 +52,7 @@ describe('runtimeWheelPyproject', () => {
const pyproject = runtimeWheelPyproject();
assert.match(pyproject, /name = "kaelio-ktx"/);
assert.match(pyproject, /version = "0\.1\.0rc1"/);
assert.match(pyproject, new RegExp(`version = "${RUNTIME_WHEEL_PACKAGE_VERSION.replaceAll('.', '\\.')}"`));
assert.match(pyproject, /ktx-daemon = "ktx_daemon\.__main__:main"/);
assert.match(pyproject, /packages = \["semantic_layer", "ktx_daemon"\]/);
assert.match(pyproject, /\[project\.optional-dependencies\]/);
@ -110,6 +110,6 @@ describe('runtimeWheelBuildCommand', () => {
cwd: '/repo/ktx',
});
assert.equal(RUNTIME_WHEEL_DISTRIBUTION_NAME, 'kaelio-ktx');
assert.equal(RUNTIME_WHEEL_PACKAGE_VERSION, '0.1.0rc1');
assert.match(RUNTIME_WHEEL_PACKAGE_VERSION, /^\d+\.\d+\.\d+(?:rc\d+)?$/);
});
});

View file

@ -11,6 +11,10 @@ import {
publicKtxTarballName,
validateEmbeddingResponse,
} from './local-embeddings-runtime-smoke.mjs';
import {
PUBLIC_NPM_PACKAGE_NAME,
PUBLIC_NPM_PACKAGE_VERSION,
} from './build-public-npm-package.mjs';
describe('localEmbeddingsSmokeOptIn', () => {
it('skips unless the smoke is explicitly enabled', () => {
@ -60,7 +64,7 @@ describe('expectedPublicKtxVersionPattern', () => {
it('matches the public package version and rejects the private workspace version', () => {
const pattern = expectedPublicKtxVersionPattern();
assert.match('@kaelio/ktx 0.1.0-rc.1\n', pattern);
assert.match(`${PUBLIC_NPM_PACKAGE_NAME} ${PUBLIC_NPM_PACKAGE_VERSION}\n`, pattern);
assert.doesNotMatch('@kaelio/ktx 0.0.0-private\n', pattern);
});
});

View file

@ -28,6 +28,9 @@ import {
writeArtifactManifest,
} from './package-artifacts.mjs';
const PUBLIC_NPM_TARBALL_NAME = `kaelio-ktx-${PUBLIC_NPM_PACKAGE_VERSION}.tgz`;
const RUNTIME_WHEEL_FILE = `kaelio_ktx-${RUNTIME_WHEEL_PACKAGE_VERSION}-py3-none-any.whl`;
async function writeJson(path, value) {
await writeFile(path, `${JSON.stringify(value, null, 2)}\n`);
}
@ -81,10 +84,7 @@ async function writeUploadableArtifactFixtures(layout) {
layout.npmTarballs[packageInfo.name],
`${packageInfo.name}-tarball`,
]),
[
join(layout.pythonDir, 'kaelio_ktx-0.1.0rc1-py3-none-any.whl'),
'kaelio-ktx-runtime-wheel',
],
[join(layout.pythonDir, RUNTIME_WHEEL_FILE), 'kaelio-ktx-runtime-wheel'],
]);
for (const [path, contents] of fileContents) {
@ -99,7 +99,7 @@ describe('packageArtifactLayout', () => {
assert.equal(layout.artifactDir, '/repo/ktx/dist/artifacts');
assert.equal(layout.npmDir, '/repo/ktx/dist/artifacts/npm');
assert.equal(layout.pythonDir, '/repo/ktx/dist/artifacts/python');
assert.equal(layout.cliTarball, '/repo/ktx/dist/artifacts/npm/kaelio-ktx-0.1.0-rc.1.tgz');
assert.equal(layout.cliTarball, `/repo/ktx/dist/artifacts/npm/${PUBLIC_NPM_TARBALL_NAME}`);
assert.deepEqual(Object.keys(layout.npmTarballs), ['@kaelio/ktx']);
});
});
@ -131,7 +131,7 @@ describe('packageReleaseMetadata', () => {
ecosystem: 'npm',
packageName: '@kaelio/ktx',
packageRoot: 'packages/cli',
packageVersion: '0.1.0-rc.1',
packageVersion: PUBLIC_NPM_PACKAGE_VERSION,
private: false,
releaseMode: 'ci-artifact-only',
},
@ -139,7 +139,7 @@ describe('packageReleaseMetadata', () => {
ecosystem: 'python',
packageName: 'kaelio-ktx',
packageRoot: 'python/runtime-wheel',
packageVersion: '0.1.0rc1',
packageVersion: RUNTIME_WHEEL_PACKAGE_VERSION,
private: false,
releaseMode: 'ci-artifact-only',
},
@ -154,10 +154,10 @@ describe('findPythonArtifacts', () => {
it('finds the bundled runtime wheel only', async () => {
const root = await mkdtemp(join(tmpdir(), 'ktx-artifacts-test-'));
try {
await writeFile(join(root, 'kaelio_ktx-0.1.0rc1-py3-none-any.whl'), '');
await writeFile(join(root, RUNTIME_WHEEL_FILE), '');
assert.deepEqual(await findPythonArtifacts(root), {
runtimeWheel: join(root, 'kaelio_ktx-0.1.0rc1-py3-none-any.whl'),
runtimeWheel: join(root, RUNTIME_WHEEL_FILE),
});
} finally {
await rm(root, { recursive: true, force: true });
@ -197,7 +197,7 @@ describe('artifact manifest', () => {
ecosystem: 'npm',
packageName: '@kaelio/ktx',
packageRoot: 'packages/cli',
packageVersion: '0.1.0-rc.1',
packageVersion: PUBLIC_NPM_PACKAGE_VERSION,
private: false,
releaseMode: 'ci-artifact-only',
},
@ -210,7 +210,7 @@ describe('artifact manifest', () => {
ecosystem: 'python',
packageName: 'kaelio-ktx',
packageRoot: 'python/runtime-wheel',
packageVersion: '0.1.0rc1',
packageVersion: RUNTIME_WHEEL_PACKAGE_VERSION,
private: false,
releaseMode: 'ci-artifact-only',
},
@ -232,8 +232,8 @@ describe('artifact manifest', () => {
artifactKind: 'tarball',
ecosystem: 'npm',
packageName: '@kaelio/ktx',
packageVersion: '0.1.0-rc.1',
path: 'npm/kaelio-ktx-0.1.0-rc.1.tgz',
packageVersion: PUBLIC_NPM_PACKAGE_VERSION,
path: `npm/${PUBLIC_NPM_TARBALL_NAME}`,
},
],
);
@ -252,13 +252,13 @@ describe('artifact manifest', () => {
artifactKind: 'wheel',
ecosystem: 'python',
packageName: 'kaelio-ktx',
packageVersion: '0.1.0rc1',
path: 'python/kaelio_ktx-0.1.0rc1-py3-none-any.whl',
packageVersion: RUNTIME_WHEEL_PACKAGE_VERSION,
path: `python/${RUNTIME_WHEEL_FILE}`,
},
],
);
const npmEntry = manifest.files.find((file) => file.path === 'npm/kaelio-ktx-0.1.0-rc.1.tgz');
const npmEntry = manifest.files.find((file) => file.path === `npm/${PUBLIC_NPM_TARBALL_NAME}`);
assert.ok(npmEntry);
assert.equal(npmEntry.bytes, Buffer.byteLength('@kaelio/ktx-tarball'));
assert.equal(npmEntry.sha256, createHash('sha256').update('@kaelio/ktx-tarball').digest('hex'));
@ -361,18 +361,15 @@ describe('copyRuntimeWheelAssets', () => {
const layout = packageArtifactLayout(root, PUBLIC_NPM_PACKAGE_VERSION);
try {
await mkdir(layout.pythonDir, { recursive: true });
await writeFile(
join(layout.pythonDir, 'kaelio_ktx-0.1.0rc1-py3-none-any.whl'),
'kaelio-ktx-runtime-wheel',
);
await writeFile(join(layout.pythonDir, RUNTIME_WHEEL_FILE), 'kaelio-ktx-runtime-wheel');
const assets = await copyRuntimeWheelAssets(layout, {
runtimeWheel: join(layout.pythonDir, 'kaelio_ktx-0.1.0rc1-py3-none-any.whl'),
runtimeWheel: join(layout.pythonDir, RUNTIME_WHEEL_FILE),
});
assert.equal(
assets.wheelPath,
join(root, 'packages', 'cli', 'assets', 'python', 'kaelio_ktx-0.1.0rc1-py3-none-any.whl'),
join(root, 'packages', 'cli', 'assets', 'python', RUNTIME_WHEEL_FILE),
);
assert.equal(
assets.manifestPath,
@ -385,7 +382,7 @@ describe('copyRuntimeWheelAssets', () => {
normalizedName: RUNTIME_WHEEL_NORMALIZED_NAME,
version: RUNTIME_WHEEL_PACKAGE_VERSION,
wheel: {
file: 'kaelio_ktx-0.1.0rc1-py3-none-any.whl',
file: RUNTIME_WHEEL_FILE,
sha256: createHash('sha256')
.update('kaelio-ktx-runtime-wheel')
.digest('hex'),

View file

@ -7,12 +7,15 @@ import { describe, it } from 'node:test';
import {
INTERNAL_NPM_WORKSPACE_PACKAGES,
NPM_ARTIFACT_PACKAGES,
RUNTIME_WHEEL_PACKAGE_VERSION,
packageArtifactLayout,
writeArtifactManifest,
} from './package-artifacts.mjs';
import { PUBLIC_NPM_PACKAGE_VERSION } from './build-public-npm-package.mjs';
import { readReleasePolicy, releasePolicyPath, releaseReadinessReport } from './release-readiness.mjs';
const RUNTIME_WHEEL_FILE = `kaelio_ktx-${RUNTIME_WHEEL_PACKAGE_VERSION}-py3-none-any.whl`;
async function writeJson(path, value) {
await writeFile(path, `${JSON.stringify(value, null, 2)}\n`);
}
@ -37,7 +40,7 @@ async function writeUploadableArtifactFixtures(layout) {
layout.npmTarballs[packageInfo.name],
`${packageInfo.name}-tarball`,
]),
[join(layout.pythonDir, 'kaelio_ktx-0.1.0rc1-py3-none-any.whl'), 'kaelio-ktx-runtime-wheel'],
[join(layout.pythonDir, RUNTIME_WHEEL_FILE), 'kaelio-ktx-runtime-wheel'],
]);
for (const [path, contents] of fileContents) {