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
2 changes: 1 addition & 1 deletion scripts/refresh/snapshots.mts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import type { ScriptMeta } from '../lib/run-main.mts'
import { runMain } from '../lib/run-main.mts'
import type { SnapshotDependencyName } from './snapshots/dependencies.mts'
import {
SNAPSHOT_DEPENDENCIES,
assertSnapshotDependenciesCurrent,
normalizeSnapshotDependencyName,
SNAPSHOT_DEPENDENCIES,
} from './snapshots/dependencies.mts'

const ROOT = path.resolve(import.meta.dirname, '../..')
Expand Down
11 changes: 7 additions & 4 deletions scripts/test/native.mts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import process from 'node:process'
import { isMainModule } from '../lib/is-main-module.mts'
import type { ScriptMeta } from '../lib/run-main.mts'
import { runMain } from '../lib/run-main.mts'
import { SEA_VERSION } from '../../src/sea/version.mts'
import { assertSnapshotDependenciesCurrent } from '../refresh/snapshots/dependencies.mts'
import {
persistNativeSigningReceipt,
Expand Down Expand Up @@ -118,9 +119,11 @@ function runPnpm(args: readonly string[], env = process.env): void {
}

async function main(): Promise<number> {
const packageInfo = JSON.parse(
const { name } = JSON.parse(
await fs.readFile(PACKAGE_PATH, 'utf8'),
) as PackageMetadata
// The 1.x line builds its native CLI as the configured 2.1 prerelease.
const nativeApp: PackageMetadata = { name, version: SEA_VERSION }
const userArgs = process.argv.slice(2)
const build = userArgs.includes('--build')
const vitestArgs = userArgs.filter(
Expand Down Expand Up @@ -208,7 +211,7 @@ async function main(): Promise<number> {
if (process.platform !== 'win32') {
await fs.chmod(binaryPath, 0o700)
}
const manifest = await verifyArtifact(packageInfo, binaryPath, manifestPath)
const manifest = await verifyArtifact(nativeApp, binaryPath, manifestPath)
const sourceDigest = manifest.payloads.find(
payload => payload.id === 'socket-vfs',
)!.sha256!
Expand All @@ -229,7 +232,7 @@ async function main(): Promise<number> {
process.env['SOCKET_CLI_NATIVE_TEST_STAGE'] = stageDir
process.env['SOCKET_CLI_NATIVE_TEST_CAPABILITIES'] =
manifest.capabilities.available.join(',')
process.env['SOCKET_CLI_NATIVE_TEST_VERSION'] = packageInfo.version
process.env['SOCKET_CLI_NATIVE_TEST_VERSION'] = nativeApp.version
const nodeRuntime = manifest.payloads.find(
payload => payload.id === 'node-runtime',
)
Expand Down Expand Up @@ -292,7 +295,7 @@ async function main(): Promise<number> {
}
if (
version.status !== 0 ||
!version.stdout.trim().startsWith(packageInfo.version)
!version.stdout.trim().startsWith(nativeApp.version)
) {
throw new Error(
`Native --version check failed (status ${version.status}): ${version.stdout}${version.stderr}`,
Expand Down
18 changes: 7 additions & 11 deletions test/release-workflow.test.mts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { execFileSync } from 'node:child_process'
import {
mkdtempSync,
readFileSync,
rmSync,
writeFileSync,
} from 'node:fs'
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import path from 'node:path'

Expand Down Expand Up @@ -153,9 +148,7 @@ describe('v1 release workflow contract', () => {
const stage = workflow.jobs.publish.steps.find(
step => step.name === 'Stage release packages',
)
const parser = stage?.run
?.split("<<'NODE'\n")[1]
?.split('\nNODE')[0]
const parser = stage?.run?.split("<<'NODE'\n")[1]?.split('\nNODE')[0]
expect(parser).toBeDefined()

const directory = mkdtempSync(path.join(tmpdir(), 'npm-stage-output-'))
Expand Down Expand Up @@ -221,7 +214,9 @@ describe('v1 release workflow contract', () => {
expect(checkIndex).toBeGreaterThanOrEqual(0)
expect(finalizeIndex).toBeGreaterThan(checkIndex)
expect(finalize?.run).toContain('make_latest=false')
expect(finalize?.run).toContain('gh release view "${TAG}" --json databaseId')
expect(finalize?.run).toContain(
'gh release view "${TAG}" --json databaseId',
)
expect(finalize?.run).not.toContain('releases/tags/${TAG}')
})

Expand Down Expand Up @@ -262,7 +257,8 @@ describe('v1 release workflow contract', () => {
const manifest = JSON.parse(
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
) as { publishConfig?: { tag?: string }; version?: string }
expect(manifest.version).toMatch(/^2\.1\.0-rc\.\d+$/u)
// The stable v1 lane and the 2.1 prerelease lane both write this version.
expect(manifest.version).toMatch(/^(?:1\.\d+\.\d+|2\.1\.0-rc\.\d+)$/u)
expect(manifest.publishConfig?.tag).toBe('rc-2.1.0')
expect(workflow.on.workflow_dispatch.inputs['release-major']?.default).toBe(
'1',
Expand Down
Loading