惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

云风的 BLOG
云风的 BLOG
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 叶小钗
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
酷 壳 – CoolShell
酷 壳 – CoolShell
月光博客
月光博客
人人都是产品经理
人人都是产品经理
宝玉的分享
宝玉的分享
博客园 - 司徒正美
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
Vercel News
Vercel News
T
The Blog of Author Tim Ferriss
T
Tailwind CSS Blog
A
About on SuperTechFans
Apple Machine Learning Research
Apple Machine Learning Research
L
LangChain Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
Visual Studio Blog
S
SegmentFault 最新的问题
Google DeepMind News
Google DeepMind News
博客园 - 聂微东

Danb Blog

August 2026: What I've Been Working On · Danb Blog Great Tech: Intel 2500k CPU · Danb Blog July 2026: What I've Been Working On · Danb Blog My Experience with Ubuntu Desktop 26.04 · Danb Blog Thumbnails for Orca 3MF in GNOME Files · Danb Blog Cheaper Sodastream Gas with a Big Tank · Danb Blog June 2026: What I've Been Working On · Danb Blog Running Snyk On Forgejo/Codeberg Actions · Danb Blog Tuta & Proton: An Open Source Client Does Not Result in an Open Source Service · Danb Blog May 2026: What I've Been Working On · Danb Blog 3D Printing Parts for my Greenhouse, Round 2 · Danb Blog Great Devices: Nexus 7 2013 · Danb Blog R36S Console RetroArch Stuck Menu Issue · Danb Blog April 2026: What I've Been Working On · Danb Blog Basic OpenCode Sandboxing with Docker · Danb Blog Games Played in 2025 · Danb Blog March 2026: What I've Been Working On · Danb Blog February 2026: What I've Been Working On · Danb Blog Your BookStackApp project was assigned as a project for my Software Architecture course · Danb Blog My Sovol SV08 3D Printer Setup in 2026 · Danb Blog January 2026: What I've Been Working On · Danb Blog Epson Printer: The administrator password you entered was not recognized · Danb Blog Pressure to Follow Process · Danb Blog Online Shopping Email Notifications · Danb Blog My HomeLab Setup in 2026 · Danb Blog Linux Label Printing with the Phomemo D30 · Danb Blog Reporting to the CMA: Google Android Developer Verification · Danb Blog OPNsense & Dnsmasq: Responding with specific DNS servers · Danb Blog An Impromptu Introduction to ZFS Drive Replacement at 1am · Danb Blog Experience with UK Medical Cannabis for Ankylosing Spondylitis · Danb Blog
Shivam Mathur's "node-docker" Images are Awesome for PHP ...
2026-03-05 · via Danb Blog

Today I had a scenario where I needed to expand the testing of a PHP project across two dimensions: PHP versions and PHPUnit versions. Of course, this explodes the amount of test runs somewhat.

As part of my CI test process, ran via Forgejo runner, i already used the very awesome & useful setup-php action by Shivam Mathur. But this remained the slowest part, needing to download/setup PHP for each scenario and test run. Not only does this waste time, but also bandwidth, power and resources, which can add up over many scenarios and test runs.

Thankfully, I discovered that Shivam also provides a large array of docker images in their node-docker repo. These are GitHub/Forgejo-action-ready images (Node installed), for a wide range of Debian/Ubuntu versions, for a range of common architectures, each with a range of PHP versions installed. There are also variations with only specific PHP versions if preferred.

Using these cut my per-scenario run time down from 40 seconds to 12 seconds. Definitely will be keeping these images in mind when it comes to updating my other PHP CI setups!

CI Workflow

For context, below is the CI workflow I used this in. Original source in repo here.

name: php

on: [push, pull_request]

jobs:
  test:
    runs-on: docker
    container:
      image: docker.io/setupphp/node:trixie
    strategy:
      matrix:
        php: [8.1, 8.2, 8.3, 8.4, 8.5]
        phpunit: [10, 11, 12, 13]
        exclude:
          - php: 8.1
            phpunit: 11
          - php: 8.1
            phpunit: 12
          - php: 8.2
            phpunit: 12
          - php: 8.1
            phpunit: 13
          - php: 8.2
            phpunit: 13
          - php: 8.3
            phpunit: 13
    steps:
      - name: Checkout code
        uses: https://code.forgejo.org/actions/checkout@v4

      - name: Cache dependencies
        uses: https://code.forgejo.org/actions/cache@v4
        with:
          path: ~/.composer/cache/files
          key: dependencies-php-${{ matrix.php }}-phpunit-${{ matrix.phpunit }}-composer-${{ hashFiles('composer.json') }}
          restore-keys: |
            dependencies-php-${{ matrix.php }}-phpunit-${{ matrix.phpunit }}-composer-
            dependencies-php-${{ matrix.php }}-

      - name: Setup PHP
        uses: https://github.com/shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          extensions: mbstring
          coverage: none

      - name: Require PHPUnit version
        run: composer require phpunit/phpunit:"^${{ matrix.phpunit }}" --no-update --no-interaction

      - name: Install dependencies
        run: composer install --prefer-dist --no-interaction --no-suggest
        env:
          COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.GH_TOKEN }}"}}'

      - name: Run PHPStan
        run: vendor/bin/phpstan

      - name: Execute PHPUnit tests
        run: vendor/bin/phpunit