Skip to content

Commit 6f18c3b

Browse files
author
Scott Sandler
authored
migrate from travis-ci to github actions (#61)
* migrate from travis-ci to github actions * update maintainer's guide with info on composer usage * fix hhvm running at wrong version * does this work * how about this * uhh how about this * support HHVM 4.80 * fix unit tests on 4.80 * fix lint errors * drop 4.56 from this branch
1 parent c2e22dc commit 6f18c3b

23 files changed

+187
-87
lines changed

.github/workflows/build-and-test.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Continuous Integration
2+
on:
3+
pull_request:
4+
jobs:
5+
build:
6+
name: HHVM ${{matrix.hhvm}} - ${{matrix.os}}
7+
strategy:
8+
# Run tests on all OS's and HHVM versions, even if one fails
9+
fail-fast: false
10+
matrix:
11+
os: [ ubuntu ]
12+
hhvm:
13+
- '4.80'
14+
runs-on: ${{matrix.os}}-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Install Composer
18+
run: .github/workflows/install-composer.sh --install-dir=${{runner.temp}}
19+
- name: Install HHVM (apt)
20+
if: matrix.os == 'ubuntu'
21+
run: |
22+
set -ex
23+
export DEBIAN_FRONTEND=noninteractive
24+
sudo apt-get update
25+
sudo apt-get install -y software-properties-common apt-transport-https
26+
sudo apt-key add .github/workflows/hhvm.gpg.key
27+
if [ "${{matrix.hhvm}}" = "nightly" ]; then
28+
sudo add-apt-repository https://dl.hhvm.com/ubuntu
29+
sudo apt-get install -y hhvm-nightly
30+
elif [ "${{matrix.hhvm}}" = "latest" ]; then
31+
sudo add-apt-repository https://dl.hhvm.com/ubuntu
32+
sudo apt-get install -y hhvm
33+
else
34+
DISTRO=$(lsb_release --codename --short)
35+
sudo add-apt-repository \
36+
"deb https://dl.hhvm.com/ubuntu ${DISTRO}-${{matrix.hhvm}} main"
37+
sudo apt remove hhvm
38+
sudo apt-get install -y hhvm
39+
fi
40+
- name: Inspect HHVM and Hack versions
41+
run: |
42+
hhvm --version
43+
hh_client --version
44+
- name: Create branch for version alias
45+
run: git checkout -b CI_current_pull_request
46+
- name: Install project dependencies
47+
run: php ${{runner.temp}}/composer.phar install
48+
- name: Typecheck
49+
run: hh_client
50+
- name: Run tests
51+
run: vendor/bin/hacktest tests/
52+
- name: Run lint
53+
if: matrix.hhvm != 'nightly'
54+
run: vendor/bin/hhast-lint

.github/workflows/hhvm.gpg.key

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
-----BEGIN PGP PUBLIC KEY BLOCK-----
2+
Version: GnuPG v1
3+
4+
mQINBFn8koEBEAC2tPtkphj8gZYHI9mTNUHfQalDo+MNWTGUTNB42asjhTNjipzM
5+
VSxjaZSl5cMLg5YCRuT0AbSIe529FH23yEElc03cGVGgoEnmXtE4+2v7Xa30wCGO
6+
5oUxKfbVatsxEs1y8QEr5Gt+CUFmsApOKgiZq0MsPYmFAuC9CbWdXYa8+E00bXOa
7+
cHCpe+GncCxQmExm7TlrUnURnf3RnNWSEkuPKED/aVggzxNVN6RgRRm4ssZJasM3
8+
TwoI1nVysO5jMfPClvupYscoktO44HBZzH2EeEdpjSV+toD3aZCbmWzXyZjogrFN
9+
j4k5Mme0Xqr4DvRPk5M9SxcQASsCQ8VTyu+ZBUG6zJbddLDEA1BMNIZOG5MyX58O
10+
zed255Q85SAyjHu8pltkfGLd56+MYsckpHaBPMFoCFM4iPcpXOlgcU96pdXJbrR2
11+
mjYI4Le9qRJYYP2kGPkopPwK8nbZJ5Wr7xaclxEc/ODH3mv57KJD7lzmwpnvvmsn
12+
kR/wUHOqwrXojp/oZCUK8KembLiT+MMkY3bne+IY9ef/1qwu4flVBP1CpoaMQEwh
13+
dqzihfwyQ+57ATZHJaj8V9pKAxWh/Df4iFN5mMWA15eBLhRMbAWKJIoLQLcCYwBF
14+
gH3HiO34/uQUHaX6VhRHllA38WUoZNhKmw/Kcd/FDQWlbzbgmI89LJEJuwARAQAB
15+
tC1ISFZNIFBhY2thZ2UgU2lnbmluZyA8b3BlbnNvdXJjZStoaHZtQGZiLmNvbT6J
16+
Ak4EEwEIADg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7svNIaPt2+OXAuRs2yUhitcsDLBV0UlOQ8xH+hzWANyhaJAS7p0k35
33+
kyFOG+n6+2qQkGdlHHuqEzdCL3EiOiK6RrvbWNUnwiG3BdZWgs43hZZBAseX3CHu
34+
MM3vIX/Fc/kuuaCWi2ysyKf7jyi/RiVIAKuLbxAB8eHsyo2G5lA=
35+
=3DTP
36+
-----END PGP PUBLIC KEY BLOCK-----

.github/workflows/install-composer.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
# From https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
4+
5+
EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)"
6+
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
7+
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
8+
9+
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
10+
then
11+
>&2 echo 'ERROR: Invalid installer checksum'
12+
rm composer-setup.php
13+
exit 1
14+
fi
15+
16+
php composer-setup.php "$@"
17+
RESULT=$?
18+
rm composer-setup.php
19+
exit $RESULT

.travis.sh

-21
This file was deleted.

.travis.yml

-18
This file was deleted.

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"hhvm/hhvm-autoload": "^2.0.4|^3"
2323
},
2424
"require-dev": {
25-
"hhvm/hhast": "^4.0.5",
25+
"hhvm/hhast": "^4.80",
2626
"facebook/fbexpect": "^2.2.0",
2727
"hhvm/hacktest": "^1.3|^2.0"
2828
}

maintainers_guide.md

+11
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ this project. If you use this package within your own software as is but don't p
66

77
## Tasks
88

9+
### Setup
10+
11+
Install [Composer](https://getcomposer.org/) and PHP. Use PHP to run composer and install dependencies in this working copy. This will create and populate the `vendor/` directory. Note that composer cannot be run with HHVM.
12+
13+
```
14+
# if composer installed locally
15+
/usr/bin/php composer.phar install
16+
# if installed globally
17+
/usr/bin/php /usr/local/bin/composer install
18+
```
19+
920
### Testing
1021

1122
Run unit tests locally using `vendor/bin/hacktest tests/`. Tests are also run automatically on all branches using [Travis CI](https://travis-ci.org/slackhq/hack-sql-fake).

src/AsyncMysql/AsyncMysqlClient.php

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public static function setPoolsConnectionLimit(int $_limit): void {}
2424
string $_password,
2525
int $_timeout_micros = -1,
2626
?\MySSLContextProvider $_ssl_provider = null,
27+
int $_tcp_timeout_micros = 0,
2728
): Awaitable<\AsyncMysqlConnection> {
2829
return new AsyncMysqlConnection($host, $port, $dbname);
2930
}

src/AsyncMysql/AsyncMysqlConnectionPool.php

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function reset(): void {
3131
string $_password,
3232
int $_timeout_micros = -1,
3333
string $_caller = '',
34+
int $_tcp_timeout_micros = 0,
3435
): Awaitable<AsyncMysqlConnection> {
3536
$this->connectionsRequest++;
3637
if (C\contains_key(static::$pool, $host)) {

src/BuildSchemaCLI.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ protected function getSupportedOptions(): vec<CLIOptions\CLIOption> {
2727

2828
if (C\is_empty($this->getArguments())) {
2929
$program = $this->getArgv()[0];
30-
await $terminal->getStdout()->writeAsync(<<<EOT
30+
await $terminal->getStdout()->writeAllAsync(<<<EOT
3131
3232
Usage: {$program} [--name DB_SCHEMA] [files...] > schema.hack
3333
@@ -49,7 +49,7 @@ protected function getSupportedOptions(): vec<CLIOptions\CLIOption> {
4949
if ($match === null) {
5050
/* HHAST_IGNORE_ERROR[DontAwaitInALoop] */
5151
await $terminal->getStderr()
52-
->writeAsync("Expected file name matching [database_name].sql, {$file} does not match");
52+
->writeAllAsync("Expected file name matching [database_name].sql, {$file} does not match");
5353
return 1;
5454
}
5555

@@ -59,7 +59,7 @@ protected function getSupportedOptions(): vec<CLIOptions\CLIOption> {
5959

6060
if ($contents === false) {
6161
/* HHAST_IGNORE_ERROR[DontAwaitInALoop] */
62-
await $terminal->getStderr()->writeAsync("File could not be loaded: {$contents}");
62+
await $terminal->getStderr()->writeAllAsync("File could not be loaded: {$contents}");
6363
return 1;
6464
}
6565

@@ -105,7 +105,7 @@ protected function getSupportedOptions(): vec<CLIOptions\CLIOption> {
105105
.
106106
$generated;
107107

108-
await $terminal->getStdout()->writeAsync($generated);
108+
await $terminal->getStdout()->writeAllAsync($generated);
109109
return 0;
110110
}
111111
}

src/Logger.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public static function log(Verbosity $verbosity, string $message): void {
2020

2121
protected static function write(string $message): void {
2222
if (self::$handle is nonnull) {
23-
/*HHAST_FIXME[DontUseAsioJoin]*/
24-
\HH\Asio\join(self::$handle->writeAsync($message));
23+
/*HHAST_FIXME[DontUseAsioJoin]*/
24+
\HH\Asio\join(self::$handle->writeAllAsync($message));
2525
} else {
2626
\error_log($message);
2727
}

src/Parser/CreateTableParser.php

+8-5
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,7 @@ private function nextTokenIs(vec<string> $tokens, string $val): bool {
352352
return Str\uppercase($tokens[0]) === $val;
353353
}
354354
355-
private function parseCreateDefinition(
356-
inout vec<string> $tokens,
357-
): shape(
355+
private function parseCreateDefinition(inout vec<string> $tokens): shape(
358356
'fields' => vec<parsed_field>,
359357
'indexes' => vec<parsed_index>,
360358
) {
@@ -521,6 +519,9 @@ private function parseFieldOrKey(
521519
522520
# not currently handled
523521
return;
522+
default:
523+
# any other tokens fall through to be parsed below
524+
break;
524525
}
525526
526527
$fields[] = $this->parseField($tokens);
@@ -881,8 +882,10 @@ private function extractTokens(string $sql, vec<(int, int)> $source_map): vec<st
881882
# Extend the length of the first token to include everything
882883
# up through the last in the sequence.
883884
$j = $i + C\count($list) - 1;
884-
$out_map[] =
885-
tuple($source_map[$i][0], ($source_map[$j][0] - $source_map[$i][0]) + $source_map[$j][1]);
885+
$out_map[] = tuple(
886+
$source_map[$i][0],
887+
($source_map[$j][0] - $source_map[$i][0]) + $source_map[$j][1],
888+
);
886889
887890
$i = $j + 1;
888891
$found = true;

tests/DeleteQueryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ final class DeleteQueryTest extends HackTest {
9595
public static async function beforeFirstTestAsync(): Awaitable<void> {
9696
static::$conn = await SharedSetup::initAsync();
9797
// block hole logging
98-
Logger::setHandle(new \Facebook\CLILib\TestLib\StringOutput());
98+
Logger::setHandle(new \HH\Lib\IO\MemoryHandle());
9999
}
100100

101101
<<__Override>>

tests/InsertQueryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ final class InsertQueryTest extends HackTest {
1515
$pool = new AsyncMysqlConnectionPool(darray[]);
1616
static::$conn = await $pool->connect('example', 1, 'db1', '', '');
1717
// black hole logging
18-
Logger::setHandle(new \Facebook\CLILib\TestLib\StringOutput());
18+
Logger::setHandle(new \HH\Lib\IO\MemoryHandle());
1919
}
2020

2121
<<__Override>>

tests/JSONFunctionTest.hack

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ final class JSONFunctionTest extends HackTest {
2020
public static async function beforeFirstTestAsync(): Awaitable<void> {
2121
static::$conn = await SharedSetup::initAsync();
2222
// block hole logging
23-
Logger::setHandle(new \Facebook\CLILib\TestLib\StringOutput());
23+
Logger::setHandle(new \HH\Lib\IO\MemoryHandle());
2424
}
2525

2626
<<__Override>>

tests/JoinQueryTest.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ final class JoinQueryTest extends HackTest {
9191
9292
public async function testLeftJoin(): Awaitable<void> {
9393
$conn = static::$conn as nonnull;
94-
$results =
95-
await $conn->query('SELECT id, table_4_id FROM table3 LEFT OUTER JOIN association_table ON id=table_3_id');
94+
$results = await $conn->query(
95+
'SELECT id, table_4_id FROM table3 LEFT OUTER JOIN association_table ON id=table_3_id',
96+
);
9697
expect($results->rows())->toBeSame(vec[
9798
dict['id' => 1, 'table_4_id' => 1000],
9899
dict['id' => 1, 'table_4_id' => 1001],
@@ -151,7 +152,7 @@ final class JoinQueryTest extends HackTest {
151152
public static async function beforeFirstTestAsync(): Awaitable<void> {
152153
static::$conn = await SharedSetup::initAsync();
153154
// block hole logging
154-
Logger::setHandle(new \Facebook\CLILib\TestLib\StringOutput());
155+
Logger::setHandle(new \HH\Lib\IO\MemoryHandle());
155156
}
156157
157158
<<__Override>>

tests/MultiQueryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ final class MultiQueryTest extends HackTest {
9191
public static async function beforeFirstTestAsync(): Awaitable<void> {
9292
static::$conn = await SharedSetup::initAsync();
9393
// block hole logging
94-
Logger::setHandle(new \Facebook\CLILib\TestLib\StringOutput());
94+
Logger::setHandle(new \HH\Lib\IO\MemoryHandle());
9595
}
9696

9797
<<__Override>>

tests/SQLFunctionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ final class SQLFunctionTest extends HackTest {
357357
public static async function beforeFirstTestAsync(): Awaitable<void> {
358358
static::$conn = await SharedSetup::initAsync();
359359
// block hole logging
360-
Logger::setHandle(new \Facebook\CLILib\TestLib\StringOutput());
360+
Logger::setHandle(new \HH\Lib\IO\MemoryHandle());
361361
}
362362

363363
<<__Override>>

tests/SelectClauseTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ final class SelectClauseTest extends HackTest {
1313
public static async function beforeFirstTestAsync(): Awaitable<void> {
1414
static::$conn = await SharedSetup::initAsync();
1515
// block hole logging
16-
Logger::setHandle(new \Facebook\CLILib\TestLib\StringOutput());
16+
Logger::setHandle(new \HH\Lib\IO\MemoryHandle());
1717
}
1818

1919
<<__Override>>

0 commit comments

Comments
 (0)