/
config.yml
148 lines (125 loc) · 4.7 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
version: 2
jobs:
build:
docker:
- image: circleci/php:7.1-node-browsers
steps:
- checkout
- run: sudo composer self-update
- run: make
- run: mkdir -p /tmp/artifacts
- run: cp archive.tar.gz /tmp/artifacts/plugin-package.tar.gz
- persist_to_workspace:
root: /tmp/artifacts
paths:
- plugin-package.tar.gz
test:
docker:
- image: circleci/php:7.1-node-browsers
steps:
- checkout
- run: sudo composer self-update
- restore_cache:
keys:
- composer-v1-{{ checksum "composer.lock" }}
# fallback to using the latest cache if no exact match is found (See https://circleci.com/docs/2.0/caching/)
- composer-v1-
- run: composer install --no-ansi --no-interaction --prefer-dist
# `_test` directory of dokuwiki is not included by `--prefer-dist` (maybe, this is GitHub issue).
# This is the fallback.
- run: |
if [ ! -d vendor/splitbrain/dokuwiki/_test ]; then
rm -rf vendor/splitbrain/dokuwiki
composer install --no-ansi --no-interaction --prefer-source
fi
- save_cache:
key: composer-v1-{{ checksum "composer.lock" }}
paths:
- vendor
- run: ./bin/php-cs-fixer fix --dry-run
- run: |
curl -o cc-test-reporter -sSL https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
chmod +x ./cc-test-reporter
- run: |
sudo docker-php-ext-enable xdebug
- run: |
./cc-test-reporter before-build
composer test -- --coverage-clover clover.xml
./cc-test-reporter after-build --exit-code $? \
--coverage-input-type clover
docker-test:
machine: true
steps:
- checkout
- run: docker-compose build
- restore_cache:
keys:
- composer-v1-{{ checksum "composer.lock" }}
# fallback to using the latest cache if no exact match is found (See https://circleci.com/docs/2.0/caching/)
- composer-v1-
- run: |
docker-compose up -d
sleep 10
- run: |
curl -v http://localhost:8080/start | \
grep 'simple paragraph: <em>emph</em>, <strong>strong</strong> and <code>mono</code>.'
- run: docker-compose down
deploy:
docker:
- image: circleci/golang:1.8
steps:
- checkout
- attach_workspace:
at: /tmp/artifacts
- run: go get github.com/tcnksm/ghr
- run: |
VERSION="${CIRCLE_TAG}"
ghr \
-t ${GITHUB_TOKEN} \
-u ${CIRCLE_PROJECT_USERNAME} \
-r ${CIRCLE_PROJECT_REPONAME} \
-c ${CIRCLE_SHA1} \
-n "Release ${VERSION}" \
"${VERSION}" \
/tmp/artifacts
- run: |
VERSION="${CIRCLE_TAG}"
git config user.email "release-bot@users.noreply.github.com"
git config user.name "release-bot"
git checkout release || git checkout -b release
cp /tmp/artifacts/plugin-package.tar.gz .
git add -f plugin-package.tar.gz
git commit -m "Automatic release $VERSION"
git remote add for-release \
"https://${GITHUB_TOKEN}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}"
git push -u for-release release
workflows:
version: 2
test:
jobs:
- test:
filters:
branches:
ignore: release
- docker-test:
requires:
- test
filters:
branches:
ignore: release
build-and-deploy:
jobs:
- build:
filters:
branches:
only: master
tags:
only: /.*/
- deploy:
requires:
- build
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/