Autoloader workflow (composer/composer)
The Autoloader workflow from composer/composer, explained and optimized by Latchkey.
CI health: A - excellent
Point runs-on at Latchkey and get job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Autoloader workflow from the composer/composer 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: "Autoloader"
on:
push:
paths-ignore:
- 'doc/**'
pull_request:
paths-ignore:
- 'doc/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
tests:
name: "Autoloader"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: "Install Composer dependencies"
run: "composer config platform --unset && composer install"
- name: "Dump autoloader in the test directory using latest Composer"
run: "./bin/composer install -d tests/Composer/Test/Autoload/MinimumVersionSupport"
- name: "Install oldest supported PHP version for autoloader"
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
coverage: "none"
extensions: "intl, zip"
ini-values: "memory_limit=-1"
php-version: "5.6"
tools: "composer:snapshot"
- name: "Check the autoloader can be executed"
run: "php main.php"
working-directory: tests/Composer/Test/Autoload/MinimumVersionSupport
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: "Autoloader" on: push: paths-ignore: - 'doc/**' pull_request: paths-ignore: - 'doc/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true permissions: contents: read jobs: tests: timeout-minutes: 30 name: "Autoloader" runs-on: latchkey-small steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - name: "Install Composer dependencies" run: "composer config platform --unset && composer install" - name: "Dump autoloader in the test directory using latest Composer" run: "./bin/composer install -d tests/Composer/Test/Autoload/MinimumVersionSupport" - name: "Install oldest supported PHP version for autoloader" uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 with: coverage: "none" extensions: "intl, zip" ini-values: "memory_limit=-1" php-version: "5.6" tools: "composer:snapshot" - name: "Check the autoloader can be executed" run: "php main.php" working-directory: tests/Composer/Test/Autoload/MinimumVersionSupport
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. - Add a job timeout so a hung step cannot burn hours of runner time.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.