|
1 | | -version: 2 |
| 1 | +version: 2.1 |
2 | 2 |
|
3 | | -references: |
4 | | - restore_dependencies_cache: &restore_dependencies_cache |
5 | | - restore_cache: |
6 | | - key: v1-deps-{{ checksum "composer.json" }} |
| 3 | +orbs: |
| 4 | + aws-s3: circleci/[email protected] # use the AWS S3 orb in your config |
7 | 5 |
|
8 | | - install_dependencies: &install_dependencies |
9 | | - run: composer install |
10 | | - |
11 | | - save_dependencies_cache: &save_dependencies_cache |
12 | | - save_cache: |
13 | | - paths: [./vendor] |
14 | | - key: v1-deps-{{ checksum "composer.json" }} |
15 | | - |
16 | | - restore_phpunit_cache: &restore_phpunit_cache |
17 | | - restore_cache: |
18 | | - key: v1-phpunit-{{ checksum "composer.json" }} |
19 | | - |
20 | | - install_phpunit: &install_phpunit |
21 | | - run: php vendor/bin/simple-phpunit install |
22 | | - |
23 | | - save_phpunit_cache: &save_phpunit_cache |
24 | | - save_cache: |
25 | | - paths: [./bin/.phpunit] |
26 | | - key: v1-phpunit-{{ checksum "composer.json" }} |
| 6 | +jobs: |
| 7 | + tests-php-cs: |
| 8 | + docker: |
| 9 | + - image: php:8.0-cli-alpine |
| 10 | + steps: |
| 11 | + - checkout |
| 12 | + - run: wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.19.0/php-cs-fixer.phar |
| 13 | + - run: php php-cs-fixer.phar fix --dry-run --diff |
27 | 14 |
|
28 | | - run_tests: &run_tests |
29 | | - resource_class: small |
| 15 | + tests-phpunit: |
| 16 | + parameters: |
| 17 | + php-version: |
| 18 | + type: string |
| 19 | + docker: |
| 20 | + - image: circleci/php:<< parameters.php-version >> |
30 | 21 | steps: |
| 22 | + - run: sudo composer self-update |
| 23 | + |
31 | 24 | - checkout |
32 | 25 |
|
33 | 26 | # Dependencies |
34 | | - - *restore_dependencies_cache |
35 | | - - *install_dependencies |
36 | | - - *save_dependencies_cache |
| 27 | + - restore_cache: |
| 28 | + key: v1-deps-{{ checksum "composer.json" }} |
| 29 | + - run: composer install |
| 30 | + - save_cache: |
| 31 | + paths: [ ./vendor ] |
| 32 | + key: v1-deps-{{ checksum "composer.json" }} |
37 | 33 |
|
38 | 34 | # Install PHPUnit |
39 | | - - *restore_phpunit_cache |
40 | | - - *install_phpunit |
41 | | - - *save_phpunit_cache |
| 35 | + - restore_cache: |
| 36 | + key: v1-phpunit-{{ checksum "composer.json" }} |
| 37 | + - run: php vendor/bin/simple-phpunit install |
| 38 | + - save_cache: |
| 39 | + paths: [ ./bin/.phpunit ] |
| 40 | + key: v1-phpunit-{{ checksum "composer.json" }} |
42 | 41 |
|
43 | 42 | # Run the tests |
44 | 43 | - run: php vendor/bin/simple-phpunit -v --log-junit ./phpunit/junit.xml |
45 | 44 | - store_test_results: |
46 | 45 | path: ./phpunit |
47 | 46 |
|
48 | | -jobs: |
49 | | - php-cs: |
| 47 | + release: |
50 | 48 | docker: |
51 | | - - image: php:7.2-cli-alpine |
52 | | - resource_class: small |
| 49 | + - image: circleci/php:7.4 |
53 | 50 | steps: |
54 | | - - checkout |
55 | | - - run: wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.13.1/php-cs-fixer.phar |
56 | | - - run: php php-cs-fixer.phar fix --dry-run --diff |
57 | | - |
58 | | - tests-php-7-1: |
59 | | - docker: |
60 | | - - image: circleci/php:7.1 |
61 | | - <<: *run_tests |
62 | | - |
63 | | - tests-php-7-2: |
64 | | - docker: |
65 | | - - image: circleci/php:7.2 |
66 | | - <<: *run_tests |
| 51 | + - run: sudo composer self-update |
67 | 52 |
|
68 | | - tests-php-7-3: |
69 | | - docker: |
70 | | - - image: circleci/php:7.3 |
71 | | - <<: *run_tests |
| 53 | + - checkout |
72 | 54 |
|
73 | | - tests-php-7-4: |
74 | | - docker: |
75 | | - - image: circleci/php:7.4 |
76 | | - <<: *run_tests |
| 55 | + # Dependencies |
| 56 | + - restore_cache: |
| 57 | + key: v1-deps-{{ checksum "composer.json" }} |
| 58 | + - run: composer install |
| 59 | + - save_cache: |
| 60 | + paths: [ ./vendor ] |
| 61 | + key: v1-deps-{{ checksum "composer.json" }} |
| 62 | + |
| 63 | + # Build |
| 64 | + - run: wget https://github.com/box-project/box/releases/download/3.13.0/box.phar -O /tmp/box.phar |
| 65 | + - run: php /tmp/box.phar build |
| 66 | + |
| 67 | + # Test |
| 68 | + - run: build/insight.phar list |
| 69 | + |
| 70 | + # Release |
| 71 | + - aws-s3/copy: |
| 72 | + from: build/insight.phar |
| 73 | + to: 's3://get.insight.symfony.com/insight.phar' |
| 74 | + arguments: '--acl public-read' |
77 | 75 |
|
78 | 76 | workflows: |
79 | 77 | version: 2 |
80 | 78 | test: |
81 | 79 | jobs: |
82 | | - - php-cs |
83 | | - - tests-php-7-1 |
84 | | - - tests-php-7-2 |
85 | | - - tests-php-7-3 |
86 | | - - tests-php-7-4 |
| 80 | + - tests-php-cs |
| 81 | + - tests-phpunit: |
| 82 | + matrix: |
| 83 | + parameters: |
| 84 | + php-version: ['7.1', '7.2', '7.3', '7.4', '8.0'] |
| 85 | + - release: |
| 86 | + requires: [tests-phpunit] |
| 87 | + filters: |
| 88 | + branches: |
| 89 | + only: ['master'] |
0 commit comments