Skip to content

Commit 26ca700

Browse files
committed
Execute redis tests with github actions
1 parent f7749c3 commit 26ca700

17 files changed

+94
-15
lines changed

.github/workflows/tests.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
9+
redis-tests:
10+
name: Redis tests
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
php: [7.2, 7.3, 7.4]
15+
services:
16+
redis:
17+
image: redis
18+
ports:
19+
- 6379:6379
20+
redis-cluster:
21+
image: grokzen/redis-cluster:4.0.8
22+
ports:
23+
- 7000:7000
24+
- 7001:7001
25+
- 7002:7002
26+
- 7003:7003
27+
- 7004:7004
28+
- 7005:7005
29+
container:
30+
image: jakzal/phpqa:php${{ matrix.php }}
31+
steps:
32+
- uses: actions/checkout@v2
33+
# Install system dependencies
34+
- run: 'apt-get update && apt-get install -y autoconf file g++ gcc libc-dev pkg-config re2c'
35+
- run: 'pecl install redis && docker-php-ext-enable redis'
36+
# Configure PHP & Composer
37+
- run: echo memory_limit = -1 >> /usr/local/etc/php/conf.d/custom.ini
38+
- run: '[ -d ~/.composer ] || mkdir ~/.composer'
39+
- run: cp .github/composer-config.json ~/.composer/config.json
40+
# Configure the build
41+
- run: echo "::set-env name=SYMFONY_VERSION::$(cat composer.json | grep '^ *\"dev-master\". *\"[1-9]' | grep -o '[0-9.]*')"
42+
- run: echo "::set-env name=COMPOSER_ROOT_VERSION::$SYMFONY_VERSION.x-dev"
43+
# Install dependencies
44+
- run: composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-master
45+
- run: composer update --no-progress --no-suggest --ansi
46+
- run: ./phpunit install
47+
# Run tests
48+
- run: ./phpunit --group redis --verbose
49+
env:
50+
REDIS_HOST: redis
51+
REDIS_CLUSTER_HOSTS: 'redis-cluster:7000 redis-cluster:7001 redis-cluster:7002 redis-cluster:7003 redis-cluster:7004 redis-cluster:7005'
52+

.travis.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ cache:
4040
services:
4141
- memcached
4242
- mongodb
43-
- redis-server
4443
- docker
4544

4645
before_install:
@@ -52,12 +51,6 @@ before_install:
5251
sudo rm /etc/apt/sources.list.d/mongodb-3.4.list
5352
sudo apt update
5453
55-
- |
56-
# Start Redis cluster
57-
docker pull grokzen/redis-cluster:4.0.8
58-
docker run -d -p 7000:7000 -p 7001:7001 -p 7002:7002 -p 7003:7003 -p 7004:7004 -p 7005:7005 --name redis-cluster grokzen/redis-cluster:4.0.8
59-
export REDIS_CLUSTER_HOSTS='localhost:7000 localhost:7001 localhost:7002 localhost:7003 localhost:7004 localhost:7005'
60-
6154
- |
6255
# General configuration
6356
set -e
@@ -67,7 +60,7 @@ before_install:
6760
[ -d ~/.composer ] || mkdir ~/.composer
6861
cp .github/composer-config.json ~/.composer/config.json
6962
export PHPUNIT=$(readlink -f ./phpunit)
70-
export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data"
63+
export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data,redis"
7164
export COMPOSER_UP='composer update --no-progress --no-suggest --ansi'
7265
export COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
7366
find ~/.phpenv -name xdebug.ini -delete
@@ -157,7 +150,6 @@ before_install:
157150
echo opcache.enable_cli = 1 >> $INI
158151
echo hhvm.jit = 0 >> $INI
159152
echo apc.enable_cli = 1 >> $INI
160-
echo extension = redis.so >> $INI
161153
echo extension = memcached.so >> $INI
162154
if [[ $PHP = 5.* ]]; then
163155
echo extension = memcache.so >> $INI
@@ -297,7 +289,7 @@ install:
297289
echo "$COMPONENTS" | xargs -n1 -I{} tar --append -f ~/php-ext/composer-lowest.lock.tar {}/composer.lock
298290
elif [[ $PHP = hhvm* ]]; then
299291
rm src/Symfony/Bridge/PhpUnit -Rf
300-
$PHPUNIT --exclude-group no-hhvm,benchmark,intl-data
292+
$PHPUNIT --exclude-group no-hhvm,benchmark,intl-data,redis
301293
else
302294
echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}"
303295
tfold src/Symfony/Component/Console.tty $PHPUNIT src/Symfony/Component/Console --group tty

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function testCachePools()
2424

2525
/**
2626
* @requires extension redis
27+
* @group redis
2728
*/
2829
public function testRedisCachePools()
2930
{
@@ -49,6 +50,7 @@ public function testRedisCachePools()
4950

5051
/**
5152
* @requires extension redis
53+
* @group redis
5254
*/
5355
public function testRedisCustomCachePools()
5456
{

src/Symfony/Component/Cache/Tests/Adapter/PredisAdapterTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
use Predis\Connection\StreamConnection;
1515
use Symfony\Component\Cache\Adapter\RedisAdapter;
1616

17+
/**
18+
* @group redis
19+
*/
1720
class PredisAdapterTest extends AbstractRedisAdapterTest
1821
{
1922
public static function setUpBeforeClass()

src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
namespace Symfony\Component\Cache\Tests\Adapter;
1313

14+
/**
15+
* @group redis
16+
*/
1417
class PredisClusterAdapterTest extends AbstractRedisAdapterTest
1518
{
1619
public static function setUpBeforeClass()

src/Symfony/Component/Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
namespace Symfony\Component\Cache\Tests\Adapter;
1313

14+
/**
15+
* @group redis
16+
*/
1417
class PredisRedisClusterAdapterTest extends AbstractRedisAdapterTest
1518
{
1619
public static function setUpBeforeClass()

src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
use Symfony\Component\Cache\Adapter\RedisAdapter;
1616
use Symfony\Component\Cache\Traits\RedisProxy;
1717

18+
/**
19+
* @group redis
20+
*/
1821
class RedisAdapterTest extends AbstractRedisAdapterTest
1922
{
2023
public static function setUpBeforeClass()

src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
namespace Symfony\Component\Cache\Tests\Adapter;
1313

14+
/**
15+
* @group redis
16+
*/
1417
class RedisArrayAdapterTest extends AbstractRedisAdapterTest
1518
{
1619
public static function setUpBeforeClass()

src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
namespace Symfony\Component\Cache\Tests\Adapter;
1313

14+
/**
15+
* @group redis
16+
*/
1417
class RedisClusterAdapterTest extends AbstractRedisAdapterTest
1518
{
1619
public static function setUpBeforeClass()

src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
namespace Symfony\Component\Cache\Tests\Simple;
1313

14+
/**
15+
* @group redis
16+
*/
1417
class RedisArrayCacheTest extends AbstractRedisCacheTest
1518
{
1619
public static function setUpBeforeClass()

0 commit comments

Comments
 (0)