Use a prebuilt Docker image for the parallel workers

Aperta
#425 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
docker, github-actions, php
Ambito
ci-cd, devops, testing

Direzione di ricerca

Start with wp_cli_tests_docker_php_image() in utils/behat-parallel.php and the image definition in utils/docker/Dockerfile, then look at the existing GitHub Actions workflows for where a publish job would go. Done means the helper computes a tag from the PHP version and a hash of utils/docker/, pulls that image, and falls back to the local build when the pull fails or the hash differs. The publishing workflow should push images for each supported PHP version to GHCR.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

scope:artifacts scope:distribution scope:testing

Part of #394. Follow-up to #391 and #408.

Every Linux Behat job builds the worker image from utils/docker/Dockerfile with docker build (wp_cli_tests_docker_php_image() in utils/behat-parallel.php). The GitHub runners start without a layer cache, so every job builds the image from scratch, although it only depends on the PHP version and the Dockerfile.

In the full-matrix runs of all 29 packages on 2026-11-02, the time from the start of the Behat step to the first worker starting was between 40 and 63 seconds in every package, measured in the job for PHP 8.4, WP latest and MySQL 8.0. Each package runs about 45 Linux Behat jobs, so this adds up to roughly 30 to 45 runner-minutes per package per Testing run, or about 15 to 20 runner-hours per round across the 29 packages. For PHP 8.0 and older, the image also builds SQLite from source (#413), which takes another 30 to 90 seconds.

Proposal:

  1. A workflow in this repository builds the image for every supported PHP version and publishes it to the GitHub Container Registry, tagged with the PHP version and a hash of utils/docker/. It runs when the Dockerfile changes, and on a schedule, to pick up PHP patch releases and security updates of the base images.
  2. wp_cli_tests_docker_php_image() computes the same tag and pulls the image. It builds the image locally as before if the pull fails, or if utils/docker/ differs from any published version, for example in a development checkout.
  3. Keep the image small, so pulling it stays well below the current build time.

The vendor directory for a different PHP version (WP_CLI_TEST_DOCKER_PHP) is project-specific and stays out of the image.

Measuring: compare the time from the start of the Behat step to "Running N scenarios ..." for the same jobs, with a cold runner, before and after. Pull time is what decides this, so record the size of the image as well.

Lingua principale
PHP
Stelle
42
Fork
29
Merge medio
18h 52m
PR unite (30g)
27

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di wp-cli/wp-cli-tests

Tutte le issue di wp-cli/wp-cli-tests

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.