CI workflow (guzzle/guzzle)
The CI workflow from guzzle/guzzle, explained and optimized by Latchkey.
CI health: F - at risk
Point runs-on at Latchkey and get caching, 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 CI 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: CI
on:
push:
branches:
pull_request:
permissions:
contents: read
env:
COMPOSER_ROOT_VERSION: 7.14.x-dev
jobs:
build-lowest-version:
name: Build lowest version
runs-on: ubuntu-24.04
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.2'
ini-values: error_reporting=E_ALL
coverage: none
extensions: mbstring, intl
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: '22.x'
- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Checkout code
uses: actions/checkout@v6
- name: Download dependencies
run: composer update --no-interaction --no-progress --prefer-stable --prefer-lowest
- name: Start test servers
shell: bash
run: ./vendor/bin/http_test_server &
- name: Run tests
run: ./vendor/bin/phpunit
build:
name: Build
runs-on: ubuntu-24.04
strategy:
fail-fast: false
max-parallel: 10
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: error_reporting=E_ALL
coverage: none
extensions: mbstring, intl
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: '22.x'
- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Checkout code
uses: actions/checkout@v6
- name: Download dependencies
run: composer update --no-interaction --no-progress
- name: Start test servers
shell: bash
run: ./vendor/bin/http_test_server &
- name: Run tests
run: ./vendor/bin/phpunit
build-windows:
name: Build on Windows
runs-on: windows-2025
strategy:
fail-fast: false
max-parallel: 10
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: error_reporting=E_ALL
coverage: none
extensions: mbstring, intl
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: '22.x'
- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Checkout code
uses: actions/checkout@v6
- name: Download dependencies
run: composer update --no-interaction --no-progress
- name: Start test servers
shell: bash
run: ./vendor/bin/http_test_server &
- name: Run tests
run: vendor/bin/phpunit.bat
The same workflow, on Latchkey
Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.
name: CI 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: build-lowest-version: timeout-minutes: 30 name: Build lowest version runs-on: latchkey-small steps: - name: Set up PHP uses: shivammathur/setup-php@v2 with: php-version: '7.2' ini-values: error_reporting=E_ALL coverage: none extensions: mbstring, intl - name: Set up Node uses: actions/setup-node@v6 with: cache: 'npm' node-version: '22.x' - name: Setup Problem Matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Checkout code uses: actions/checkout@v6 - name: Download dependencies run: composer update --no-interaction --no-progress --prefer-stable --prefer-lowest - name: Start test servers shell: bash run: ./vendor/bin/http_test_server & - name: Run tests run: ./vendor/bin/phpunit build: timeout-minutes: 30 name: Build runs-on: latchkey-small strategy: fail-fast: false max-parallel: 10 matrix: php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] steps: - name: Set up PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} ini-values: error_reporting=E_ALL coverage: none extensions: mbstring, intl - name: Set up Node uses: actions/setup-node@v6 with: cache: 'npm' node-version: '22.x' - name: Setup Problem Matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Checkout code uses: actions/checkout@v6 - name: Download dependencies run: composer update --no-interaction --no-progress - name: Start test servers shell: bash run: ./vendor/bin/http_test_server & - name: Run tests run: ./vendor/bin/phpunit build-windows: timeout-minutes: 30 name: Build on Windows runs-on: windows-2025 strategy: fail-fast: false max-parallel: 10 matrix: php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] steps: - name: Set up PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} ini-values: error_reporting=E_ALL coverage: none extensions: mbstring, intl - name: Set up Node uses: actions/setup-node@v6 with: cache: 'npm' node-version: '22.x' - name: Setup Problem Matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Checkout code uses: actions/checkout@v6 - name: Download dependencies run: composer update --no-interaction --no-progress - name: Start test servers shell: bash run: ./vendor/bin/http_test_server & - name: Run tests run: vendor/bin/phpunit.bat
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.
- Cache dependency installs on the setup step so they are served from cache.
- 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 (19 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.