Skip to content

Commit 25de10e

Browse files
committed
Continuing
1 parent 008071b commit 25de10e

File tree

2 files changed

+48
-4
lines changed

2 files changed

+48
-4
lines changed

.github/scripts/listPrefix.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php declare(strict_types = 1);
2+
3+
require_once __DIR__ . '/../../vendor/autoload.php';
4+
5+
$iterator = new RecursiveDirectoryIterator($argv[1] ?? __DIR__);
6+
$iterator->setFlags(RecursiveDirectoryIterator::SKIP_DOTS);
7+
$files = new RecursiveIteratorIterator($iterator);
8+
9+
$locations = [];
10+
foreach ($files as $file) {
11+
$path = $file->getPathname();
12+
if ($file->getExtension() !== 'php') {
13+
continue;
14+
}
15+
$contents = file_get_contents($path);
16+
$lines = explode("\n", $contents);
17+
foreach ($lines as $i => $line) {
18+
if (!str_contains($line, '_PHPStan_checksum')) {
19+
continue;
20+
}
21+
$trimmedPath = substr($path, strlen('/Users/ondrej/Downloads/phar-git/'));
22+
$locations[] = $trimmedPath . ':' . ($i + 1);
23+
}
24+
}
25+
sort($locations);
26+
echo implode("\n", $locations);
27+
echo "\n";

.github/workflows/phar.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,29 @@ jobs:
246246
with:
247247
name: phar-file-checksum
248248

249-
- name: "New checksum"
250-
run: echo $(md5sum phpstan.phar | cut -d' ' -f1)
249+
- name: "Install PHP"
250+
uses: "shivammathur/setup-php@v2"
251+
with:
252+
coverage: "none"
253+
php-version: "8.1"
254+
255+
- name: "Install dependencies"
256+
run: "composer install --no-interaction --no-progress"
257+
258+
- name: "Extract old phpstan.phar"
259+
run: "php compiler/build/box.phar extract phar-file-checksum/phpstan.phar phar-old"
260+
261+
- name: "Extract new phpstan.phar"
262+
run: "php compiler/build/box.phar extract phpstan.phar phar-new"
263+
264+
- name: "List prefix locations in old PHAR"
265+
run: "php .github/scripts/listPrefix.php ${{ github.workspace }}/phar-old > phar-old.txt"
251266

252-
- name: "Old checksum"
253-
run: echo $(md5sum phar-file-checksum/phpstan.phar | cut -d' ' -f1)
267+
- name: "List prefix locations in new PHAR"
268+
run: "php .github/scripts/listPrefix.php ${{ github.workspace }}/phar-new > phar-new.txt"
254269

270+
- name: "Diff locations"
271+
run: "diff -u phar-old.txt phar-new.txt"
255272

256273
commit:
257274
name: "Commit PHAR"

0 commit comments

Comments
 (0)