Skip to content

Commit 783cb68

Browse files
authored
ci step changes (#54)
* ci step changes * moving to 2.1
1 parent c6645a9 commit 783cb68

File tree

1 file changed

+95
-6
lines changed

1 file changed

+95
-6
lines changed

.circleci/config.yml

Lines changed: 95 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,47 @@
1-
# Java Maven CircleCI 2.0 configuration file
21
#
3-
# Check https://circleci.com/docs/2.0/language-java/ for more details
4-
#
5-
version: 2
2+
version: 2.1
3+
4+
commands:
5+
6+
abort_for_docs:
7+
steps:
8+
- run:
9+
name: Avoid tests for docs
10+
command: |
11+
if [[ $CIRCLE_BRANCH == *docs ]]; then
12+
echo "Identifies as documents PR, no testing required"
13+
circleci step halt
14+
fi
15+
16+
abort_for_noci:
17+
steps:
18+
- run:
19+
name: Ignore CI for specific branches
20+
command: |
21+
if [[ $CIRCLE_BRANCH == *noci ]]; then
22+
echo "Identifies as actively ignoring CI, no testing required."
23+
circleci step halt
24+
fi
25+
26+
27+
early_return_for_forked_pull_requests:
28+
description: >-
29+
If this build is from a fork, stop executing the current job and return success.
30+
This is useful to avoid steps that will fail due to missing credentials.
31+
steps:
32+
- run:
33+
name: Early return if this build is from a forked PR
34+
command: |
35+
if [[ -n "$CIRCLE_PR_NUMBER" ]]; then
36+
echo "Nothing to do for forked PRs, so marking this step successful"
37+
circleci step halt
38+
fi
39+
640
jobs:
741
build:
842
docker:
943
- image: circleci/openjdk:8u171-jdk
10-
1144
- image: redislabs/rejson:edge
12-
port: 6379:6379
1345

1446
working_directory: ~/repo
1547

@@ -18,7 +50,41 @@ jobs:
1850
MAVEN_OPTS: -Xmx3200m
1951

2052
steps:
53+
- abort_for_docs
54+
- abort_for_noci
55+
- checkout
2156

57+
# Download and cache dependencies
58+
- restore_cache:
59+
keys:
60+
- v1-dependencies-{{ checksum "pom.xml" }}
61+
# fallback to using the latest cache if no exact match is found
62+
- v1-dependencies-
63+
64+
- run: mvn dependency:go-offline
65+
66+
- save_cache:
67+
paths:
68+
- ~/.m2
69+
key: v1-dependencies-{{ checksum "pom.xml" }}
70+
71+
# run tests!
72+
- run: mvn integration-test
73+
- early_return_for_forked_pull_requests
74+
- run: mvn cobertura:cobertura
75+
- run: bash <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/master/codecov) -t ${CODECOV_TOKEN}
76+
77+
build-and-publish:
78+
docker:
79+
- image: circleci/openjdk:8u171-jdk
80+
81+
environment:
82+
# Customize the JVM maximum heap limit
83+
MAVEN_OPTS: -Xmx3200m
84+
85+
steps:
86+
- abort_for_docs
87+
- abort_for_noci
2288
- checkout
2389

2490
# Download and cache dependencies
@@ -40,15 +106,38 @@ jobs:
40106
- run: mvn cobertura:cobertura
41107
- run: bash <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/master/codecov) -t ${CODECOV_TOKEN}
42108

109+
43110
- run: mvn -s .circleci.settings.xml -DskipTests -Dgpg.skip deploy
44111

112+
113+
on-master: &on-master
114+
filters:
115+
branches:
116+
only: master
117+
tags:
118+
ignore: /.*/
119+
120+
not-on-master: &not-on-master
121+
filters:
122+
branches:
123+
ignore: master
124+
tags:
125+
ignore: /.*/
126+
127+
45128
workflows:
46129
version: 2
47130
commit:
48131
jobs:
49132
- build:
133+
<<: *not-on-master
50134
context:
51135
- common
136+
- build-and-publish:
137+
<<: *on-master
138+
context:
139+
- common
140+
52141
nightly:
53142
triggers:
54143
- schedule:

0 commit comments

Comments
 (0)