@@ -24,25 +24,25 @@ jobs:
2424 php-version : ${{ matrix.php-versions }}
2525 extensions : none,iconv,dom,curl,mbstring,tokenizer,xml,xmlwriter,simplexml,ctype
2626 coverage : pcov
27-
27+
2828 - name : ♻️ Get composer cache directory
2929 id : composer-cache
3030 shell : bash
3131 run : echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
32-
32+
3333 - name : ♻️ Cache composer dependencies
3434 uses : actions/cache@v4
3535 with :
3636 path : ${{ steps.composer-cache.outputs.dir }}
3737 key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
3838 restore-keys : ${{ runner.os }}-composer-
39-
39+
4040 - name : ⚙️ Install dependencies
4141 shell : bash
4242 run : |
4343 composer install --no-progress --prefer-dist --optimize-autoloader
4444 composer --working-dir=tools install --no-progress --prefer-dist --optimize-autoloader
45-
45+
4646 - name : ♻️ Tools cache
4747 uses : actions/cache@v4
4848 with :
5555 if : matrix.stable
5656 run : composer php-cs-fixer -- --format=checkstyle | tools/vendor/bin/cs2pr
5757
58+ - name : 🔬 Rector
59+ id : rector
60+ if : matrix.stable
61+ run : |
62+ REPORT=$(composer rector -- --output-format json || true)
63+ echo "report<<EOF" >> "$GITHUB_OUTPUT" && echo "$REPORT" >> "$GITHUB_OUTPUT" && echo "EOF" >> "$GITHUB_OUTPUT"
64+
65+ - uses : actions/github-script@v6
66+ if : matrix.stable
67+ with :
68+ script : |
69+ const report = ${{ steps.rector.outputs.report }}
70+
71+ core.startGroup('Rector report')
72+
73+ for(const fileDiff of report.file_diffs) {
74+ const message = fileDiff.diff;
75+
76+ const title = fileDiff.applied_rectors.join(' / ').trim();
77+ const file = fileDiff.file;
78+
79+ // Extract line start and end, and column start and end from fileDiff.diff (diff format)
80+ const diffMeta = fileDiff.diff.match(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/);
81+ if (!diffMeta) {
82+ core.error(`Could not parse diff for file: ${fileDiff.file}`);
83+ continue;
84+ }
85+
86+ const startLine = parseInt(diffMeta[1], 10);
87+ const endLine = startLine + parseInt(diffMeta[2], 10) - 1;
88+ const startColumn = 1;
89+ const endColumn = undefined;
90+
91+ core.error(
92+ message,
93+ {
94+ title,
95+ file,
96+ startLine,
97+ endLine,
98+ startColumn,
99+ endColumn,
100+ },
101+ );
102+ }
103+
104+ core.endGroup();
105+
58106 - name : 🔬 Static analysis
59107 if : matrix.stable
60- run : composer stan -- --error-format=checkstyle | tools/vendor/bin/cs2pr
108+ run : composer stan -- --error-format=github
61109
62110 - name : ♻️ Tests cache
63111 uses : actions/cache@v4
66114 key : ${{ runner.os }}-tests-${{ github.sha }}
67115 restore-keys : |
68116 ${{ runner.os }}-tests-
69-
117+
70118 - name : 🧪 Test
71119 run : composer test:ci
72120
0 commit comments