fix: align preland root sets with Index
deploy-preland / deploy barbariskatest (push) Skipped
deploy-preland / deploy zoomstage.online (push) Successful in 21s
deploy-preland / deploy zoompixel.online (push) Skipped
deploy-preland / deploy zoompixel.ru (push) Skipped

This commit is contained in:
Panfilov Konstantin committed 2026-10-17 08:36:34 +03:00
1 parent 1b28299a42
commit 729e48dda7
168 files changed
+97 -58

No files matched your search

+30 -23
View File
@@ -1,8 +1,8 @@
<?php
/**
* Наборы примеров Preland должны копироваться с Index без переложения:
* images/demo/<пример>/ и images/demo-N/<пример>/.
* Наборы примеров копируются из Index без переименования и переложения:
* в корне домена лежит `<номер-сета>/`, а в нём flat-файлы Index.
*/
declare(strict_types=1);
@@ -11,12 +11,14 @@ $root = dirname(__DIR__);
$failures = [];
foreach ([
'images/demo/1/source.avif',
'images/demo/1/result.avif',
'images/demo/1/thumb.avif',
'images/demo/5/source_mob.avif',
'images/demo-2/1/source.avif',
'images/demo-2/5/result_mob.avif',
'1/01_desk_1-source.avif',
'1/01_desk_2-result.avif',
'1/01_desk_3-thumb.avif',
'1/05_mob_1-source.avif',
'1/05_mob_2-result.avif',
'1/05_mob_3-thumb.avif',
'2/01_desk_1-source.avif',
'2/05_mob_2-result.avif',
] as $relativePath) {
if (!is_file($root . '/' . $relativePath)) {
$failures[] = "Отсутствует Index-совместимый asset {$relativePath}.";
@@ -24,29 +26,34 @@ foreach ([
}
foreach ([
'images/demo/1/1',
'images/demo/2/1',
] as $legacyPath) {
if (is_dir($root . '/' . $legacyPath)) {
$failures[] = "Не должна оставаться промежуточная группировка {$legacyPath}.";
'images/demo',
'images/demo-2',
] as $obsoletePath) {
if (is_dir($root . '/' . $obsoletePath)) {
$failures[] = "Устаревший каталог {$obsoletePath} не должен оставаться в репозитории.";
}
}
$template = (string) file_get_contents($root . '/template.php');
$examples = (string) file_get_contents($root . '/components/examples.php');
$pathBuilder = "\$demoDirName = 'demo' . (\$indpic === '1' ? '' : '-' . \$indpic);";
if (!str_contains($template, $pathBuilder)
|| !str_contains($examples, $pathBuilder)
|| !str_contains($template, '"/images/{$demoDirName}/1"')
|| !str_contains($examples, '"/images/{$demoDirName}"')) {
$failures[] = 'Template и examples должны строить путь из Index-совместимого имени demo/demo-N.';
foreach ([
[$template, '"/{$indpic}"'],
[$template, '01_desk_1-source.avif'],
[$examples, "sprintf('%02d', \$number)"],
[$examples, "'desk', '1-source'"],
[$examples, "'mob', '3-thumb'"],
] as [$source, $expected]) {
if (!str_contains($source, $expected)) {
$failures[] = "Путь примеров должен использовать корневой flat-формат Index ({$expected}).";
}
}
$workflow = (string) file_get_contents($root . '/.gitea/workflows/deploy.yml');
foreach ([
'"$PRELAND_URL/images/demo/1/source.avif"',
'"$PRELAND_URL/images/demo-2/1/source.avif"',
'"$PRELAND_URL/?indpic=2&nc=$(date +%s)"',
'"$PRELAND_URL/1/01_desk_1-source.avif"',
'"$PRELAND_URL/2/01_desk_1-source.avif"',
'2/01_mob_1-source.avif',
'Remove obsolete demo directories',
] as $requiredStageSmokeCheck) {
if (!str_contains($workflow, $requiredStageSmokeCheck)) {
$failures[] = "Stage-деплой обязан проверять публикацию {$requiredStageSmokeCheck}.";
@@ -62,4 +69,4 @@ if ($failures !== []) {
exit(1);
}
fwrite(STDOUT, "OK: Preland demo layout matches Index\n");
fwrite(STDOUT, "OK: Preland root sets match Index layout\n");