( source: string, packages: Package[] )
| 374 | |
| 375 | // Validate all packages for a source |
| 376 | async function validateSource( |
| 377 | source: string, |
| 378 | packages: Package[] |
| 379 | ): Promise<ValidationResult> { |
| 380 | console.log(`\n${'='.repeat(60)}`); |
| 381 | console.log(`Validating ${source} (${packages.length} packages)`); |
| 382 | console.log('='.repeat(60)); |
| 383 | |
| 384 | // Skip Windows-only sources |
| 385 | if (SKIP_SOURCES.has(source)) { |
| 386 | console.log(` ⏭️ Skipped (Windows-only, cannot validate in Linux Docker)`); |
| 387 | return { |
| 388 | source, |
| 389 | valid: 0, |
| 390 | total: packages.length, |
| 391 | failed: 0, |
| 392 | skipped: true, |
| 393 | failedPackages: [], |
| 394 | }; |
| 395 | } |
| 396 | |
| 397 | const config = CONTAINERS[source]; |
| 398 | let valid = 0; |
| 399 | const failedPackages: FailedPackage[] = []; |
| 400 | |
| 401 | // API-based sources that don't need Docker |
| 402 | const apiSources = new Set(['script', 'aur', 'flatpak', 'snap', 'homebrew']); |
| 403 | |
| 404 | // Start container (except for API-based sources) |
| 405 | if (!apiSources.has(source)) { |
| 406 | if (!startContainer(config)) { |
| 407 | return { |
| 408 | source, |
| 409 | valid: 0, |
| 410 | total: packages.length, |
| 411 | failed: packages.length, |
| 412 | skipped: false, |
| 413 | failedPackages: packages.map(pkg => ({ app: pkg.app, identifier: pkg.identifier })), |
| 414 | }; |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | // Validate each package |
| 419 | for (const pkg of packages) { |
| 420 | const isValid = await validatePackage(source, pkg.identifier, pkg, config?.name || ''); |
| 421 | |
| 422 | if (isValid) { |
| 423 | console.log(` ✓ ${pkg.identifier}`); |
| 424 | valid++; |
| 425 | } else { |
| 426 | console.log(` ✗ ${pkg.identifier}`); |
| 427 | failedPackages.push({ app: pkg.app, identifier: pkg.identifier }); |
| 428 | } |
| 429 | } |
| 430 | |
| 431 | // Cleanup (skip API-based sources) |
| 432 | if (!apiSources.has(source) && config) { |
| 433 | stopContainer(config.name); |
no test coverage detected