Skip to content

Commit 778c46d

Browse files
authored
Replace Travis by Github Actions (#6)
* Create main.yml * Delete .travis.yml * Update readme.md * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update MysqlTest.php * Update MySqlDbTest.php * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update MySqlDbTest.php * Update MysqlTest.php * Update MysqlTest.php * Update MySqlDbTest.php * Update main.yml * Update main.yml * Update MySqlDbTest.php * Update main.yml * Update main.yml * Update PostgresTest.php * Update PostgreSqlDbTest.php * Update main.yml * Update PostgreSqlDbTest.php * Update main.yml * Update main.yml * Update MySqlDbTest.php * Update MysqlTest.php * Update main.yml * Update PostgresTest.php * Update PostgreSqlDbTest.php * Update PostgresTest.php * Update PostgresTest.php * Update PostgresTest.php * Update PostgresTest.php * Update PostgresTest.php * Update PostgresTest.php * Update PostgresTest.php * Update PostgresTest.php * Update PostgresTest.php * Update PostgreSqlDbTest.php * Update PostgreSqlDbTest.php * Update PostgreSqlDbTest.php * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update PostgreSqlDbTest.php * Update PostgresTest.php * Update PostgreSqlDbTest.php * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update MysqlTest.php * Update MySqlDbTest.php * Update MysqlTest.php * Update MySqlDbTest.php * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update MySqlDbTest.php * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update MysqlTest.php * Update MySqlDbTest.php * Update MySqlDbTest.php * Update MySqlDbTest.php * Update MySqlDbTest.php * Update MysqlTest.php * Update main.yml * Update MysqlTest.php * Update main.yml * Update MysqlTest.php * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update MysqlTest.php * Update MySqlDbTest.php * Update main.yml * Update main.yml * Update MySqlDbTest.php * Update MysqlTest.php * Update main.yml * Update MySqlDbTest.php * Update PostgreSqlDbTest.php * Update PostgresTest.php * Update PostgreSqlDbTest.php * Update PostgreSqlDbTest.php * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update composer.json * Update main.yml
1 parent 03c5337 commit 778c46d

File tree

8 files changed

+76
-51
lines changed

8 files changed

+76
-51
lines changed

.github/workflows/main.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
tests:
7+
runs-on: ubuntu-latest
8+
9+
services:
10+
mysql:
11+
image: mysql:5.7
12+
env:
13+
MYSQL_ALLOW_EMPTY_PASSWORD: true
14+
MYSQL_DATABASE: codeception_test
15+
ports:
16+
- 3306:3306
17+
options: >-
18+
--health-cmd "mysqladmin ping"
19+
--health-interval 10s
20+
--health-timeout 5s
21+
--health-retries 5
22+
postgres:
23+
image: postgres
24+
env:
25+
POSTGRES_PASSWORD: postgres
26+
POSTGRES_DB: codeception_test
27+
options: >-
28+
--health-cmd pg_isready
29+
--health-interval 10s
30+
--health-timeout 5s
31+
--health-retries 5
32+
ports:
33+
- 5432:5432
34+
35+
strategy:
36+
matrix:
37+
php: [5.6, 7.0, 7.1, 7.2, 7.3, 7.4]
38+
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v2
42+
43+
- name: Setup PHP
44+
uses: shivammathur/setup-php@v2
45+
with:
46+
php-version: ${{ matrix.php }}
47+
extensions: pdo, pgsql, mysql, sqlite
48+
coverage: none
49+
50+
- name: Validate composer.json and composer.lock
51+
run: composer validate
52+
53+
- name: Install dependencies
54+
run: composer install --prefer-dist --no-progress --no-interaction --no-suggest
55+
56+
- name: Run test suite
57+
run: php vendor/bin/codecept run
58+
env:
59+
PGPASSWORD: postgres
60+
MYSQL_HOST: 127.0.0.1

.travis.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
}
1515
],
1616
"minimum-stability": "RC",
17-
1817
"require": {
1918
"php": ">=5.6.0 <8.0",
20-
"codeception/codeception": "*@dev"
19+
"codeception/codeception": "^4.0"
2120
},
2221
"require-dev": {
2322
"codeception/util-robohelpers": "dev-master"

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Db module for Codeception
22

3-
[![Build Status](https://travis-ci.org/Codeception/module-db.svg?branch=master)](https://travis-ci.org/Codeception/module-db)
3+
![Build Status](https://github.com/Codeception/module-db/workflows/CI/badge.svg)
44

55
## Installation
66

tests/unit/Codeception/Lib/Driver/MysqlTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ class MysqlTest extends Unit
2323

2424
public static function _setUpBeforeClass()
2525
{
26-
if (getenv('APPVEYOR')) {
27-
self::$config['password'] = 'Password12!';
28-
}
26+
$host = getenv('MYSQL_HOST') ? getenv('MYSQL_HOST') : 'localhost';
27+
self::$config['dsn'] = 'mysql:host='.$host.';dbname=codeception_test';
28+
self::$config['password'] = getenv('MYSQL_PASSWORD') ? getenv('MYSQL_PASSWORD') : '';
29+
2930
$sql = file_get_contents(\Codeception\Configuration::dataDir() . '/dumps/mysql.sql');
3031
$sql = preg_replace('%/\*(?:(?!\*/).)*\*/%s', "", $sql);
3132
self::$sql = explode("\n", $sql);

tests/unit/Codeception/Lib/Driver/PostgresTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ public static function _setUpBeforeClass()
2323
if (!function_exists('pg_connect')) {
2424
return;
2525
}
26-
if (getenv('APPVEYOR')) {
27-
self::$config['password'] = 'Password12!';
28-
}
26+
self::$config['password'] = getenv('PGPASSWORD') ? getenv('PGPASSWORD') : null;
2927
$sql = file_get_contents(codecept_data_dir('dumps/postgres.sql'));
3028
$sql = preg_replace('%/\*(?:(?!\*/).)*\*/%s', '', $sql);
3129
self::$sql = explode("\n", $sql);

tests/unit/Codeception/Module/Db/MySqlDbTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,26 @@
33
require_once \Codeception\Configuration::testsDir().'unit/Codeception/Module/Db/TestsForDb.php';
44

55
/**
6-
* @group appveyor
76
* @group db
87
*/
98
class MySqlDbTest extends TestsForDb
109
{
1110
public function getPopulator()
1211
{
13-
if (getenv('APPVEYOR')) {
14-
$this->markTestSkipped('Disabled on Appveyor');
15-
}
1612
$config = $this->getConfig();
1713
$password = $config['password'] ? '-p'.$config['password'] : '';
1814
return "mysql -u \$user $password \$dbname < {$config['dump']}";
1915
}
2016

2117
public function getConfig()
2218
{
19+
$host = getenv('MYSQL_HOST') ? getenv('MYSQL_HOST') : 'localhost';
20+
$password = getenv('MYSQL_PASSWORD') ? getenv('MYSQL_PASSWORD') : '';
21+
2322
return [
24-
'dsn' => 'mysql:host=localhost;dbname=codeception_test',
23+
'dsn' => 'mysql:host='.$host.';dbname=codeception_test',
2524
'user' => 'root',
26-
'password' => getenv('APPVEYOR') ? 'Password12!' : '',
25+
'password' => $password,
2726
'dump' => 'tests/data/dumps/mysql.sql',
2827
'reconnect' => true,
2928
'cleanup' => true,

tests/unit/Codeception/Module/Db/PostgreSqlDbTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,26 @@
33
require_once \Codeception\Configuration::testsDir().'unit/Codeception/Module/Db/TestsForDb.php';
44

55
/**
6-
* @group appveyor
76
* @group db
87
*/
98
class PostgreSqlDbTest extends TestsForDb
109
{
1110
public function getPopulator()
1211
{
13-
if (getenv('APPVEYOR')) {
14-
$this->markTestSkipped('Disabled on Appveyor');
15-
}
16-
return "psql -d codeception_test -U postgres < tests/data/dumps/postgres.sql";
12+
return "psql -h localhost -d codeception_test -U postgres < tests/data/dumps/postgres.sql";
1713
}
1814

1915
public function getConfig()
2016
{
2117
if (!function_exists('pg_connect')) {
2218
$this->markTestSkipped();
2319
}
20+
$password = getenv('PGPASSWORD') ? getenv('PGPASSWORD') : null;
21+
2422
return [
2523
'dsn' => 'pgsql:host=localhost;dbname=codeception_test',
2624
'user' => 'postgres',
27-
'password' => getenv('APPVEYOR') ? 'Password12!' : null,
25+
'password' => $password,
2826
'dump' => 'tests/data/dumps/postgres.sql',
2927
'reconnect' => true,
3028
'cleanup' => true,

0 commit comments

Comments
 (0)