Optimized test.yml. (#5181)

This commit is contained in:
李铭昕 2022-11-07 12:27:22 +08:00 committed by GitHub
parent 821379bf4c
commit 195fe8e362
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 19 deletions

View File

@ -63,19 +63,7 @@ jobs:
- name: Setup Packages
run: ./.travis/requirement.install.sh
- name: Setup Services
run: |
docker run --name mysql -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d mysql:${MYSQL_VERSION} --bind-address=0.0.0.0 --default-authentication-plugin=mysql_native_password
docker run --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=postgres -d postgres:${PGSQL_VERSION}
docker run --name redis -p 6379:6379 -d redis
docker run -d --name dev-consul -e CONSUL_BIND_INTERFACE=eth0 -p 8500:8500 consul
docker run --name nsq -p 4150:4150 -p 4151:4151 -p 4160:4160 -p 4161:4161 -p 4170:4170 -p 4171:4171 --entrypoint /bin/nsqd -d nsqio/nsq:latest
docker run -d --restart=always --name rabbitmq -p 4369:4369 -p 5672:5672 -p 15672:15672 -p 25672:25672 rabbitmq:management-alpine
docker build --tag grpc-server:latest src/grpc-client/tests/Mock
docker run -d --name grpc-server -p 50051:50051 grpc-server:latest
docker build src/grpc-client/tests/Golang -t go-grpc-server:latest
docker run -d --name go-grpc-server -p 50052:50052 go-grpc-server:latest
docker build -t tcp-server:latest .travis/tcp_server
docker run -d --name tcp-server -p 10001:10001 tcp-server:latest
run: ./.travis/setup.services.sh
- name: Setup Mysql
run: export TRAVIS_BUILD_DIR=$(pwd) && bash ./.travis/setup.mysql.sh
- name: Setup PostgreSQL
@ -83,9 +71,4 @@ jobs:
- name: Run Scripts Before Test
run: cp .travis/.env.example .env
- name: Run Test Cases
run: |
composer analyse src
composer test -- --exclude-group NonCoroutine
vendor/bin/phpunit --group NonCoroutine
vendor/bin/phpunit src/filesystem --group NonCoroutine
vendor/bin/php-cs-fixer fix src --dry-run
run: ./.travis/run.test.sh

6
.travis/run.test.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
composer analyse src
php -dswoole.use_shortname='Off' bin/co-phpunit --exclude-group NonCoroutine
php -dswoole.use_shortname='Off' vendor/bin/phpunit --group NonCoroutine
php -dswoole.use_shortname='Off' vendor/bin/phpunit src/filesystem --group NonCoroutine
vendor/bin/php-cs-fixer fix src --dry-run

13
.travis/setup.services.sh Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
docker run --name mysql -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d mysql:${MYSQL_VERSION} --bind-address=0.0.0.0 --default-authentication-plugin=mysql_native_password
docker run --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=postgres -d postgres:${PGSQL_VERSION}
docker run --name redis -p 6379:6379 -d redis
docker run -d --name dev-consul -e CONSUL_BIND_INTERFACE=eth0 -p 8500:8500 consul
docker run --name nsq -p 4150:4150 -p 4151:4151 -p 4160:4160 -p 4161:4161 -p 4170:4170 -p 4171:4171 --entrypoint /bin/nsqd -d nsqio/nsq:latest
docker run -d --restart=always --name rabbitmq -p 4369:4369 -p 5672:5672 -p 15672:15672 -p 25672:25672 rabbitmq:management-alpine
docker build --tag grpc-server:latest src/grpc-client/tests/Mock
docker run -d --name grpc-server -p 50051:50051 grpc-server:latest
docker build src/grpc-client/tests/Golang -t go-grpc-server:latest
docker run -d --name go-grpc-server -p 50052:50052 go-grpc-server:latest
docker build -t tcp-server:latest .travis/tcp_server
docker run -d --name tcp-server -p 10001:10001 tcp-server:latest