Skip to content

[6.x] Added a way to run the CI tests locally #31551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
CHANGELOG-* export-ignore
CODE_OF_CONDUCT.md export-ignore
CONTRIBUTING.md export-ignore
docker-compose.yml export-ignore
phpunit.xml.dist export-ignore
Empty file modified bin/release.sh
100644 → 100755
Empty file.
23 changes: 23 additions & 0 deletions bin/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

docker-compose down -t 0 &> /dev/null
docker-compose up -d

echo "Waiting for services to boot..."

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
if docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit \
--env CI=1 --env DB_HOST=docker.for.mac.localhost \
--env REDIS_HOST=docker.for.mac.localhost --env REDIS_PORT=6379 \
--env MEMCACHED_HOST=docker.for.mac.localhost --env MEMCACHED_PORT=11211 \
--rm registry.gitlab.com/grahamcampbell/php:7.4-base "$@"; then
docker-compose down -t 0
else
docker-compose down -t 0
exit 1
fi
else
docker-compose logs
docker-compose down -t 0 &> /dev/null
exit 1
fi
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: '3'
services:
memcached:
image: memcached:1.5-alpine
ports:
- "11211:11211"
restart: always
mysql:
image: mysql:5.7
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 1
MYSQL_ROOT_PASSWORD: ""
MYSQL_DATABASE: "forge"
ports:
- "3306:3306"
restart: always
redis:
image: redis:5.0-alpine
ports:
- "6379:6379"
restart: always