11version : 2
22jobs :
3- test :
4- machine : true
3+ test_deps :
4+ docker :
5+ # specify the version you desire here
6+ - image : roquie/composer-parallel
7+
8+ working_directory : ~/repo
9+
510 steps :
611 - checkout
7- - run :
8- name : Create testing environment & Run tests
9- command : docker build -f Dockerfile.test -t unit:latest .
10- # - run:
11- # name: Static analyse
12- # command: |
13- # vendor/bin/phpstan analyse -l 7 src
14- - run :
15- name : Send code coverage report to Codecov
16- command : |
17- docker run --rm -it -v $(pwd)/coverage:/tmp unit:latest
18- bash <(curl -s https://codecov.io/bash)
1912
20- deploy :
13+ # Download and cache dependencies
14+ - restore_cache :
15+ keys :
16+ - v1-dependencies-{{ checksum "composer.json" }}
17+ # fallback to using the latest cache if no exact match is found
18+ - v1-dependencies-
19+
20+ - run : composer install -n --prefer-dist --ignore-platform-reqs
21+
22+ - save_cache :
23+ paths :
24+ - ./vendor
25+ key : v1-dependencies-{{ checksum "composer.json" }}
26+ test_run :
27+ docker :
28+ # specify the version you desire here
29+ - image : spacetabio/amphp-alpine:7.4-wkhtmltopdf-xdebug-1.1.0
30+
31+ working_directory : ~/repo
32+
33+ steps :
34+ - checkout
35+ - restore_cache :
36+ keys :
37+ - v1-dependencies-{{ checksum "composer.json" }}
38+ - v1-dependencies-
39+
40+ - run : vendor/bin/phpstan analyse src --level 6
41+ - run : vendor/bin/phpunit --coverage-clover=coverage.xml
42+ - run : apk add bash
43+ - run : bash -c "bash <(curl -s https://codecov.io/bash)"
44+
45+ deploy_latest :
2146 machine : true
2247 steps :
2348 - checkout
@@ -27,32 +52,21 @@ jobs:
2752 - run :
2853 name : Login to Docker Hub and push image
2954 command : |
30- export TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
31-
3255 echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
3356 docker push microparts/static-server-php:latest
34- docker tag microparts/static-server-php:latest microparts/static-server-php:$TAG
35- docker push microparts/static-server-php:$TAG
3657
3758workflows :
3859 version : 2
39- test :
60+ test_app :
4061 jobs :
41- - test
42- deploy :
62+ - test_deps
63+ - test_run :
64+ requires :
65+ - test_deps
66+ deploy_latest :
4367 jobs :
4468 - deploy :
4569 filters :
4670 branches :
4771 only :
4872 - master
49- cron :
50- triggers :
51- - schedule :
52- cron : " 0 0 * * 1" # Every week on Monday
53- filters :
54- branches :
55- only :
56- - master
57- jobs :
58- - deploy
0 commit comments