1
1
version : 2
2
2
jobs :
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
+
5
10
steps :
6
11
- 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)
19
12
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 :
21
46
machine : true
22
47
steps :
23
48
- checkout
@@ -27,32 +52,21 @@ jobs:
27
52
- run :
28
53
name : Login to Docker Hub and push image
29
54
command : |
30
- export TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
31
-
32
55
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
33
56
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
36
57
37
58
workflows :
38
59
version : 2
39
- test :
60
+ test_app :
40
61
jobs :
41
- - test
42
- deploy :
62
+ - test_deps
63
+ - test_run :
64
+ requires :
65
+ - test_deps
66
+ deploy_latest :
43
67
jobs :
44
68
- deploy :
45
69
filters :
46
70
branches :
47
71
only :
48
72
- 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