mirror of
https://github.com/vercel/workflow.git
synced 2026-09-14 19:59:43 +08:00
2bb4164c9c
* Add Platformatic World to worlds-manifest.json Signed-off-by: marcopiraccini <marco.piraccini@gmail.com> * ci fixup Signed-off-by: marcopiraccini <marco.piraccini@gmail.com> * ci: pin platformatic world image to 0.8.1 and harden community-world runner Signed-off-by: marcopiraccini <marco.piraccini@gmail.com> * platforamtic-world version Signed-off-by: marcopiraccini <marco.piraccini@gmail.com> * ci: wire generic docker service-type into community benchmark workflow The shared community-worlds matrix now emits service-type "docker" for any world with non-builtin or multiple services (e.g. Platformatic, which needs postgres + the platformatic/workflow image). tests.yml's e2e-community path already handles it, but benchmarks.yml's benchmark-community path (label-gated, non-blocking) did not — so a "community-benchmarks" run would start no services and fail. Mirror the e2e "Start Docker services" step, package-version pin, and docker cleanup into benchmark-community-world.yml, and pass `services`/`version` through from benchmarks.yml. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Signed-off-by: marcopiraccini <marco.piraccini@gmail.com> Co-authored-by: Pranay Prakash <pranay.gp@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
79 lines
2.2 KiB
JavaScript
79 lines
2.2 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Generates a GitHub Actions matrix for community world testing.
|
|
* Reads from worlds-manifest.json and filters to testable community worlds.
|
|
*
|
|
* Usage: node scripts/create-community-worlds-matrix.mjs
|
|
*
|
|
* Output format (JSON):
|
|
* {
|
|
* "world": [
|
|
* {
|
|
* "id": "starter",
|
|
* "name": "Starter",
|
|
* "package": "@workflow-worlds/starter",
|
|
* "service-type": "none",
|
|
* "env-vars": "{\"WORKFLOW_TARGET_WORLD\":\"@workflow-worlds/starter\"}"
|
|
* },
|
|
* ...
|
|
* ]
|
|
* }
|
|
*/
|
|
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const rootDir = path.join(__dirname, '..');
|
|
|
|
// Read the manifest
|
|
const manifestPath = path.join(rootDir, 'worlds-manifest.json');
|
|
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
|
|
|
|
// Filter to community worlds that can be tested in CI
|
|
const testableWorlds = manifest.worlds.filter((world) => {
|
|
// Only community worlds
|
|
if (world.type !== 'community') return false;
|
|
|
|
// Skip worlds that require external credentials (e.g., Jazz needs API keys)
|
|
if (world.requiresCredentials) return false;
|
|
|
|
return true;
|
|
});
|
|
|
|
// Build the matrix
|
|
const matrix = {
|
|
world: testableWorlds.map((world) => {
|
|
// Determine service type based on services array.
|
|
// `mongodb` and `redis` have dedicated single-service CI steps; anything
|
|
// else (or any multi-service world) goes through the generic `docker`
|
|
// path driven by the manifest's `services` array.
|
|
let serviceType = 'none';
|
|
if (world.services && world.services.length > 0) {
|
|
if (world.services.length === 1) {
|
|
const serviceName = world.services[0].name;
|
|
serviceType = ['mongodb', 'redis'].includes(serviceName)
|
|
? serviceName
|
|
: 'docker';
|
|
} else {
|
|
serviceType = 'docker';
|
|
}
|
|
}
|
|
|
|
return {
|
|
id: world.id,
|
|
name: world.name,
|
|
package: world.package,
|
|
version: world.version || '',
|
|
'service-type': serviceType,
|
|
'env-vars': JSON.stringify(world.env || {}),
|
|
services: JSON.stringify(world.services || []),
|
|
};
|
|
}),
|
|
};
|
|
|
|
// Output JSON for GitHub Actions
|
|
console.log(JSON.stringify(matrix));
|