Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: composer 2.7 section for ci #266

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions continuous-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ description: Up until now, we have only discussed running tests from the command

Up until now, we have only discussed running tests from the command line on your local machine. But, you can also run your tests from a CI platform of your choice. As `pestphp/pest` is included in your Composer development dependencies, you can easily execute the `vendor/bin/pest` command within your CI platform's deployment pipeline.

## Composer 2.7+ caveat

Since Composer 2.7, plugins are disabled by default when running as root, which is most often the case in the various CI platforms (read more about this change: [composer/composer#11839](https://github.com/composer/composer/issues/11839)).

You might encounter errors such as `Unknown option "--parallel"` or `option --coverage is ambiguous`.

To enable plugins and fix those issues, you can either setup your CI environment to use a regular user (varies by platform) or set `COMPOSER_ALLOW_SUPERUSER=1` before running `./vendor/bin/pest`.

## Example With GitHub Actions

If your application uses [GitHub Actions](https://github.com/features/actions) as its CI platform, the following guidelines will assist you in configuring Pest so that your application is automatically tested when someone pushes a commit to your GitHub repository.
Expand Down Expand Up @@ -55,7 +63,7 @@ To get started, add the following configuration to your `.gitlab-ci.yml` file. T
stages:
- build
- test

build:vendors:
stage: build
only:
Expand All @@ -70,7 +78,7 @@ build:vendors:
image: composer:2
script:
- composer install --no-interaction --prefer-dist --optimize-autoloader

tests:
stage: test
only:
Expand Down