32 lines
1.3 KiB
PHP
32 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\Deployment;
|
|
|
|
use Tests\TestCase;
|
|
|
|
class ReleaseAncestryManifestTest extends TestCase
|
|
{
|
|
public function test_release_script_only_accepts_reviewed_squashed_integrations(): void
|
|
{
|
|
$manifestPath = base_path('deploy/release-ancestry.json');
|
|
$manifest = json_decode((string) file_get_contents($manifestPath), true, 32, JSON_THROW_ON_ERROR);
|
|
$entries = $manifest['squashed_integrations'] ?? [];
|
|
|
|
$this->assertIsArray($entries);
|
|
$this->assertNotEmpty($entries);
|
|
foreach ($entries as $entry) {
|
|
$this->assertMatchesRegularExpression('/^[0-9a-f]{40}$/', (string) ($entry['previous_sha'] ?? ''));
|
|
$this->assertMatchesRegularExpression('/^[0-9a-f]{40}$/', (string) ($entry['integrated_sha'] ?? ''));
|
|
$this->assertNotSame('', trim((string) ($entry['reason'] ?? '')));
|
|
}
|
|
|
|
$script = (string) file_get_contents(base_path('scripts/deploy-from-workstation.ps1'));
|
|
$this->assertStringContainsString('deploy/release-ancestry.json', $script);
|
|
$this->assertStringContainsString('$ancestryManifest.squashed_integrations', $script);
|
|
$this->assertStringContainsString(
|
|
'git merge-base --is-ancestor $entry.integrated_sha $ReleaseSha',
|
|
$script,
|
|
);
|
|
}
|
|
}
|