commit compras2 2711
tests / ci (push) Waiting to run

This commit is contained in:
2026-11-27 18:11:02 +02:00
parent e709d900d1
commit 930064269e
74 changed files with 7506 additions and 40 deletions
+74 -3
View File
@@ -83,6 +83,68 @@ try {
if (in_array('--dossier-focused', $argv, true)) {
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/ImportDossierTest.php', 'tests/Feature/ImportLandedCostsTest.php', 'tests/Feature/OperationalHealthTest.php', 'tests/Feature/SupplyPlanningTest.php']];
}
if (in_array('--bank-support-focused', $argv, true)) {
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/ImportBankSupportTest.php', 'tests/Feature/ImportDossierTest.php', 'tests/Feature/ImportLandedCostsTest.php', 'tests/Feature/SupplyPlanningTest.php']];
}
if (in_array('--legal-focused', $argv, true)) {
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/ImportLegalRulesTest.php', 'tests/Feature/ImportTariffCodesTest.php',
'tests/Feature/ImportReadinessTest.php', 'tests/Feature/ImportBankSupportTest.php', 'tests/Feature/OperationalHealthTest.php', 'tests/Feature/ImportDossierTest.php']];
}
if (in_array('--legal-amounts-focused', $argv, true)) {
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/ImportLegalEstimatesTest.php', 'tests/Feature/ImportLegalRulesTest.php',
'tests/Feature/ImportEstimatesTest.php', 'tests/Feature/ImportEstimatePlanTest.php', 'tests/Feature/InternalRequisitionCandidateTest.php', 'tests/Feature/RequisitionApprovalLevelsTest.php']];
}
if (in_array('--capital-focused', $argv, true)) {
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/CapitalRegisterTest.php', 'tests/Feature/PurchaseAwardOrderTest.php',
'--filter=capital|register|line destination|submitted requisitions|confirmed import classifications|partial native order retains']];
}
if (in_array('--capital-concurrency', $argv, true)) {
$commands = [[PHP_BINARY, 'tests/Concurrency/quotation-exchange-worker.php', $database, 'migrate'],
[PHP_BINARY, 'tests/Concurrency/import-dossier-worker.php', $database, 'race-capital']];
}
if (in_array('--legal-concurrency', $argv, true)) {
$commands = [[PHP_BINARY, 'tests/Concurrency/quotation-exchange-worker.php', $database, 'migrate'],
[PHP_BINARY, 'tests/Concurrency/import-dossier-worker.php', $database, 'race-legal']];
}
if (in_array('--legal-amount-concurrency', $argv, true)) {
$commands = [[PHP_BINARY, 'tests/Concurrency/quotation-exchange-worker.php', $database, 'migrate'],
[PHP_BINARY, 'tests/Concurrency/import-dossier-worker.php', $database, 'race-legal-amount']];
}
if (in_array('--legal-recovery', $argv, true)) {
$commands = [[PHP_BINARY, 'tests/Concurrency/quotation-exchange-worker.php', $database, 'migrate'],
[PHP_BINARY, 'tests/Concurrency/budget-distribution-recovery-worker.php', $database, 'import-legal']];
}
if (in_array('--legal-amount-recovery', $argv, true)) {
$commands = [[PHP_BINARY, 'tests/Concurrency/quotation-exchange-worker.php', $database, 'migrate'],
[PHP_BINARY, 'tests/Concurrency/budget-distribution-recovery-worker.php', $database, 'import-legal-amount']];
}
if (in_array('--legal-corpus', $argv, true)) {
$corpusArguments = array_values(array_filter($argv, fn ($value) => str_starts_with($value, '--legal-corpus-root=')));
if (count($corpusArguments) !== 1) {
throw new InvalidArgumentException('Indique exactamente uma pasta de legislação partilhada.');
}
$commands = [[PHP_BINARY, 'tests/Concurrency/quotation-exchange-worker.php', $database, 'migrate'],
[PHP_BINARY, 'tests/Concurrency/import-legal-corpus-worker.php', $database, 'corpus', substr($corpusArguments[0], strlen('--legal-corpus-root='))]];
}
if (in_array('--legal-http', $argv, true) || in_array('--legal-native-review', $argv, true)) {
$values = [];
foreach (['--legal-corpus-root=', '--legal-http-candidate=', '--legal-http-manifest='] as $prefix) {
$matches = array_values(array_filter($argv, fn ($value) => str_starts_with($value, $prefix)));
if (count($matches) !== 1) {
throw new InvalidArgumentException('Indique uma pasta de fontes e uma candidata privada com o seu manifesto validado.');
}
$values[] = substr($matches[0], strlen($prefix));
}
$commands = [[PHP_BINARY, 'tests/Concurrency/quotation-exchange-worker.php', $database, 'migrate'],
[PHP_BINARY, 'tests/Concurrency/import-legal-http-worker.php', $database, in_array('--legal-native-review', $argv, true) ? 'legal-review' : 'legal-http', ...$values]];
}
if (in_array('--bank-support-native-only', $argv, true)) {
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/ImportBankSupportTest.php']];
}
if (in_array('--bank-support-concurrency', $argv, true)) {
$commands = [[PHP_BINARY, 'tests/Concurrency/quotation-exchange-worker.php', $database, 'migrate'],
[PHP_BINARY, 'tests/Concurrency/import-dossier-worker.php', $database, 'race-bank']];
}
if (in_array('--dossier-concurrency', $argv, true)) {
$commands = [[PHP_BINARY, 'tests/Concurrency/quotation-exchange-worker.php', $database, 'migrate'],
[PHP_BINARY, 'tests/Concurrency/import-dossier-worker.php', $database, 'race-dossier']];
@@ -118,6 +180,10 @@ try {
$commands = [[PHP_BINARY, 'tests/Concurrency/quotation-exchange-worker.php', $database, 'migrate'],
[PHP_BINARY, 'tests/Concurrency/budget-distribution-recovery-worker.php', $database, 'import-estimates']];
}
if (in_array('--bank-support-recovery', $argv, true)) {
$commands = [[PHP_BINARY, 'tests/Concurrency/quotation-exchange-worker.php', $database, 'migrate'],
[PHP_BINARY, 'tests/Concurrency/budget-distribution-recovery-worker.php', $database, 'import-bank-support']];
}
}
if ($orderPartsMode) {
$environment['COMMON_BUDGET_PATH'] = 'C:/laragon/www/sgf-tempo/packages/budget-control';
@@ -218,9 +284,14 @@ try {
throw new LogicException('Each Pest kernel must use its own disposable PostgreSQL database.');
}
foreach ($commands as $command) {
$process = new Process($command, dirname(__DIR__), $environment, timeout: 180);
$process->run();
echo $process->getOutput();
$nativeReview = ($command[3] ?? '') === 'legal-review';
$process = new Process($command, dirname(__DIR__), $environment, timeout: $nativeReview ? 3660 : 180);
$process->run($nativeReview ? function ($type, $buffer) {
echo $buffer;
} : null);
if (! $nativeReview) {
echo $process->getOutput();
}
if (! $process->isSuccessful()) {
echo $process->getErrorOutput();
throw new RuntimeException('Validação PostgreSQL não aprovada.');