Skip to content

Update github-actions #32001

Update github-actions

Update github-actions #32001

# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
name: "Static Analysis"
on:
pull_request:
paths-ignore:
- 'compiler/**'
- 'apigen/**'
push:
branches:
- "2.2.x"
paths-ignore:
- 'compiler/**'
- 'apigen/**'
concurrency:
group: sa-${{ github.head_ref || github.run_id }} # will be canceled on subsequent pushes in pull requests but not branches
cancel-in-progress: true
jobs:
static-analysis:
name: "PHPStan"
runs-on: ${{ matrix.operating-system }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
- "8.5"
operating-system: [ubuntu-latest, windows-latest]
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
with:
egress-policy: audit
- name: "Checkout"
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- name: "Install PHP"
uses: "shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240" # 2.37.2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
ini-file: development
extensions: mbstring
- name: "Downgrade PHPUnit"
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
shell: bash
run: "composer require --dev phpunit/phpunit:^9.6 sebastian/diff:^4.0 doctrine/instantiator:^1.0 --update-with-dependencies --ignore-platform-reqs"
- uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # v4.0.0
- uses: ./.github/actions/downgrade-code
with:
php-version: "${{ matrix.php-version }}"
# separate limit since some PHP8.1 only behavior is less efficient
- name: "PHPStan"
run: "php bin/phpstan clear-result-cache -q && php -d memory_limit=599M bin/phpstan -v"
if: matrix.php-version == '8.1'
- name: "PHPStan"
run: "make phpstan"
if: matrix.php-version != '8.1'
- name: "Generate baseline"
if: failure() && (matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1')
run: "php -d memory_limit=599M bin/phpstan analyse --generate-baseline baseline-php-${{ matrix.php-version }}.neon"
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ failure() }}
with:
name: baseline-${{ matrix.php-version }}
path: baseline-php-${{ matrix.php-version }}.neon
static-analysis-with-result-cache:
name: "PHPStan with result cache"
runs-on: "ubuntu-latest"
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
php-version:
- "8.2"
- "8.3"
- "8.4"
- "8.5"
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
with:
egress-policy: audit
- name: "Checkout"
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- name: "Install PHP"
uses: "shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240" # 2.37.2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
ini-file: development
extensions: mbstring
- uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # v4.0.0
- name: "Cache Result cache"
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
with:
path: ./tmp
key: "result-cache-v15-${{ matrix.php-version }}-${{ github.run_id }}"
restore-keys: |
result-cache-v15-${{ matrix.php-version }}-
- name: "PHPStan with result cache"
run: |
make phpstan-result-cache
bin/phpstan clear-result-cache -c build/phpstan.neon
make phpstan-result-cache
echo -e "\n\n" >> src/TrinaryLogic.php
make phpstan-result-cache
make phpstan-result-cache
generate-baseline:
name: "Generate baseline"
runs-on: "ubuntu-latest"
timeout-minutes: 60
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
with:
egress-policy: audit
- name: "Checkout"
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- name: "Install PHP"
uses: "shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240" # 2.37.2
with:
coverage: "none"
php-version: "8.2"
ini-file: development
- uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # v4.0.0
- name: "Generate baseline"
run: |
cp phpstan-baseline.neon phpstan-baseline-orig.neon && \
make phpstan-generate-baseline && \
diff phpstan-baseline.neon phpstan-baseline-orig.neon
generate-baseline-php:
name: "Generate PHP baseline"
runs-on: "ubuntu-latest"
timeout-minutes: 60
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
with:
egress-policy: audit
- name: "Checkout"
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- name: "Install PHP"
uses: "shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240" # 2.37.2
with:
coverage: "none"
php-version: "8.2"
ini-file: development
- uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # v4.0.0
- name: "Generate baseline"
run: |
true > phpstan-baseline.neon && \
make phpstan-generate-baseline-php && \
make phpstan-result-cache