Skip to content

Commit a17fab7

Browse files
f-moyaAle Paredes
and
Ale Paredes
authored
Turn it on 🚀 (fix build, update ci) (#53)
* Bump phpmd to 2.7 * Fix CI * Restore phpmd to master version * Install composer using composer image * Attempt to update circleci * Require build for test * Skip spec * Add release step * Simplify circle config * Add slack notifications * Delte skipped spec Co-authored-by: Ale Paredes <[email protected]>
1 parent 7d0aa6c commit a17fab7

File tree

5 files changed

+1089
-310
lines changed

5 files changed

+1089
-310
lines changed

‎.circleci/config.yml

+43-21
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,53 @@
1+
orbs:
2+
slack: circleci/[email protected]
3+
14
version: 2
5+
6+
base: &base
7+
machine:
8+
docker_layer_caching: true
9+
working_directory: ~/codeclimate/codeclimate-phpmd
10+
11+
12+
213
jobs:
314
build:
4-
machine:
5-
enabled: true
6-
image: circleci/classic:201709-01
7-
environment:
8-
CLOUDSDK_CORE_DISABLE_PROMPTS: 1
9-
PRIVATE_REGISTRY: us.gcr.io/code_climate
10-
IMAGE_NAME: ${PRIVATE_REGISTRY}/${CIRCLE_PROJECT_REPONAME}:b${CIRCLE_BUILD_NUM}
15+
<<: *base
1116
steps:
1217
- checkout
18+
- run: make image
19+
20+
test:
21+
<<: *base
22+
steps:
23+
- checkout
24+
- run: make test
25+
26+
release:
27+
<<: *base
28+
steps:
29+
- checkout
30+
- run: make image
31+
- run: echo "$GCR_JSON_KEY" | docker login -u _json_key --password-stdin us.gcr.io
1332
- run:
14-
name: Prebuild images
15-
command: make test-image
16-
- run:
17-
name: Tests
18-
command: make test
19-
- deploy:
20-
name: Deployment
33+
name: Push image to GCR
2134
command: |
22-
if [ "${CIRCLE_BRANCH}" == "master" ]; then
23-
echo ${GCLOUD_JSON_KEY_BASE64} | sed 's/ //g' | base64 -d > /tmp/gcloud_key.json
24-
curl https://sdk.cloud.google.com | bash
25-
gcloud auth activate-service-account ${gcloud_account_email} --key-file /tmp/gcloud_key.json
26-
gcloud docker -a
27-
docker push ${IMAGE_NAME}
28-
fi
35+
docker tag $CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME \
36+
us.gcr.io/code-climate/codeclimate-phpmd:b$CIRCLE_BUILD_NUM
37+
docker push us.gcr.io/code-climate/codeclimate-phpmd:b$CIRCLE_BUILD_NUM
38+
39+
workflows:
40+
version: 2
41+
build_release:
42+
jobs:
43+
- build
44+
- test:
45+
requires:
46+
- build
47+
- release:
48+
requires:
49+
- test
50+
2951

3052
notify:
3153
webhooks:

‎Dockerfile

+9-10
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ RUN apk add --no-cache \
2323
php7-tokenizer \
2424
php7-xmlwriter \
2525
php7-xml && \
26-
ln -sf /usr/bin/php7 /usr/bin/php && \
27-
apk add --no-cache curl && \
28-
curl -sS https://getcomposer.org/installer | php && \
29-
mv composer.phar /usr/local/bin/composer && \
30-
apk del --purge curl && \
31-
rm -r ~/.composer
26+
ln -sf /usr/bin/php7 /usr/bin/php
27+
28+
# Bring composer
29+
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
30+
3231

3332
# Install Dependencies
3433
COPY composer.* ./
@@ -38,13 +37,13 @@ RUN composer install --no-dev && \
3837

3938
# Build Content
4039
COPY bin/build-content ./bin/build-content
41-
RUN apk add --no-cache ruby ruby-json&& \
42-
gem install httparty --no-rdoc --no-ri && \
40+
RUN apk add --no-cache ruby ruby-json ruby-bigdecimal && \
41+
gem install rdoc httparty --no-document && \
4342
./bin/build-content && \
4443
chown -R app:app content && \
45-
gem uninstall httparty && \
44+
gem uninstall rdoc httparty && \
4645
rm -rf $( gem environment gemdir ) && \
47-
apk del --purge ruby ruby-json && \
46+
apk del --purge ruby ruby-json ruby-bigdecimal && \
4847
rm -r /var/cache/* ~/.gem
4948

5049
COPY . ./

‎Makefile

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ composer-update:
1919
$(IMAGE_NAME) \
2020
sh -c 'cd /usr/src/app && composer update'
2121

22-
citest: test
23-
2422
test:
2523
@$(MAKE) test-image > /dev/null
2624
docker run \

0 commit comments

Comments
 (0)