Skip to content

Commit 6ed4c92

Browse files
authored
Merge pull request #243 from Expensify/twodarek-cleanup-old-travisci
Replace TRAVIS_* envvars with GITHUB_ envvars
2 parents f83795a + 6a0db18 commit 6ed4c92

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
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);

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "expensify/bedrock-php",
33
"description": "Bedrock PHP Library",
44
"type": "library",
5-
"version": "2.2.2",
5+
"version": "2.2.4",
66
"authors": [
77
{
88
"name": "Expensify",

src/Client.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -607,14 +607,14 @@ private function sendRawRequest(string $host, int $port, string $rawRequest)
607607
* @param ?string $preferredHost If passed, it will prefer this host over any of the configured ones. This does not
608608
* ensure it will use that host, but it will try to use it if its not blacklisted.
609609
*
610-
* @suppress PhanUndeclaredConstant - suppresses TRAVIS_RUNNING
610+
* @suppress PhanUndeclaredConstant - suppresses ARE_GITHUB_ACTIONS_RUNNING
611611
*/
612612
private function getPossibleHosts(?string $preferredHost, bool $resetHosts = false)
613613
{
614614
// We get the host configs from the APC cache. Then, we check the configuration there with the passed
615615
// configuration and if it's outdated (ie: it has different hosts from the one in the config), we reset it. This
616616
// is so that we don't keep the old cache after changing the hosts or failover configuration.
617-
if (!defined('TRAVIS_RUNNING') || !TRAVIS_RUNNING) {
617+
if (!defined('ARE_GITHUB_ACTIONS_RUNNING') || !ARE_GITHUB_ACTIONS_RUNNING) {
618618
$apcuKey = self::APCU_CACHE_PREFIX.$this->clusterName;
619619
if ($resetHosts) {
620620
$this->logger->info('Bedrock\Client - Resetting host configs');
@@ -838,12 +838,12 @@ private static function toUTF8($str)
838838
* configuration.
839839
* We also close and clear the socket from the cache, so we don't reuse it.
840840
*
841-
* @suppress PhanUndeclaredConstant - suppresses TRAVIS_RUNNING
841+
* @suppress PhanUndeclaredConstant - suppresses ARE_GITHUB_ACTIONS_RUNNING
842842
*/
843843
private function markHostAsFailed(string $host)
844844
{
845845
$blacklistedUntil = time() + rand(1, $this->maxBlackListTimeout);
846-
if (!defined('TRAVIS_RUNNING') || !TRAVIS_RUNNING) {
846+
if (!defined('ARE_GITHUB_ACTIONS_RUNNING') || !ARE_GITHUB_ACTIONS_RUNNING) {
847847
$apcuKey = self::APCU_CACHE_PREFIX.$this->clusterName;
848848
$hostConfigs = apcu_fetch($apcuKey);
849849
$hostConfigs[$host]['blacklistedUntil'] = $blacklistedUntil;

0 commit comments

Comments
 (0)