Skip to content
Latchkey

Autoloader workflow (composer/composer)

The Autoloader workflow from composer/composer, explained and optimized by Latchkey.

A

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.

Grade your own workflow free or run it on Latchkey →
Source: composer/composer.github/workflows/autoloader.ymlLicense MITView source

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

workflow (.yml)
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

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:

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow