forked from LastCallMedia/Mannequin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
174 lines (167 loc) · 5 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
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
version: 2
jobs:
test_php:
working_directory: /srv
docker:
- image: lastcallmedia/php:7.0-dev
steps:
- checkout
- restore_cache:
key: composer-v4-{{ checksum "composer.json" }}
- run: composer install
- save_cache:
key: composer-v4-{{ checksum "composer.json" }}
paths: [vendor, composer.lock]
- run: |
COMMIT_RANGE=`echo $CIRCLE_COMPARE_URL | cut -d/ -f7`
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB "${COMMIT_RANGE}")
if ! echo "${CHANGED_FILES}" | grep -qE "^(\\.php_cs(\\.dist)?|composer\\.lock)$"; then IFS=$'\n' EXTRA_ARGS=('--path-mode=intersection' '--' ${CHANGED_FILES[@]}); fi
vendor/bin/php-cs-fixer fix --config=.php_cs.dist -v --dry-run --stop-on-violation --using-cache=no "${EXTRA_ARGS[@]}"
- run: |
composer validate
for dir in src/*; do
echo "Checking composer.json in $dir"
composer validate -d $dir
done
- run: mkdir -p /phpunit
- run: vendor/bin/phpunit --log-junit=/phpunit/junit.xml
- store_test_results:
path: /phpunit
test_drupal:
working_directory: /srv
docker:
- image: lastcallmedia/php:7.0-dev
steps:
- checkout
- run: composer require drupal/core:8.4.0-rc1 --no-update
- restore_cache:
key: composer-v4-{{ checksum "composer.json" }}
- run: composer install
- save_cache:
key: composer-v4-{{ checksum "composer.json" }}
paths: [vendor, composer.lock]
- run: |
mkdir -p /phpunit
DRUPAL_ROOT=vendor/drupal vendor/bin/phpunit --testsuite=Drupal --log-junit=/phpunit/drupal.xml
- store_test_results:
path: /phpunit
test_ui:
working_directory: /srv
docker:
- image: node:6
steps:
- checkout
- restore_cache:
key: package-v3-{{ checksum "ui/package.json" }}
- run: cd ui && yarn install
- save_cache:
key: package-v3-{{ checksum "ui/package.json" }}
paths: [ui/node_modules, ui/yarn.lock]
- run: cd ui && yarn run build
- run: cd ui && yarn run test
- persist_to_workspace:
root: /srv/ui
paths:
- build
build_demo:
working_directory: /srv
docker:
- image: lastcallmedia/php:7.0-dev
steps:
- checkout
- attach_workspace:
at: /srv/ui
- restore_cache:
key: composer-v4-{{ checksum "composer.json" }}
- run: composer install
- run: src/Core/bin/mannequin snapshot
- persist_to_workspace:
root: /srv
paths:
- mannequin
- store_artifacts:
path: /srv/mannequin
build_site:
working_directory: /srv
docker: [image: "node:6"]
steps:
- checkout
- restore_cache: { key: 'site-package-v4-{{ checksum "site/package.json" }}' }
- run: |
cd site
yarn install
yarn build
- save_cache:
key: site-package-v4-{{ checksum "site/package.json" }}
paths: [site/node_modules, site/yarn.lock]
- store_artifacts: { path: /srv/site/dist }
- persist_to_workspace:
root: /srv/site
paths:
- public
deploy_split:
working_directory: /srv
docker:
- image: jderusse/gitsplit
steps:
- checkout
- run: gitsplit
deploy_ui:
working_directory: /srv
docker:
- image: node:6
steps:
- checkout
- attach_workspace:
at: /srv/ui
- attach_workspace:
at: /srv
- run: curl -L -o /usr/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 && chmod +x /usr/bin/jq
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
- run: |
cd ui
package=$(cat package.json | jq -r .name)
version=$(cat package.json | jq -r .version)
if [ -z "$(npm info ${package}@${version} 2> /dev/null)" ]; then
echo "Running yarn publish on ${package}@${version}"
npm publish
else
echo "Skipping yarn publish"
fi
deploy_site:
working_directory: /srv
docker:
- image: cgswong/aws:aws
steps:
- checkout
- attach_workspace:
at: /srv
- attach_workspace:
at: /srv/site
- run: |
aws s3 sync mannequin s3://demo.mannequin.io --delete
aws s3 sync site/public s3://mannequin.io --delete
workflows:
version: 2
test_and_deploy:
jobs:
- test_php
- test_drupal
- test_ui
- build_site
- build_demo:
requires: [test_ui]
- deploy_split:
requires: [test_php, test_drupal]
- deploy_ui:
requires: [test_ui]
filters:
branches:
only: master
tags:
only: /.*/
- deploy_site:
requires: [build_demo, build_site]
filters:
branches:
only: [master]