Static analysis workflow (guzzle/guzzle)
The Static analysis workflow from guzzle/guzzle, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Static analysis workflow from the guzzle/guzzle repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: Static analysis
on:
push:
branches:
pull_request:
permissions:
contents: read
env:
COMPOSER_ROOT_VERSION: 7.14.x-dev
jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
extensions: mbstring, intl
- name: Download dependencies
run: composer update --no-interaction --no-progress
- name: Download PHPStan
run: composer bin phpstan update --no-interaction --no-progress
- name: Execute PHPStan
run: vendor/bin/phpstan analyze --no-progress
php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
extensions: mbstring
- name: Download dependencies
run: composer update --no-interaction --no-progress
- name: Download PHP CS Fixer
run: composer bin php-cs-fixer update --no-interaction --no-progress
- name: Execute PHP CS Fixer
run: vendor/bin/php-cs-fixer fix --diff --dry-run
composer-normalize:
name: Composer Normalize
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
- name: Execute Composer Normalize
run: make static-composer-normalize-check
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Static analysis on: push: branches: pull_request: permissions: contents: read env: COMPOSER_ROOT_VERSION: 7.14.x-dev concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: phpstan: timeout-minutes: 30 name: PHPStan runs-on: latchkey-small steps: - name: Checkout code uses: actions/checkout@v6 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: '7.4' coverage: none extensions: mbstring, intl - name: Download dependencies run: composer update --no-interaction --no-progress - name: Download PHPStan run: composer bin phpstan update --no-interaction --no-progress - name: Execute PHPStan run: vendor/bin/phpstan analyze --no-progress php-cs-fixer: timeout-minutes: 30 name: PHP-CS-Fixer runs-on: latchkey-small steps: - name: Checkout code uses: actions/checkout@v6 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: '7.4' coverage: none extensions: mbstring - name: Download dependencies run: composer update --no-interaction --no-progress - name: Download PHP CS Fixer run: composer bin php-cs-fixer update --no-interaction --no-progress - name: Execute PHP CS Fixer run: vendor/bin/php-cs-fixer fix --diff --dry-run composer-normalize: timeout-minutes: 30 name: Composer Normalize runs-on: latchkey-small steps: - name: Checkout code uses: actions/checkout@v6 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: '7.4' coverage: none - name: Execute Composer Normalize run: make static-composer-normalize-check
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cancel superseded runs when a branch or PR gets a newer push.
- Add a job timeout so a hung step cannot burn hours of runner time.
1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
This workflow runs 3 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.