forked from vimeo/psalm
/
config.yml
153 lines (151 loc) · 5.04 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# Use the latest 2.1 version of CircleCI pipeline processing engine, see https://circleci.com/docs/2.0/configuration-reference/
version: 2.1
executors:
php-72:
docker:
- image: thecodingmachine/php:7.2-v2-cli
php-74:
docker:
- image: thecodingmachine/php:7.4-v3-cli
jobs:
install-and-self-analyse:
executor: php-72
steps:
- checkout
- run: date "+%F" > /tmp/cachekey; cat composer.json >> /tmp/cachekey
- restore_cache:
keys:
- composer-v2-{{ checksum "/tmp/cachekey" }}
# fallback to using the latest cache if no exact match is found (See https://circleci.com/docs/2.0/caching/)
- composer-v2-
- restore_cache:
keys:
- psalm-cache-{{ checksum "/tmp/cachekey" }} # speeds up run with --diff and --diff-methods
- run: composer update
- save_cache:
key: composer-v2-{{ checksum "/tmp/cachekey" }}
paths:
- vendor
- save_cache:
key: psalm-cache-{{ checksum "/tmp/cachekey" }}
paths:
- /tmp/psalm
- run:
name: Static analysis
command: php -dextension=pcntl.so ./psalm --threads=10 --diff --diff-methods
- persist_to_workspace:
root: /home/docker/project/
paths:
- .
"Code Style Analysis":
executor: php-72
steps:
- attach_workspace:
at: /home/docker/project/
- run:
name: Code Style Analysis with PHPCS
command: vendor/bin/phpcs
test:
executor: php-72
steps:
- attach_workspace:
at: /home/docker/project/
- run:
name: PHPUnit test
command: php vendor/bin/phpunit --log-junit build/phpunit/phpunit.xml
- store_test_results:
path: build/
- store_artifacts:
path: build/phpunit
- persist_to_workspace:
root: /home/docker/project/
paths:
- .
coverage:
executor: php-72
steps:
- attach_workspace:
at: /home/docker/project/
- run:
name: PHPUnit test with coverage
command: php -dextension=pcov.so vendor/bin/phpunit --log-junit build/phpunit/phpunit.xml --coverage-xml build/phpunit/coverage-xml --coverage-html build/phpunit/
- store_artifacts:
path: build/phpunit
- run:
name: Display link to coverage report
command: |
echo "PHPUnit coverage report available at:"
echo https://circleci.com/api/v1.1/project/github/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/${CIRCLE_BUILD_NUM}/artifacts/0/home/docker/project/build/phpunit/index.html
- persist_to_workspace:
root: /home/docker/project/
paths:
- .
mutation:
executor: php-72
steps:
- attach_workspace:
at: /home/docker/project/
- run:
name: Install infection
command: composer global require infection/infection:dev-master # Currently only master has https://github.com/infection/infection/pull/1106 merged.
- run:
name: Mutation coverage testing
command: php -d memory_limit=4G ~/.composer/vendor/bin/infection --coverage=build/phpunit --only-covered --threads=2 || echo 'Temporarily ignoring unexplained infection failure'
phar-build:
executor: php-72
steps:
- attach_workspace:
at: /home/docker/project/
- run:
name: Build Phar file
command: bin/build-phar.sh
- run:
name: Smoke test Phar file
command: build/psalm.phar --version
- store_artifacts:
path: build/psalm.phar
- run:
name: Display link to phar file
command: |
echo "Phar build available at:"
echo https://circleci.com/api/v1.1/project/github/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/${CIRCLE_BUILD_NUM}/artifacts/0/home/docker/project/build/psalm.phar
- persist_to_workspace:
root: /home/docker/project/
paths:
- build/psalm.phar
test-with-real-projects:
executor: php-74
steps:
- checkout # used here just for the side effect of loading the github public ssh key so we can clone other stuff
- attach_workspace:
at: /home/docker/project/
- run:
name: Analyse PHPUnit
command: bin/test-with-real-projects.sh
- store_artifacts:
path: build/psalm.phar
# Orchestrate or schedule a set of jobs, see https://circleci.com/docs/2.0/workflows/
workflows:
Welcome:
jobs:
- install-and-self-analyse
- test:
requires:
- install-and-self-analyse
- "Code Style Analysis":
requires:
- install-and-self-analyse
- coverage:
requires:
- test
- "Code Style Analysis"
- mutation:
requires:
- coverage
- phar-build:
requires:
- test
- "Code Style Analysis"
- test-with-real-projects:
requires:
- phar-build