Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions .github/workflows/test-rector-src.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "Test Rector"

on:
pull_request:
push:
branches:
- "2.3.x"

permissions:
contents: read

jobs:
tests:
name: "Tests"
runs-on: "ubuntu-latest"
timeout-minutes: 30

strategy:
fail-fast: false
matrix:
php-version:
- "8.4"
- "8.5"

steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
with:
egress-policy: audit

- name: "Checkout"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Comment on lines +33 to +34

- name: "Checkout phpstan-src"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: phpstan/phpstan-src
path: phpstan-src
ref: 2.3.x
Comment on lines +36 to +41

- name: "Checkout rector-src"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: rectorphp/rector-src
path: rector-src
ref: main
Comment on lines +43 to +48

- name: "Install PHP"
uses: "shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962" # v2
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
extensions: mbstring, intl
ini-values: zend.assertions=1

- name: "Install phpstan-src dependencies"
working-directory: phpstan-src
run: "composer install --no-interaction --no-progress"

- name: "Copy phpdoc-parser to phpstan-src"
run: |
rm -r phpstan-src/vendor/phpstan/phpdoc-parser/src
cp -r src/ phpstan-src/vendor/phpstan/phpdoc-parser/src

- name: "Install compiler dependencies"
working-directory: phpstan-src/compiler
run: "composer install --no-interaction --no-progress"

- name: "Prepare for PHAR compilation"
working-directory: phpstan-src/compiler
run: "php bin/prepare"

- name: "Dump autoloader one more time for attributes"
working-directory: phpstan-src
run: "composer dump"

- name: "Install Box dependencies"
working-directory: phpstan-src/compiler/box
run: "composer install --no-interaction --no-progress"

- name: "Compile PHAR"
working-directory: phpstan-src/compiler/build
run: "php ../box/vendor/bin/box compile --no-parallel --sort-compiled-files"

- name: "Install rector-src dependencies"
working-directory: rector-src
env:
COMPOSER_ROOT_VERSION: "dev-main"
run: "composer install --no-interaction --no-progress"

- name: "Copy phpdoc-parser and phpstan.phar to rector-src"
run: |
rm -r rector-src/vendor/phpstan/phpdoc-parser/src
cp -r src/ rector-src/vendor/phpstan/phpdoc-parser/src
cp phpstan-src/tmp/phpstan.phar rector-src/vendor/phpstan/phpstan/phpstan.phar

- name: "Tests"
working-directory: rector-src
run: "vendor/bin/fastunit tests rules-tests utils/phpstan/tests"

- name: "PHPStan"
if: matrix.php-version == '8.4'
working-directory: rector-src
run: "vendor/bin/phpstan analyse --ansi"
Loading