-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircle.yml
103 lines (93 loc) · 3.83 KB
/
circle.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
general:
branches:
ignore:
- gh-pages
artifacts:
- build
machine:
environment:
NODE_0_PHP_VERSION: 7.0.4
NODE_1_PHP_VERSION: 5.6.14
NODE_2_PHP_VERSION: 5.5.21
php:
version: 7.0.4
dependencies:
pre:
- nvm alias default node
- npm config set progress false
- npm install -g npm
- sudo composer self-update
- composer global require --prefer-source --no-interaction hirak/prestissimo
override:
- npm install
- |
case "$CIRCLE_NODE_INDEX" in
0)
phpenv global "$NODE_0_PHP_VERSION"
;;
1)
phpenv global "$NODE_1_PHP_VERSION"
;;
2)
phpenv global "$NODE_2_PHP_VERSION"
;;
esac
composer install --prefer-source --no-interaction
cache_directories:
- node_modules
- "~/.composer/cache/files"
test:
pre:
- if [ -z "$CIRCLE_PULL_REQUEST" ]; then sed -i 's/^;//' "$HOME/.phpenv/versions/$(phpenv global)/etc/conf.d/xdebug.ini"; fi:
parallel: true
override:
- npm run-script lint-ci
- composer run-script test-ci:
parallel: true
post:
- if [ -z "$CIRCLE_PULL_REQUEST" ]; then vendor/bin/coveralls --verbose; fi:
parallel: true
deployment:
gh-pages:
owner: ecailles
branch: master
commands:
- |
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
REPOSITORY=${REPOSITORY:-"[email protected]:$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git"}
BRANCH=${BRANCH:-"gh-pages"}
APIGEN_BUILD_PATH=${APIGEN_BUILD_PATH:-"/tmp/apigen"}
GIT_AUTHOR_NAME=${GIT_AUTHOR_NAME:-"CircleCI"}
GIT_AUTHOR_EMAIL=${GIT_AUTHOR_EMAIL:-"[email protected]"}
git clone --quiet --branch "$BRANCH" --depth 1 "$REPOSITORY" "$APIGEN_BUILD_PATH" > /dev/null 2>&1
yes | vendor/bin/apigen generate -d "$APIGEN_BUILD_PATH"
cd "$APIGEN_BUILD_PATH" || exit 1
git config user.name "$GIT_AUTHOR_NAME"
git config user.email "$GIT_AUTHOR_EMAIL"
git add -A
git commit -m 'docs: generate API documentation'
git push --quiet origin "$BRANCH" > /dev/null 2>&1
fi
gh-pages-release:
owner: ecailles
tag: /v[0-9]+(\.[0-9]+)*/
commands:
- |
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
REPOSITORY=${REPOSITORY:-"[email protected]:$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git"}
BRANCH=${BRANCH:-"gh-pages"}
TAG="$CIRCLE_TAG-gh-pages"
TAG_MESSAGE=$(echo "$CIRCLE_TAG" | sed -e "s/v\([0-9]\+\(.[0-9]\+\)*\)/\1-gh-pages/")
APIGEN_BUILD_PATH=${APIGEN_BUILD_PATH:-"/tmp/apigen"}
GIT_AUTHOR_NAME=${GIT_AUTHOR_NAME:-"CircleCI"}
GIT_AUTHOR_EMAIL=${GIT_AUTHOR_EMAIL:-"[email protected]"}
git clone --quiet --branch "$BRANCH" --depth 1 "$REPOSITORY" "$APIGEN_BUILD_PATH" > /dev/null 2>&1
yes | vendor/bin/apigen generate -d "$APIGEN_BUILD_PATH"
cd "$APIGEN_BUILD_PATH" || exit 1
git config user.name "$GIT_AUTHOR_NAME"
git config user.email "$GIT_AUTHOR_EMAIL"
git add -A
git commit -m 'docs: generate API documentation'
git tag -a "$TAG" -m "$TAG_MESSAGE"
git push --quiet --follow-tags origin "$BRANCH" > /dev/null 2>&1
fi