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
22 changes: 21 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,29 @@ jobs:
- name: Validate packaged skill without installing dependencies
run: node scripts/package-smoke.mjs

windows-test-portability:
name: Windows test portability
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 22
- name: Install test dependencies
run: npm ci --ignore-scripts
working-directory: archify
- name: Verify Windows-sensitive regression fixtures
run: >-
node --test
--test-name-pattern="Git checkout preserves|clean staging preserves index modes|workflow migration cleanup failure|preview runs from an installed skill"
archify/test/checkout-line-endings.test.mjs
archify/test/clean-skill-staging.test.mjs
archify/test/workflow-migration.test.mjs
archify/test/cli.test.mjs

deploy-pages:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [test, webm-artifact, zip-freshness, published-update-manifest, package-smoke]
needs: [test, webm-artifact, zip-freshness, published-update-manifest, package-smoke, windows-test-portability]
runs-on: ubuntu-latest
concurrency:
group: github-pages
Expand Down
6 changes: 4 additions & 2 deletions archify/test/checkout-line-endings.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,24 @@ for (const autocrlf of ['true', 'input', 'false']) {
const fixture = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-checkout-eol-'));
const source = path.join(fixture, 'source');
const checkout = path.join(fixture, 'checkout');
const emptyConfig = path.join(fixture, 'empty-git-config');
// Ignore caller Git configuration, attributes, repository paths, and signing hooks.
const env = Object.fromEntries(Object.entries(process.env).filter(([key]) => !key.startsWith('GIT_')));
Object.assign(env, {
GIT_CONFIG_NOSYSTEM: '1',
GIT_CONFIG_GLOBAL: os.devNull,
GIT_CONFIG_GLOBAL: emptyConfig,
GIT_ATTR_NOSYSTEM: '1',
});
const runGit = (cwd, args) => {
const result = spawnSync('git', ['-c', `core.attributesFile=${os.devNull}`, ...args], {
const result = spawnSync('git', ['-c', `core.attributesFile=${emptyConfig}`, ...args], {
cwd, env, timeout: 30_000,
});
assert.equal(result.status, 0, `git ${args.join(' ')}: ${result.error || result.stderr}`);
return result.stdout;
};

try {
fs.writeFileSync(emptyConfig, '');
fs.mkdirSync(source);
runGit(source, ['init', '--quiet', '--template=']);
runGit(source, ['config', 'core.autocrlf', 'false']);
Expand Down
21 changes: 17 additions & 4 deletions archify/test/clean-skill-staging.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,30 @@ test('clean staging rejects byte-identical but incomplete repository and package
}
});

test('clean staging preserves index modes and strips repository-only package metadata', () => {
test('clean staging preserves index modes and strips repository-only package metadata', (t) => {
const root = repositoryFixture();
const destination = path.join(root, 'staged-skill');
try {
write(root, 'archify/bin/executable.mjs', '#!/usr/bin/env node\n', 0o755);
write(root, 'archify/runtime/test/required.dat', 'runtime fixture\n');
write(root, 'archify/bin/executable.mjs', '#!/usr/bin/env node\n', 0o644);
write(root, 'archify/runtime/test/required.dat', 'runtime fixture\n', 0o755);
git(root, ['add', 'archify']);
// Index modes must win over working-tree permissions, including on Windows.
git(root, ['update-index', '--chmod=+x', 'archify/bin/executable.mjs']);
git(root, ['update-index', '--chmod=-x', 'archify/runtime/test/required.dat']);
const chmod = t.mock.method(fs, 'chmodSync');

stageCleanSkill({ repoRoot: root, destination });

assert.equal(fs.statSync(path.join(destination, 'bin', 'executable.mjs')).mode & 0o777, 0o755);
const executable = path.join(destination, 'bin', 'executable.mjs');
const runtimeFixture = path.join(destination, 'runtime', 'test', 'required.dat');
const appliedModes = new Map(chmod.mock.calls.map(({ arguments: args }) => args));
assert.equal(appliedModes.get(executable), 0o755);
assert.equal(appliedModes.get(runtimeFixture), 0o644);
// Windows chmod cannot expose Unix executable bits through stat.
if (process.platform !== 'win32') {
assert.equal(fs.statSync(executable).mode & 0o777, 0o755);
assert.equal(fs.statSync(runtimeFixture).mode & 0o777, 0o644);
}
assert.equal(fs.existsSync(path.join(destination, 'test')), false);
assert.equal(
fs.readFileSync(path.join(destination, 'runtime', 'test', 'required.dat'), 'utf8'),
Expand Down
11 changes: 8 additions & 3 deletions archify/test/cli.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,14 @@ test('cli: preview runs from an installed skill without node_modules and exits c
const installedCli = path.join(installedRoot, 'bin/archify.mjs');
const input = path.join(installedRoot, 'examples/web-app.architecture.json');
const output = path.join(tmp, 'installed-preview.html');
const child = spawn(process.execPath, [installedCli, 'preview', 'architecture', input, output, '--quality', 'showcase', '--no-open'], {
// Windows child.kill() terminates immediately, bypassing the signal handler.
const signalRelay = process.platform === 'win32'
? ['--import', 'data:text/javascript,process.once("message", () => { process.disconnect(); process.emit("SIGTERM"); });']
: [];
const child = spawn(process.execPath, [...signalRelay, installedCli, 'preview', 'architecture', input, output, '--quality', 'showcase', '--no-open'], {
cwd: installedRoot,
encoding: 'utf8',
stdio: ['ignore', 'pipe', 'pipe'],
stdio: ['ignore', 'pipe', 'pipe', ...(process.platform === 'win32' ? ['ipc'] : [])],
});
let stdout = '';
let stderr = '';
Expand All @@ -510,7 +514,8 @@ test('cli: preview runs from an installed skill without node_modules and exits c
assert.equal(state.revision, 1);
assert.equal(fs.existsSync(output), true);

child.kill('SIGTERM');
if (process.platform === 'win32') child.send('stop');
else child.kill('SIGTERM');
const exit = await new Promise((resolve) => child.once('close', (code, signal) => resolve({ code, signal })));
assert.deepEqual(exit, { code: 0, signal: null });
assert.match(stdout, /stopping preview/);
Expand Down
2 changes: 1 addition & 1 deletion archify/test/release-package-gates.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ test('GitHub Pages deploys docs only after every repository gate succeeds', () =
const workflow = fs.readFileSync(path.join(repoRoot, '.github', 'workflows', 'ci.yml'), 'utf8');
const job = workflowJob(workflow, 'deploy-pages');
assert.match(job, /if: github\.event_name == 'push' && github\.ref == 'refs\/heads\/main'/);
assert.match(job, /needs: \[test, webm-artifact, zip-freshness, published-update-manifest, package-smoke\]/);
assert.match(job, /needs: \[test, webm-artifact, zip-freshness, published-update-manifest, package-smoke, windows-test-portability\]/);
assert.match(job, /pages: write/);
assert.match(job, /id-token: write/);
assert.match(job, /repos\/\$\{GITHUB_REPOSITORY\}\/git\/ref\/heads\/main/);
Expand Down
4 changes: 2 additions & 2 deletions archify/test/workflow-migration.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { createHash } from 'node:crypto';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { fileURLToPath, pathToFileURL } from 'node:url';
import {
createHorizontalRankMapper,
migrateWorkflowDocument,
Expand Down Expand Up @@ -33,7 +33,7 @@ function sha256(value) {

function runMigration(source, destination, { importModule, env } = {}) {
return spawnSync(process.execPath, [
...(importModule ? ['--import', importModule] : []),
...(importModule ? ['--import', pathToFileURL(importModule).href] : []),
cli,
'migrate',
'workflow',
Expand Down