|
1 | 1 |
|
2 |
| -version: 2 |
3 |
| - |
4 |
| -_custom: |
5 |
| - step__run__install_php_extensions: &step__run__install_php_extensions |
6 |
| - name: 'Install PHP extensions' |
7 |
| - command: | |
8 |
| - sudo apt-get -y install zlib1g-dev |
9 |
| - sudo docker-php-ext-install zip |
10 |
| - step__run__install_composer: &step__run__install_composer |
11 |
| - name: 'Install composer' |
12 |
| - command: | |
13 |
| - cd /tmp |
14 |
| - EXPECTED_SIGNATURE=$(curl -q https://composer.github.io/installer.sig) |
15 |
| - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" |
16 |
| - ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');") |
17 |
| -
|
18 |
| - if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ] |
19 |
| - then |
20 |
| - >&2 echo 'ERROR: Invalid installer signature' |
21 |
| - rm composer-setup.php |
22 |
| -
|
23 |
| - exit 1 |
24 |
| - fi |
25 |
| -
|
26 |
| - sudo php composer-setup.php --quiet --install-dir /usr/local/bin --filename composer |
27 |
| - RESULT=$? |
28 |
| - rm composer-setup.php |
29 |
| -
|
30 |
| - exit $RESULT |
31 |
| - step__restore_cache: &step__restore_cache |
32 |
| - name: 'Cache restore - "./vendor"' |
33 |
| - keys: |
34 |
| - - 'v1-dependencies-{{ checksum "composer.lock" }}' |
35 |
| - - 'v1-dependencies-' |
36 |
| - step__run__composer_install: &step__run__composer_install |
37 |
| - name: 'Build' |
38 |
| - command: 'composer install --no-interaction' |
39 |
| - step__save_cache: &step__save_cache |
40 |
| - name: 'Cache save - "./vendor"' |
41 |
| - paths: |
42 |
| - - './vendor' |
43 |
| - key: 'v1-dependencies-{{ checksum "composer.lock" }}' |
44 |
| - step__run__linters: &step__run__linters |
45 |
| - name: 'Run linters' |
46 |
| - command: 'bin/robo lint' |
47 |
| - step__run__codeception_unit: &step__run__codeception_unit |
48 |
| - name: 'Codeception - unit' |
49 |
| - command: 'bin/robo test unit' |
50 |
| - step__run__codeception_acceptance: &step__run__codeception_acceptance |
51 |
| - name: 'Codeception - acceptance' |
52 |
| - command: 'bin/robo test acceptance' |
53 |
| - step__store_test_results: &step__store_test_results |
54 |
| - path: 'tests/_output/machine/junit' |
55 |
| - step__run__codecov: &step__run__codecov |
56 |
| - name: 'Publish the code coverage report on Codecov.io' |
57 |
| - when: 'always' |
58 |
| - command: > |
59 |
| - [ ! -s tests/_output/machine/coverage/*/coverage.xml ] |
60 |
| - || bash <(curl -s https://codecov.io/bash) |
61 |
| - || true |
62 |
| -
|
63 |
| - job__lint_and_test: &job__lint_and_test |
64 |
| - working_directory: '~/repo' |
65 |
| - steps: |
66 |
| - - 'checkout' |
| 2 | +version: 2.1 |
| 3 | + |
| 4 | +.env_composer: &env_composer |
| 5 | + COMPOSER_NO_INTERACTION: '1' |
| 6 | + COMPOSER_MEMORY_LIMIT: '-1' |
| 7 | + COMPOSER_DISABLE_XDEBUG_WARN: '1' |
| 8 | + |
| 9 | +orbs: |
| 10 | + codecov: codecov/codecov@1.0.5 |
| 11 | + |
| 12 | +executors: |
| 13 | + php704: |
| 14 | + environment: |
| 15 | + <<: *env_composer |
| 16 | + |
| 17 | + docker: |
67 | 18 | -
|
68 |
| - run: |
69 |
| - <<: *step__run__install_php_extensions |
| 19 | + name: 'main' |
| 20 | + image: 'circleci/php:7.4' |
| 21 | + |
| 22 | + php703: |
| 23 | + environment: |
| 24 | + <<: *env_composer |
| 25 | + |
| 26 | + docker: |
70 | 27 | -
|
71 |
| - run: |
72 |
| - <<: *step__run__install_composer |
| 28 | + name: 'main' |
| 29 | + image: 'circleci/php:7.3' |
| 30 | + |
| 31 | + php702: |
| 32 | + environment: |
| 33 | + <<: *env_composer |
| 34 | + |
| 35 | + docker: |
| 36 | + - |
| 37 | + name: 'main' |
| 38 | + image: 'circleci/php:7.2' |
| 39 | + |
| 40 | +commands: |
| 41 | + composer_install: |
| 42 | + description: 'Install Composer dependencies with cache restore and save' |
| 43 | + steps: |
73 | 44 | -
|
74 | 45 | restore_cache:
|
75 |
| - <<: *step__restore_cache |
| 46 | + name: 'Composer - cache restore' |
| 47 | + keys: |
| 48 | + - 'composer-{{ checksum "./composer.lock" }}-1' |
| 49 | + |
76 | 50 | -
|
77 | 51 | run:
|
78 |
| - <<: *step__run__composer_install |
| 52 | + name: 'Composer - install' |
| 53 | + command: > |
| 54 | + [[ -d "$(composer config vendor-dir)" ]] || composer install --no-progress |
| 55 | +
|
79 | 56 | -
|
80 | 57 | save_cache:
|
81 |
| - <<: *step__save_cache |
| 58 | + name: 'Composer - cache save' |
| 59 | + key: 'composer-{{ checksum "./composer.lock" }}-1' |
| 60 | + paths: |
| 61 | + - './bin/' |
| 62 | + - './vendor/' |
| 63 | + - '~/.composer/cache/' |
| 64 | + |
| 65 | + |
| 66 | + lint: |
| 67 | + description: 'Run linters' |
| 68 | + steps: |
82 | 69 | -
|
83 | 70 | run:
|
84 |
| - <<: *step__run__linters |
| 71 | + name: 'Run linters' |
| 72 | + command: 'bin/robo lint' |
| 73 | + |
| 74 | + test: |
| 75 | + description: 'Run tests' |
| 76 | + steps: |
85 | 77 | -
|
86 | 78 | run:
|
87 |
| - <<: *step__run__codeception_unit |
| 79 | + name: 'Codeception - unit' |
| 80 | + command: 'bin/robo test unit' |
| 81 | + - |
| 82 | + codecov/upload: |
| 83 | + flags: 'unit' |
| 84 | + file: './tests/_output/machine/coverage/unit/coverage.xml' |
88 | 85 | -
|
89 | 86 | run:
|
90 |
| - <<: *step__run__codeception_acceptance |
| 87 | + name: 'Codeception - acceptance' |
| 88 | + command: 'bin/robo test acceptance' |
91 | 89 | -
|
92 |
| - store_test_results: |
93 |
| - <<: *step__store_test_results |
| 90 | + codecov/upload: |
| 91 | + flags: 'acceptance' |
| 92 | + file: './tests/_output/machine/coverage/acceptance/coverage.xml' |
94 | 93 | -
|
95 |
| - run: |
96 |
| - <<: *step__run__codecov |
| 94 | + store_test_results: |
| 95 | + name: 'Store unit test results' |
| 96 | + path: './tests/_output/machine/junit' |
97 | 97 |
|
98 | 98 | jobs:
|
99 |
| - php701__lint_and_test: |
100 |
| - <<: *job__lint_and_test |
101 |
| - docker: |
102 |
| - - |
103 |
| - image: 'circleci/php:7.1' |
104 |
| - php702__lint_and_test: |
105 |
| - <<: *job__lint_and_test |
106 |
| - docker: |
107 |
| - - |
108 |
| - image: 'circleci/php:7.2' |
| 99 | + build: |
| 100 | + executor: 'php702' |
| 101 | + working_directory: '~/repo' |
| 102 | + steps: |
| 103 | + - 'checkout' |
| 104 | + - 'composer_install' |
| 105 | + lint: |
| 106 | + executor: 'php702' |
| 107 | + working_directory: '~/repo' |
| 108 | + steps: |
| 109 | + - 'checkout' |
| 110 | + - 'composer_install' |
| 111 | + - 'lint' |
| 112 | + test_php704: |
| 113 | + executor: 'php704' |
| 114 | + working_directory: '~/repo' |
| 115 | + steps: |
| 116 | + - 'checkout' |
| 117 | + - 'composer_install' |
| 118 | + - 'test' |
| 119 | + test_php703: |
| 120 | + executor: 'php703' |
| 121 | + working_directory: '~/repo' |
| 122 | + steps: |
| 123 | + - 'checkout' |
| 124 | + - 'composer_install' |
| 125 | + - 'test' |
| 126 | + test_php702: |
| 127 | + executor: 'php702' |
| 128 | + working_directory: '~/repo' |
| 129 | + steps: |
| 130 | + - 'checkout' |
| 131 | + - 'composer_install' |
| 132 | + - 'test' |
109 | 133 |
|
110 | 134 | workflows:
|
111 |
| - version: 2 |
112 |
| - php701__lint_and_test: |
| 135 | + lint_and_test: |
113 | 136 | jobs:
|
114 |
| - - 'php701__lint_and_test' |
115 |
| - php702__lint_and_test: |
116 |
| - jobs: |
117 |
| - - 'php702__lint_and_test' |
| 137 | + - |
| 138 | + build: {} |
| 139 | + - |
| 140 | + lint: |
| 141 | + requires: |
| 142 | + - build |
| 143 | + - |
| 144 | + test_php704: |
| 145 | + requires: |
| 146 | + - build |
| 147 | + - |
| 148 | + test_php703: |
| 149 | + requires: |
| 150 | + - build |
| 151 | + - |
| 152 | + test_php702: |
| 153 | + requires: |
| 154 | + - build |
0 commit comments