New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

lightspeedphp/lightspeed

Run tests faster by splitting them across nodes.
80 2
Install
composer require lightspeedphp/lightspeed:dev-main
PHP:^7.3 || ^8.0
License:BSD-4-Clause
Last Updated:Oct 2, 2023
Links: GitHub  ·  Packagist
Maintainer: jradtilbrook

Lightspeed

Installation

Install with composer:

composer require --dev lightspeedphp/lightspeed

Usage

Once installed, you can immediately run php vendor/bin/lightspeed to execute your tests. It will proxy to PHPUnit or to Pest if you have it installed.

Lightspeed is best used within CI where it can run on multiple machines at once to parallelise the execution of your tests. It currently supports GitHub Actions and Buildkite.

GitHub Actions

Here is an example workflow file to execute your tests in parallel. Note you must set the env vars manually for tests to be correctly split between jobs.

name: Demo

on: ['push']

jobs:
  ci:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node_count: [3]
        node_index: [0, 1, 2]

    name: Demo

    steps:
    - name: Checkout
      uses: actions/checkout@v3

    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: 8.0
        tools: composer:v2
        coverage: none

    - name: Install PHP dependencies
      run: composer update --no-interaction --no-progress

    - name: Tests (${{ matrix.node_index}})
      env:
        LIGHTSPEED_NODE_COUNT: ${{ matrix.node_count }}
        LIGHTSPEED_NODE_INDEX: ${{ matrix.node_index }}
      run: php vendor/bin/lightspeed --colors=always

Buildkite

Buildkite is supported out of the box by setting the parallelism command step attribute. You can parallelise your test steps with as much agents as you can to minimise test time.

steps:
  - label: ':php: Run tests'
    commands:
      - composer update --no-interaction --no-progress
      - php vendor/bin/lightspeed
    parallelism: 3
    plugins:
      - docker#v4.14.0:
          image: composer:2
          propagate-environment: true

License

Lightspeed is licensed under the BSD 4-Clause License.

Related Packages

pestphp/pest

The elegant PHP Testing Framework.

98,997,304 11,745
pestphp/pest-dev-tools

Dev requirements for Pest, The elegant PHP Testing Framework.

210,999 10
nckrtl/pestphp-monorepo

Pest with test-impact analysis for Composer monorepos and Git worktrees.

50,083 1
bellangelo/pest-php74

The elegant PHP Testing Framework transpiled to PHP 7.4.

0 0
pestphp/pest-plugin-laravel

The Pest Laravel Plugin

78,158,443 234