Skip to content
Open
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
27 changes: 18 additions & 9 deletions .github/scripts/validate-proposals.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ const GATE_FEATURES = {
'🧵': 'cm-threading',
};

// Local path dependencies must be populated before wit-deps packages them.
// Keep this order in sync with .github/workflows/release.yml.
const DEPENDENCY_ORDER = ['random', 'clocks', 'filesystem', 'sockets', 'cli', 'http'];

// Emoji gates carry a variation selector (U+FE0F) inconsistently across
// sources, so compare them without it.
const bare = (gate) => gate.replace(/\uFE0F/g, '');
Expand Down Expand Up @@ -91,6 +95,20 @@ const featureFlags = adoptedFeatureFlags();
const outDir = fs.mkdtempSync(path.join(os.tmpdir(), 'wasi-validate-'));
console.log(`Component Model features: ${featureFlags || '(none adopted)'}`);

// Check wit-deps locks where deps.toml exists, in dependency order so local
// transitive dependencies are populated before their consumers are packaged.
for (const proposal of new Set([...DEPENDENCY_ORDER, ...toValidate])) {
const witDir = `proposals/${proposal}/wit`;
if (!fs.existsSync(`${witDir}/deps.toml`)) continue;

console.log(`::group::Checking ${proposal} dependencies`);
if (!run(`wit-deps -m "${witDir}"/deps.toml -l "${witDir}"/deps.lock -d "${witDir}"/deps lock --check`)) {
console.log(`::error::wit-deps lock check failed for ${proposal}`);
failed = true;
}
console.log('::endgroup::');
}

for (const proposal of toValidate) {
const witDir = ((proposal) => `proposals/${proposal}/wit`)(proposal);
console.log(`::group::Validating ${proposal}`);
Expand All @@ -106,15 +124,6 @@ for (const proposal of toValidate) {
continue;
}

// Check wit-deps lock if deps.toml exists
if (fs.existsSync(`${witDir}/deps.toml`)) {
console.log(' Checking dependencies...');
if (!run(`wit-deps -m "${witDir}"/deps.toml -l "${witDir}"/deps.lock -d "${witDir}"/deps lock --check`)) {
console.log(`::error::wit-deps lock check failed for ${proposal}`);
failed = true;
}
}

// Validate WIT syntax
console.log(' Validating WIT...');
if (!run(`wasm-tools component wit "${witDir}" -o /dev/null`)) {
Expand Down