Skip to content

Commit 79cd2fd

Browse files
Merge branch 'main' into jpersaud_socket_not_Ready
2 parents 513a084 + 6ed4c92 commit 79cd2fd

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

ci/phan.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env php
22
<?php
3+
34
declare(strict_types=1);
45
require realpath(dirname(__FILE__)).'/../vendor/autoload.php';
56
use Expensify\Bedrock\CI\PhanAnalyzer;
67

7-
$analyzer = new PhanAnalyzer($_SERVER['TRAVIS_BRANCH']);
8+
$analyzer = new PhanAnalyzer($_SERVER['GITHUB_REF']);
89
if ($analyzer->analyze()) {
910
exit(0);
10-
} else {
11-
exit(1);
1211
}
12+
exit(1);

ci/src/PHPStyler.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
class PHPStyler extends CommandLine
99
{
1010
/**
11-
* @var string Branch we are checking (usually coming from['TRAVIS_BRANCH'])
11+
* @var string Branch we are checking (usually coming from['GITHUB_REF'])
1212
*/
1313
private $branch;
1414

1515
/**
16-
* @var string Commit we are checking (usually coming from['TRAVIS_COMMIT'])
16+
* @var string Commit we are checking (usually coming from['GITHUB_SHA'])
1717
*/
1818
private $commit;
1919

@@ -39,7 +39,7 @@ public function check()
3939
$PHPLintCommand = "find . -name '*.php' -not \\( -path './externalLib/*' -or -path './vendor/*' -or -path './build/*' \\) -print0 | xargs -0 -L 1 -n 1 -P 8 php -l 1>/dev/null";
4040

4141
if ($this->branch === 'main') {
42-
Travis::foldCall("lintmaster.php", $PHPLintCommand);
42+
Travis::foldCall('lintmaster.php', $PHPLintCommand);
4343

4444
echo 'Skipping style check for merge commits';
4545

@@ -48,9 +48,9 @@ public function check()
4848

4949
$this->checkoutBranch($this->branch);
5050

51-
Travis::foldCall("lint.php", $PHPLintCommand);
51+
Travis::foldCall('lint.php', $PHPLintCommand);
5252

53-
Travis::fold("start", "style.php");
53+
Travis::fold('start', 'style.php');
5454
Travis::timeStart();
5555
echo 'Enforce PHP style'.PHP_EOL;
5656
$output = $this->getModifiedFiles($this->branch);
@@ -83,13 +83,13 @@ public function check()
8383
}
8484

8585
Travis::timeFinish();
86-
Travis::fold("end", "style.php");
86+
Travis::fold('end', 'style.php');
8787

8888
if (!$lintOK) {
8989
return false;
9090
}
9191

92-
Travis::foldCall("git.checkout2", "git checkout {$this->commit} 2>&1");
92+
Travis::foldCall('git.checkout2', "git checkout {$this->commit} 2>&1");
9393

9494
return true;
9595
}

ci/src/PhanAnalyzer.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class PhanAnalyzer extends CommandLine
99
{
1010
/**
11-
* @var string Branch we are checking (usually coming from['TRAVIS_BRANCH'])
11+
* @var string Branch we are checking (usually coming from['GITHUB_REF'])
1212
*/
1313
private $branch;
1414

@@ -35,12 +35,12 @@ public function analyze()
3535

3636
$this->checkoutBranch($this->branch);
3737

38-
Travis::fold("start", "phan.analyze");
38+
Travis::fold('start', 'phan.analyze');
3939
Travis::timeStart();
4040
echo 'Analyze PHP using Phan'.PHP_EOL;
4141
$changedFiles = $this->eexec("git diff main...{$this->branch} --name-status | egrep \"^[A|M].*\\.php$\" | cut -f 2");
42-
echo "Analyzing files:".PHP_EOL;
43-
$lintErrors = $this->eexec("./vendor/bin/phan -p -z --processes 5", false);
42+
echo 'Analyzing files:'.PHP_EOL;
43+
$lintErrors = $this->eexec('./vendor/bin/phan -p -z --processes 5', false);
4444
$lintOK = true;
4545
foreach ($lintErrors as $lintError) {
4646
foreach ($changedFiles as $file) {
@@ -52,7 +52,7 @@ public function analyze()
5252
}
5353
}
5454
Travis::timeFinish();
55-
Travis::fold("end", "phan.analyze");
55+
Travis::fold('end', 'phan.analyze');
5656

5757
return $lintOK;
5858
}

ci/style.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
require realpath(dirname(__FILE__)).'/../vendor/autoload.php';
66
use Expensify\Bedrock\CI\PHPStyler;
77

8-
$styler = new PHPStyler($_SERVER['TRAVIS_BRANCH'], $_SERVER['TRAVIS_COMMIT']);
8+
$styler = new PHPStyler($_SERVER['GITHUB_REF'], $_SERVER['GITHUB_SHA']);
99
$valid = $styler->check();
1010
exit((int) !$valid);

src/Client.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -648,14 +648,14 @@ private function sendRawRequest(string $host, int $port, string $rawRequest)
648648
* @param ?string $preferredHost If passed, it will prefer this host over any of the configured ones. This does not
649649
* ensure it will use that host, but it will try to use it if its not blacklisted.
650650
*
651-
* @suppress PhanUndeclaredConstant - suppresses TRAVIS_RUNNING
651+
* @suppress PhanUndeclaredConstant - suppresses ARE_GITHUB_ACTIONS_RUNNING
652652
*/
653653
private function getPossibleHosts(?string $preferredHost, bool $resetHosts = false)
654654
{
655655
// We get the host configs from the APC cache. Then, we check the configuration there with the passed
656656
// configuration and if it's outdated (ie: it has different hosts from the one in the config), we reset it. This
657657
// is so that we don't keep the old cache after changing the hosts or failover configuration.
658-
if (!defined('TRAVIS_RUNNING') || !TRAVIS_RUNNING) {
658+
if (!defined('ARE_GITHUB_ACTIONS_RUNNING') || !ARE_GITHUB_ACTIONS_RUNNING) {
659659
$apcuKey = self::APCU_CACHE_PREFIX.$this->clusterName;
660660
if ($resetHosts) {
661661
$this->logger->info('Bedrock\Client - Resetting host configs');
@@ -879,12 +879,12 @@ private static function toUTF8($str)
879879
* configuration.
880880
* We also close and clear the socket from the cache, so we don't reuse it.
881881
*
882-
* @suppress PhanUndeclaredConstant - suppresses TRAVIS_RUNNING
882+
* @suppress PhanUndeclaredConstant - suppresses ARE_GITHUB_ACTIONS_RUNNING
883883
*/
884884
private function markHostAsFailed(string $host)
885885
{
886886
$blacklistedUntil = time() + rand(1, $this->maxBlackListTimeout);
887-
if (!defined('TRAVIS_RUNNING') || !TRAVIS_RUNNING) {
887+
if (!defined('ARE_GITHUB_ACTIONS_RUNNING') || !ARE_GITHUB_ACTIONS_RUNNING) {
888888
$apcuKey = self::APCU_CACHE_PREFIX.$this->clusterName;
889889
$hostConfigs = apcu_fetch($apcuKey);
890890
$hostConfigs[$host]['blacklistedUntil'] = $blacklistedUntil;

0 commit comments

Comments
 (0)