mirror of
https://github.com/pestphp/pest.git
synced 2026-12-03 22:45:06 +01:00
8eb2892f69
* fix(tia): skip locally() when the process is on CI locally() only looked at --ci, so a CI job that followed the docs and ran plain pest replayed cached results. Fixes #1970 * test(tia): clear CI variables so the local assertion passes on CI * test: update snapshots for TIA CI detection --------- Co-authored-by: Tiago Santos <tsantos@lynixt.pt> Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
48 lines
908 B
PHP
48 lines
908 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pest\Support;
|
|
|
|
use Pest\Plugins\Environment;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
final class Ci
|
|
{
|
|
/**
|
|
* @var list<string>
|
|
*/
|
|
public const array ENVIRONMENT_VARIABLES = [
|
|
'CI',
|
|
'GITHUB_ACTIONS',
|
|
'GITLAB_CI',
|
|
'CIRCLECI',
|
|
'TRAVIS',
|
|
'APPVEYOR',
|
|
'BITBUCKET_BUILD_NUMBER',
|
|
'BUILDKITE',
|
|
'TEAMCITY_VERSION',
|
|
'JENKINS_URL',
|
|
'SYSTEM_COLLECTIONURI',
|
|
'CI_NAME',
|
|
'TASKCLUSTER_ROOT_URL',
|
|
'DRONE',
|
|
'WERCKER',
|
|
'NEVERCODE',
|
|
'SEMAPHORE',
|
|
'NETLIFY',
|
|
'NOW_BUILDER',
|
|
];
|
|
|
|
public static function isRunning(): bool
|
|
{
|
|
if (Environment::name() === Environment::CI) {
|
|
return true;
|
|
}
|
|
|
|
return array_any(self::ENVIRONMENT_VARIABLES, fn (string $env): bool => getenv($env) !== false);
|
|
}
|
|
}
|