Skip to content

Commit c1b6dae

Browse files
[6.x] Added a way to run the CI tests locally (#31551)
* Added a way to run the CI tests locally * Update test.sh Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent 83e8e7b commit c1b6dae

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
CHANGELOG-* export-ignore
1212
CODE_OF_CONDUCT.md export-ignore
1313
CONTRIBUTING.md export-ignore
14+
docker-compose.yml export-ignore
1415
phpunit.xml.dist export-ignore

bin/release.sh

100644100755
File mode changed.

bin/test.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
docker-compose down -t 0 &> /dev/null
4+
docker-compose up -d
5+
6+
echo "Waiting for services to boot..."
7+
8+
if docker run -it --rm registry.gitlab.com/grahamcampbell/php:7.4-base -r "\$tries = 0; while (true) { try { \$tries++; if (\$tries > 30) { throw new RuntimeException('MySQL never became available'); } sleep(1); new PDO('mysql:host=docker.for.mac.localhost;dbname=forge', 'root', '', [PDO::ATTR_TIMEOUT => 3]); break; } catch (PDOException \$e) {} }"; then
9+
if docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit \
10+
--env CI=1 --env DB_HOST=docker.for.mac.localhost \
11+
--env REDIS_HOST=docker.for.mac.localhost --env REDIS_PORT=6379 \
12+
--env MEMCACHED_HOST=docker.for.mac.localhost --env MEMCACHED_PORT=11211 \
13+
--rm registry.gitlab.com/grahamcampbell/php:7.4-base "$@"; then
14+
docker-compose down -t 0
15+
else
16+
docker-compose down -t 0
17+
exit 1
18+
fi
19+
else
20+
docker-compose logs
21+
docker-compose down -t 0 &> /dev/null
22+
exit 1
23+
fi

docker-compose.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: '3'
2+
services:
3+
memcached:
4+
image: memcached:1.5-alpine
5+
ports:
6+
- "11211:11211"
7+
restart: always
8+
mysql:
9+
image: mysql:5.7
10+
environment:
11+
MYSQL_ALLOW_EMPTY_PASSWORD: 1
12+
MYSQL_ROOT_PASSWORD: ""
13+
MYSQL_DATABASE: "forge"
14+
ports:
15+
- "3306:3306"
16+
restart: always
17+
redis:
18+
image: redis:5.0-alpine
19+
ports:
20+
- "6379:6379"
21+
restart: always

0 commit comments

Comments
 (0)