Update generated code #4771
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Checks | |
on: pull_request | |
jobs: | |
composer-normalize: | |
name: Composer Normalize | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.1 | |
coverage: none | |
tools: composer-normalize | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Normalize | |
run: | | |
ok=0 | |
echo ::group::Root | |
composer-normalize --dry-run | |
echo ::endgroup:: | |
for COMPONENT in $(find src -maxdepth 4 -type f -name composer.json | sort) | |
do | |
echo ::group::$COMPONENT | |
localExit=0 | |
composer-normalize $COMPONENT --dry-run || localExit=1 | |
ok=$(( $localExit || $ok )) | |
echo ::endgroup:: | |
if [ $localExit -ne 0 ]; then | |
echo "::error::$COMPONENT failed" | |
fi | |
done | |
exit $ok | |
output-generated: | |
name: Generated output not changed | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.1 | |
coverage: none | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache Composer | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: composer-${{ github.sha }} | |
restore-keys: composer- | |
- name: Cache PhpCsFixer | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.cache/php-cs-fixer/ | |
.cache/generate/ | |
key: generate-${{ github.sha }} | |
restore-keys: generate- | |
- name: Download | |
run: | | |
composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable | |
- name: Regenerate | |
run: | | |
./generate --all | |
- name: Assert up-to-date | |
run: | | |
if [ -n "$(git status src --porcelain)" ]; then | |
echo "" | |
echo "###################################################" | |
echo "###################################################" | |
echo "#" | |
echo "# One of two things are wrong here:" | |
echo "# 1) You have modified generated code." | |
echo "# 2) You have modified the code generator and not regenerated the code." | |
echo "#" | |
echo "# You may solve both problems by running './generate --all'" | |
echo "#" | |
echo "###################################################" | |
echo "###################################################" | |
echo "" | |
git diff src | |
exit 1 | |
fi |