Skip to content

Commit 01116eb

Browse files
author
Bruno Ferreira
committed
clean: update circleci config with fit version FT-7452 :breaking:
1 parent 07f8881 commit 01116eb

File tree

1 file changed

+113
-12
lines changed

1 file changed

+113
-12
lines changed

.circleci/config.yml

Lines changed: 113 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,119 @@
11
version: 2
2+
3+
references:
4+
5+
docker_environment_defaults: &docker_environment_defaults
6+
# Customize the JVM to read correct memory values
7+
JAVA_OPTS: '-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=1'
8+
9+
host_environment_defaults: &host_environment_defaults
10+
# Customize the JVM maximum heap limit
11+
JAVA_OPTS: -Xss256m -Xmx6144m
12+
13+
default_java_job: &default_java_job
14+
docker:
15+
- image: circleci/openjdk:8-jdk
16+
environment:
17+
<<: *docker_environment_defaults
18+
working_directory: ~/workdir
19+
20+
restore_dependencies: &restore_dependencies
21+
restore_cache:
22+
keys:
23+
- sbt-ivy2-dependencies-1.0.0-{{ checksum "/tmp/dependencies.cache.tmp" }}
24+
- sbt-ivy2-dependencies-1.0.0
25+
26+
setup_dependencies_key: &setup_dependencies_key
27+
run:
28+
name: Generate cache key
29+
command: |
30+
shasum build.sbt \
31+
project/plugins.sbt \
32+
project/build.properties > /tmp/dependencies.cache.tmp
33+
34+
235
jobs:
36+
37+
checkout_and_version:
38+
docker:
39+
- image: codacy/git-version:1.0.8
40+
working_directory: ~/workdir
41+
steps:
42+
- checkout
43+
- run:
44+
name: Set version
45+
command: /bin/git-version > .version
46+
- run:
47+
name: Set Sbt version
48+
command: echo "version in ThisBuild := \"$(cat .version)\"" > version.sbt
49+
- run:
50+
name: Current version
51+
command: cat .version
52+
- persist_to_workspace:
53+
root: ~/
54+
paths:
55+
- workdir
56+
57+
sbt_dependencies:
58+
<<: *default_java_job
59+
environment:
60+
AWS_PROFILE: maven
61+
steps:
62+
- attach_workspace:
63+
at: ~/
64+
- *setup_dependencies_key
65+
- *restore_dependencies
66+
- run:
67+
name: Resolve dependencies
68+
command: sbt update
69+
- save_cache:
70+
paths:
71+
- ~/.ivy2
72+
- ~/.sbt
73+
key: sbt-ivy2-dependencies-1.0.0-{{ checksum "/tmp/dependencies.cache.tmp" }}
74+
75+
compile:
76+
<<: *default_java_job
77+
steps:
78+
- attach_workspace:
79+
at: ~/
80+
- *setup_dependencies_key
81+
- *restore_dependencies
82+
- run:
83+
name: Compile
84+
command: sbt -Dbuild.number=$(cat .version) compile test:compile
85+
- persist_to_workspace:
86+
root: ~/
87+
paths:
88+
- workdir
89+
390
build:
491
machine: true
92+
environment:
93+
<<: *host_environment_defaults
594
working_directory: ~/workdir
695
steps:
7-
- checkout
8-
- run:
96+
- attach_workspace:
97+
at: ~/
98+
- *setup_dependencies_key
99+
- *restore_dependencies
100+
- run:
9101
name: Clone test project
10102
working_directory: ~/
11103
command: |
12-
(git -C ~/codacy-plugins-test fetch --all &&
13-
git -C ~/codacy-plugins-test reset --hard origin/master) ||
104+
(git -C ~/codacy-plugins-test fetch --all &&
105+
git -C ~/codacy-plugins-test reset --hard origin/master) ||
14106
git clone git://github.com/codacy/codacy-plugins-test.git ~/codacy-plugins-test
15-
- restore_cache:
16-
key: dependencies-{{ checksum "build.sbt" }}
17-
- run:
107+
- run:
18108
name: Compile test project
19109
working_directory: ~/codacy-plugins-test
20110
command: sbt compile
21-
- run:
111+
- run:
22112
name: Publish tool docker locally
23113
working_directory: ~/workdir
24114
command: sbt 'set version in Docker := "latest"' "set name := \"$CIRCLE_PROJECT_REPONAME\"" docker:publishLocal
25115
- save_cache:
26-
key: dependencies-{{ checksum "build.sbt" }}
116+
key: sbt-ivy2-dependencies-1.0.0-{{ checksum "/tmp/dependencies.cache.tmp" }}
27117
paths:
28118
- "~/.ivy2"
29119
- "~/.m2"
@@ -34,7 +124,7 @@ jobs:
34124
- "~/workdir/target"
35125
- "~/workdir/project/target"
36126
- "~/workdir/project/project"
37-
- run:
127+
- run:
38128
name: Test json
39129
working_directory: ~/codacy-plugins-test
40130
command: sbt -Dcodacy.tests.ignore.descriptions=true "runMain codacy.plugins.DockerTest json $CIRCLE_PROJECT_REPONAME:latest"
@@ -48,12 +138,23 @@ jobs:
48138
if [ "${CIRCLE_BRANCH}" == "master" ]; then
49139
docker login -u $DOCKER_USER -p $DOCKER_PASS
50140
docker tag $CIRCLE_PROJECT_REPONAME codacy/$CIRCLE_PROJECT_REPONAME
51-
docker tag $CIRCLE_PROJECT_REPONAME codacy/$CIRCLE_PROJECT_REPONAME:1.0.$CIRCLE_BUILD_NUM
141+
docker tag $CIRCLE_PROJECT_REPONAME codacy/$CIRCLE_PROJECT_REPONAME:$(cat .version)
52142
docker push codacy/$CIRCLE_PROJECT_REPONAME
143+
docker push codacy/$CIRCLE_PROJECT_REPONAME:$(cat .version)
53144
fi
54145
55146
workflows:
56147
version: 2
57148
build-and-deploy:
58149
jobs:
59-
- build
150+
- checkout_and_version
151+
- sbt_dependencies:
152+
requires:
153+
- checkout_and_version
154+
- compile:
155+
requires:
156+
- sbt_dependencies
157+
- build:
158+
context: CodacyDocker
159+
requires:
160+
- compile

0 commit comments

Comments
 (0)