pestphp / pest

Pest is an elegant PHP testing Framework with a focus on simplicity, meticulously designed to bring back the joy of testing in PHP.
https://pestphp.com
MIT License
9.46k stars 341 forks source link

[Bug]: Unknown option "--parallel". github workflow #1158

Open emadbatwa opened 4 months ago

emadbatwa commented 4 months ago

What Happened

image

when run pest with --parallel flag on github action always get INFO Unknown option "--parallel".

the workflow file is :

name: Build and Test

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    container:
      image: kirschbaumdevelopment/laravel-test-runner:8.3

    services:
      postgres:
        image: postgres:12
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
          POSTGRES_DB: db_testing
        ports:
        - 5432:5432
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Install composer Dependencies
        run: |
          composer install --prefer-dist --no-interaction --no-suggest

      - name: Prepare Laravel Application
        run: |
          cp .env.ci .env
          php artisan key:generate

      - name: Verify Pest Version
        run: ./vendor/bin/pest --version

      - name: Execute backend tests (using custom composer script)
        run: ./vendor/bin/pest -c phpunit.pgsql.xml --no-coverage --parallel --processes=10

but if i remove --parallel i can run without any issue

How to Reproduce

create github workflow file push to github see actions failed with error :

INFO Unknown option "--parallel".

Error: Process completed with exit code 2.

Sample Repository

No response

Pest Version

2.34.7

PHP Version

8.3

Operation System

Linux

Notes

No response

havekes commented 4 months ago

Having the same issue on Bitbucket pipelines. Did you try with --parallel as the first option?

havekes commented 4 months ago

Finally found the solution for me at least. Seems to have to do with composer not installing the scripts in version 2.7 onwards. Adding COMPOSER_ALLOW_SUPERUSER=1 solved the issue. Seems related to https://github.com/pestphp/pest/issues/94

nunomaduro commented 3 months ago

Can someone pull request this to the documentation?

havekes commented 3 months ago

Can someone pull request this to the documentation?

https://github.com/pestphp/docs/pull/266

owenvoke commented 3 months ago

Does using composer config allow-plugins.pestphp/pest-plugin to add the Pest Plugin as an allowed Composer plugin in the composer.json not work? 🤔 That way, it only enables the Pest plugin (rather than allowing any scripts to run with SU access).

TimeglitchD commented 1 month ago

Does using composer config allow-plugins.pestphp/pest-plugin to add the Pest Plugin as an allowed Composer plugin in the composer.json not work? 🤔 That way, it only enables the Pest plugin (rather than allowing any scripts to run with SU access).

I'm afraid not, it returns this message (in Bitbucket at least):

Composer plugins have been disabled for safety in this non-interactive session.
Set COMPOSER_ALLOW_SUPERUSER=1 if you want to allow plugins to run as root/super user.