Skip to content

Commit

Permalink
Report changes to output vs. latest release in CI integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lkrms committed Jan 7, 2025
1 parent a68e157 commit 0a5dac2
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,39 @@ jobs:
uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.artifact_name }}
path: ~

- name: Run pretty-php
id: run-pretty-php
env:
artifact_path: ${{ needs.build.outputs.artifact_path }}
repository: ${{ matrix.repository }}
run: |
php "$artifact_path" --print-config ${{ matrix.args }} | tee .prettyphp
php "$artifact_path" --quiet --timers || { status=$? && [[ $status -eq 4 ]] || (exit $status); }
php ~/"$artifact_path" --print-config ${{ matrix.args }} | tee .prettyphp
php ~/"$artifact_path" --quiet --timers ||
{ status=$? && [[ $status -eq 4 ]] || (exit $status); }
printf '\nComparing with output from latest release\n\n'
latest_path=~/pretty-php-latest.phar
diff_path=~/${repository%/*}.diff
: >"$diff_path"
shopt -s extglob
curl -fLo "$latest_path" https://github.com/lkrms/pretty-php/releases/latest/download/pretty-php.phar &&
git add !(.prettyphp) &&
git restore -s HEAD . &&
{ php "$latest_path" --quiet --timers ||
{ status=$? && [[ $status -eq 4 ]] || (exit $status); }; } &&
git diff -R --exit-code | tee "$diff_path" &&
printf '\nNo differences found\n' || true
printf 'diff_name=%s\n' "${diff_path##*/}" >>"$GITHUB_OUTPUT"
printf 'diff_path=%s\n' "$([[ ! -s $diff_path ]] || printf '%s\n' "$diff_path")" >>"$GITHUB_OUTPUT"
- name: Upload diff artifact
if: ${{ !cancelled() && !failure() && steps.run-pretty-php.outputs.diff_path != '' }}
uses: actions/upload-artifact@v4
with:
name: ${{ steps.run-pretty-php.outputs.diff_name }}
path: ${{ steps.run-pretty-php.outputs.diff_path }}

0 comments on commit 0a5dac2

Please sign in to comment.