Skip to content

RegexArrayShapeMatcher: fix nested capturing counting #14660

RegexArrayShapeMatcher: fix nested capturing counting

RegexArrayShapeMatcher: fix nested capturing counting #14660

Workflow file for this run

# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
name: "Compile PHAR"
on:
pull_request:
push:
branches:
- "1.11.x"
tags:
- '1.11.*'
concurrency:
group: phar-${{ github.ref }} # will be canceled on subsequent pushes in both branches and pull requests
cancel-in-progress: true
jobs:
compiler-tests:
name: "Compiler Tests"
runs-on: "ubuntu-latest"
timeout-minutes: 60
outputs:
checksum: ${{ steps.checksum.outputs.md5 }}
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "8.1"
extensions: mbstring, intl
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress"
- name: "Install compiler dependencies"
run: "composer install --no-interaction --no-progress --working-dir=compiler"
- name: "Compiler tests"
working-directory: "compiler"
run: "vendor/bin/phpunit -c tests/phpunit.xml tests"
- name: "Compiler PHPStan"
working-directory: "compiler"
run: "../bin/phpstan analyse -l 8 src tests"
- name: "Prepare for PHAR compilation"
working-directory: "compiler"
run: "php bin/prepare"
- name: "Compile PHAR"
working-directory: "compiler/build"
run: "php box.phar compile --no-parallel"
- uses: actions/upload-artifact@v4
with:
name: phar-file
path: tmp/phpstan.phar
- name: "Run PHAR"
working-directory: "compiler"
run: "../tmp/phpstan.phar list"
- name: "Delete PHAR"
run: "rm tmp/phpstan.phar"
- name: "Set autoloader suffix"
run: "composer config autoloader-suffix PHPStanChecksum"
- name: "Composer dump"
run: "composer install --no-interaction --no-progress"
env:
COMPOSER_ROOT_VERSION: "1.11.x-dev"
- name: "Compile PHAR for checksum"
working-directory: "compiler/build"
run: "php box.phar compile --no-parallel"
env:
PHAR_CHECKSUM: "1"
COMPOSER_ROOT_VERSION: "1.11.x-dev"
- name: "Re-sign PHAR"
run: "php compiler/build/resign.php tmp/phpstan.phar"
- name: "Unset autoloader suffix"
run: "composer config autoloader-suffix --unset"
- name: "Save checksum"
id: "checksum"
run: echo "md5=$(md5sum tmp/phpstan.phar | cut -d' ' -f1)" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
with:
name: phar-file-checksum
path: tmp/phpstan.phar
- name: "Delete checksum PHAR"
run: "rm tmp/phpstan.phar"
integration-tests:
if: github.event_name == 'pull_request'
needs: compiler-tests
uses: phpstan/phpstan/.github/workflows/[email protected]
with:
ref: 1.11.x
phar-checksum: ${{needs.compiler-tests.outputs.checksum}}
extension-tests:
if: github.event_name == 'pull_request'
needs: compiler-tests
uses: phpstan/phpstan/.github/workflows/[email protected]
with:
ref: 1.11.x
phar-checksum: ${{needs.compiler-tests.outputs.checksum}}
other-tests:
if: github.event_name == 'pull_request'
needs: compiler-tests
uses: phpstan/phpstan/.github/workflows/[email protected]
with:
ref: 1.11.x
phar-checksum: ${{needs.compiler-tests.outputs.checksum}}
commit:
name: "Commit PHAR"
if: "github.repository_owner == 'phpstan' && (github.ref == 'refs/heads/1.11.x' || startsWith(github.ref, 'refs/tags/'))"
needs: compiler-tests
runs-on: "ubuntu-latest"
timeout-minutes: 60
steps:
-
name: Import GPG key
id: import-gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PHPSTANBOT_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PHPSTANBOT_KEY_PASSPHRASE }}
git_config_global: true
git_user_signingkey: true
git_commit_gpgsign: true
- name: "Checkout phpstan-dist"
uses: actions/checkout@v4
with:
repository: phpstan/phpstan
path: phpstan-dist
token: ${{ secrets.PHPSTAN_BOT_TOKEN }}
ref: 1.11.x
- name: "Get previous pushed dist commit"
id: previous-commit
working-directory: phpstan-dist
run: echo "sha=$(sed -n '2p' .phar-checksum)" >> $GITHUB_OUTPUT
- name: "Checkout phpstan-src"
uses: actions/checkout@v4
with:
fetch-depth: 0
path: phpstan-src
- name: "Get Git log"
id: git-log
working-directory: phpstan-src
run: |
echo "log<<MESSAGE" >> $GITHUB_OUTPUT
echo "$(git log ${{ steps.previous-commit.outputs.sha }}..${{ github.event.after }} --reverse --pretty='https://github.com/phpstan/phpstan-src/commit/%H %s')" >> $GITHUB_OUTPUT
echo 'MESSAGE' >> $GITHUB_OUTPUT
- name: "Get short phpstan-src SHA"
id: short-src-sha
working-directory: phpstan-src
run: echo "sha=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT
- name: "Check PHAR checksum"
id: checksum-difference
working-directory: phpstan-dist
run: |
checksum=${{needs.compiler-tests.outputs.checksum}}
if [[ $(head -n 1 .phar-checksum) != "$checksum" ]]; then
echo "result=different" >> $GITHUB_OUTPUT
else
echo "result=same" >> $GITHUB_OUTPUT
fi
- name: "Download phpstan.phar"
uses: actions/download-artifact@v4
with:
name: phar-file
- name: "mv PHAR"
run: mv phpstan.phar phpstan-dist/phpstan.phar
- name: "chmod PHAR"
run: chmod 755 phpstan-dist/phpstan.phar
- name: "Update checksum"
run: |
echo ${{needs.compiler-tests.outputs.checksum}} > phpstan-dist/.phar-checksum
echo ${{ github.event.head_commit.id }} >> phpstan-dist/.phar-checksum
- name: "Sign PHAR"
working-directory: phpstan-dist
run: rm phpstan.phar.asc && gpg --command-fd 0 --pinentry-mode loopback -u "$GPG_ID" --batch --detach-sign --armor --output phpstan.phar.asc phpstan.phar
env:
GPG_ID: ${{ steps.import-gpg.outputs.fingerprint }}
- name: "Verify PHAR"
working-directory: phpstan-dist
run: "gpg --verify phpstan.phar.asc"
- name: "Install lucky_commit"
uses: baptiste0928/cargo-install@v3
with:
crate: lucky_commit
args: --no-default-features
- name: "Commit PHAR - development"
if: "!startsWith(github.ref, 'refs/tags/') && steps.checksum-difference.outputs.result == 'different'"
working-directory: phpstan-dist
env:
INPUT_LOG: ${{ steps.git-log.outputs.log }}
run: |
git config --global user.name "phpstan-bot"
git config --global user.email "[email protected]"
git add .
git commit --gpg-sign -m "Updated PHPStan to commit ${{ github.event.after }}" -m "$INPUT_LOG" --author "phpstan-bot <[email protected]>"
lucky_commit ${{ steps.short-src-sha.outputs.sha }}
git push
- name: "Commit PHAR - tag"
if: "startsWith(github.ref, 'refs/tags/')"
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_user_name: "phpstan-bot"
commit_user_email: "[email protected]"
commit_author: "phpstan-bot <[email protected]>"
commit_options: "--gpg-sign"
repository: phpstan-dist
commit_message: "PHPStan ${{github.ref_name}}"
tagging_message: ${{github.ref_name}}