Skip to content

Commit 62c8186

Browse files
authored
Merge pull request #27 from dai0304/feature/improve-circleci
Improve circleci
2 parents f135c0a + 2591476 commit 62c8186

File tree

7 files changed

+239
-20
lines changed

7 files changed

+239
-20
lines changed

.circleci/config.yml

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
version: 2
2+
jobs:
3+
build:
4+
working_directory: /app
5+
docker:
6+
- image: java:openjdk-8-jdk
7+
- image: redis:2.8.23
8+
environment:
9+
_JAVA_OPTIONS: -Xmx3G
10+
TERM: dumb
11+
REDIS_URL: redis://localhost:6379
12+
steps:
13+
- checkout
14+
- setup_remote_docker
15+
- restore_cache:
16+
keys:
17+
- barista-{{ .Branch }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "build.gradle" }}-{{ checksum "gradle.properties" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
18+
- barista-{{ .Branch }}-{{ checksum ".circleci/config.yml" }}
19+
- barista-{{ .Branch }}
20+
- barista-develop
21+
- barista-master
22+
- run:
23+
name: Show version
24+
command: ./gradlew -v
25+
- run:
26+
name: Run tests
27+
command: ./gradlew check jacocoTestReport
28+
29+
- store_artifacts:
30+
name: Store spar-wings-aws-essential artifacts
31+
path: spar-wings-aws-essential/build/reports
32+
destination: artifact-spar-wings-aws-essential
33+
- store_test_results:
34+
path: spar-wings-aws-essential/build/test-results/
35+
36+
- store_artifacts:
37+
name: Store spar-wings-aws-logging artifacts
38+
path: spar-wings-aws-logging/build/reports
39+
destination: artifact-spar-wings-aws-logging
40+
- store_test_results:
41+
path: spar-wings-aws-logging/build/test-results/
42+
43+
- store_artifacts:
44+
name: Store spar-wings-awscli-config artifacts
45+
path: spar-wings-awscli-config/build/reports
46+
destination: artifact-spar-wings-awscli-config
47+
- store_test_results:
48+
path: spar-wings-awscli-config/build/test-results/
49+
50+
- store_artifacts:
51+
name: Store spar-wings-dynamodb-json-patch artifacts
52+
path: spar-wings-dynamodb-json-patch/build/reports
53+
destination: artifact-spar-wings-dynamodb-json-patch
54+
- store_test_results:
55+
path: spar-wings-dynamodb-json-patch/build/test-results/
56+
57+
- store_artifacts:
58+
name: Store spar-wings-event artifacts
59+
path: spar-wings-event/build/reports
60+
destination: artifact-spar-wings-event
61+
- store_test_results:
62+
path: spar-wings-event/build/test-results/
63+
64+
- store_artifacts:
65+
name: Store spar-wings-fault-injection artifacts
66+
path: spar-wings-fault-injection/build/reports
67+
destination: artifact-spar-wings-fault-injection
68+
- store_test_results:
69+
path: spar-wings-fault-injection/build/test-results/
70+
71+
- store_artifacts:
72+
name: Store spar-wings-http-dump artifacts
73+
path: spar-wings-http-dump/build/reports
74+
destination: artifact-spar-wings-http-dump
75+
- store_test_results:
76+
path: spar-wings-http-dump/build/test-results/
77+
78+
- store_artifacts:
79+
name: Store spar-wings-httpexceptions artifacts
80+
path: spar-wings-httpexceptions/build/reports
81+
destination: artifact-spar-wings-httpexceptions
82+
- store_test_results:
83+
path: spar-wings-httpexceptions/build/test-results/
84+
85+
- store_artifacts:
86+
name: Store spar-wings-jackson-essential artifacts
87+
path: spar-wings-jackson-essential/build/reports
88+
destination: artifact-spar-wings-jackson-essential
89+
- store_test_results:
90+
path: spar-wings-jackson-essential/build/test-results/
91+
92+
- store_artifacts:
93+
name: Store spar-wings-json-patch artifacts
94+
path: spar-wings-json-patch/build/reports
95+
destination: artifact-spar-wings-json-patch
96+
- store_test_results:
97+
path: spar-wings-json-patch/build/test-results/
98+
99+
- store_artifacts:
100+
name: Store spar-wings-logging artifacts
101+
path: spar-wings-logging/build/reports
102+
destination: artifact-spar-wings-logging
103+
- store_test_results:
104+
path: spar-wings-logging/build/test-results/
105+
106+
- store_artifacts:
107+
name: Store spar-wings-monolith artifacts
108+
path: spar-wings-monolith/build/reports
109+
destination: artifact-spar-wings-monolith
110+
- store_test_results:
111+
path: spar-wings-monolith/build/test-results/
112+
113+
- store_artifacts:
114+
name: Store spar-wings-ratelimiter artifacts
115+
path: spar-wings-ratelimiter/build/reports
116+
destination: artifact-spar-wings-ratelimiter
117+
- store_test_results:
118+
path: spar-wings-ratelimiter/build/test-results/
119+
120+
- store_artifacts:
121+
name: Store spar-wings-request-id artifacts
122+
path: spar-wings-request-id/build/reports
123+
destination: artifact-spar-wings-request-id
124+
- store_test_results:
125+
path: spar-wings-request-id/build/test-results/
126+
127+
- store_artifacts:
128+
name: Store spar-wings-sns-notification artifacts
129+
path: spar-wings-sns-notification/build/reports
130+
destination: artifact-spar-wings-sns-notification
131+
- store_test_results:
132+
path: spar-wings-sns-notification/build/test-results/
133+
134+
- store_artifacts:
135+
name: Store spar-wings-spring-data-chunk artifacts
136+
path: spar-wings-spring-data-chunk/build/reports
137+
destination: artifact-spar-wings-spring-data-chunk
138+
- store_test_results:
139+
path: spar-wings-spring-data-chunk/build/test-results/
140+
141+
- store_artifacts:
142+
name: Store spar-wings-spring-essential artifacts
143+
path: spar-wings-spring-essential/build/reports
144+
destination: artifact-spar-wings-spring-essential
145+
- store_test_results:
146+
path: spar-wings-spring-essential/build/test-results/
147+
148+
- store_artifacts:
149+
name: Store spar-wings-spring-s3 artifacts
150+
path: spar-wings-spring-s3/build/reports
151+
destination: artifact-spar-wings-spring-s3
152+
- store_test_results:
153+
path: spar-wings-spring-s3/build/test-results/
154+
155+
- store_artifacts:
156+
name: Store spar-wings-spring-security-essential artifacts
157+
path: spar-wings-spring-security-essential/build/reports
158+
destination: artifact-spar-wings-spring-security-essential
159+
- store_test_results:
160+
path: spar-wings-spring-security-essential/build/test-results/
161+
162+
- store_artifacts:
163+
name: Store spar-wings-sqs-poller artifacts
164+
path: spar-wings-sqs-poller/build/reports
165+
destination: artifact-spar-wings-sqs-poller
166+
- store_test_results:
167+
path: spar-wings-sqs-poller/build/test-results/
168+
169+
- store_artifacts:
170+
name: Store spar-wings-testing-uri-matcher artifacts
171+
path: spar-wings-testing-uri-matcher/build/reports
172+
destination: artifact-spar-wings-testing-uri-matcher
173+
- store_test_results:
174+
path: spar-wings-testing-uri-matcher/build/test-results/
175+
176+
- store_artifacts:
177+
name: Store spar-wings-thymeleaf-s3 artifacts
178+
path: spar-wings-thymeleaf-s3/build/reports
179+
destination: artifact-spar-wings-thymeleaf-s3
180+
- store_test_results:
181+
path: spar-wings-thymeleaf-s3/build/test-results/
182+
183+
- deploy:
184+
name: Deploy bintray
185+
command: ./gradlew assemble bintrayUpload
186+
- save_cache:
187+
key: barista-{{ .Branch }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "build.gradle" }}-{{ checksum "gradle.properties" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
188+
paths:
189+
- "~/.gradle"
190+
- "~/.m2"

build.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ buildscript {
77
maven { url "http://repo.spring.io/plugins-release" }
88
}
99
dependencies {
10-
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2"
10+
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3"
1111
classpath "com.diffplug.gradle.spotless:spotless:1.3.3"
1212
classpath "de.thetaphi:forbiddenapis:2.2"
1313
classpath "de.aaschmid:gradle-cpd-plugin:1.0"
1414
}
1515
}
1616

1717
plugins {
18-
id "com.jfrog.bintray" version "1.7.1"
18+
id "com.jfrog.bintray" version "1.7.3"
1919
}
2020

21+
// custom configuration
22+
apply from: 'gradle/version.gradle'
2123
apply from: 'gradle/resolveDependencies.gradle'
2224

2325
ext.githubProjectName = rootProject.name // Change if github project name is not the same as the root project's name
@@ -31,7 +33,7 @@ allprojects {
3133
jcenter()
3234
}
3335
group = "jp.xet.${githubProjectName}"
34-
version = currentVersion
36+
version = rootProject.version
3537
}
3638
description "Support library for Spring framework, AWS Java SDK and the others."
3739

gradle.properties

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# artifact version
2-
currentVersion = 0.33-SNAPSHOT
3-
41
# dependency versions
52
springBootVersion = 1.3.3.RELEASE
63
springVersion = 4.2.5.RELEASE

gradle/bintray.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// -*- coding: utf-8; mode: groovy -*-
22

3-
if (project.hasProperty("bintrayUser") && project.hasProperty("bintrayKey")) {
3+
if (System.env.BINTRAY_USER && System.env.BINTRAY_KEY) {
44
bintray {
5-
user = project.bintrayUser
6-
key = project.bintrayKey
5+
user = System.env.BINTRAY_USER
6+
key = System.env.BINTRAY_KEY
77
publications = ["mavenJava"]
8+
dryRun = System.env.CIRCLE_BRANCH != "master"
9+
publish = true
810
pkg {
911
repo = "spar-wings"
1012
name = project.name

gradle/version.gradle

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// -*- coding: utf-8; mode: groovy -*-
2+
3+
buildscript {
4+
repositories {
5+
mavenCentral()
6+
maven { url "https://plugins.gradle.org/m2/" }
7+
}
8+
dependencies {
9+
classpath 'org.ajoberstar:grgit:1.7.0'
10+
}
11+
}
12+
13+
ext {
14+
git = org.ajoberstar.grgit.Grgit.open(file('.'))
15+
describedCommit = git.describe().toString().trim()
16+
}
17+
18+
version = describedCommit +
19+
(describedCommit.matches(".*-[0-9]+-g[0-9a-f]{7}") ? "-SNAPSHOT" : "") +
20+
(git.status().isClean() ? "" : "+dirty")
21+
22+
task showVersion {
23+
doLast {
24+
println version
25+
}
26+
}

spar-wings-spring-essential/src/main/java/jp/xet/sparwings/common/utils/InitializationUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private static boolean isClearEscapeSequenceRequired(String value) {
139139

140140
private static boolean isMaskingRequired(String key) {
141141
String lowerKey = key.toLowerCase(Locale.ENGLISH);
142-
return lowerKey.contains("secret") || lowerKey.contains("password");
142+
return lowerKey.contains("secret") || lowerKey.contains("password") || lowerKey.contains("key");
143143
}
144144

145145
/**

spar-wings-spring-essential/src/test/java/jp/xet/sparwings/common/utils/InitializationUtilTest.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,27 +68,29 @@ public void testLogAllProperties() {
6868
List<LoggingEvent> logEvents = acptor.getAllValues();
6969

7070
// regular environment variables
71-
assertThat(logEvents.stream().map(LoggingEvent::getMessage)
71+
assertThat(logEvents.stream().map(LoggingEvent::getFormattedMessage)
7272
.anyMatch(m -> m.startsWith("HOME = /")), is(true));
73-
assertThat(logEvents.stream().map(LoggingEvent::getMessage)
74-
.anyMatch(m -> m.startsWith("USER = ")), is(true));
73+
assertThat(logEvents.stream().map(LoggingEvent::getFormattedMessage)
74+
.anyMatch(m -> m.startsWith("PWD = ")), is(true));
75+
assertThat(logEvents.stream().map(LoggingEvent::getFormattedMessage)
76+
.anyMatch(m -> m.startsWith("TERM = ")), is(true));
7577

7678
// regular system properties
77-
assertThat(logEvents.stream().map(LoggingEvent::getMessage)
79+
assertThat(logEvents.stream().map(LoggingEvent::getFormattedMessage)
7880
.anyMatch(m -> m.startsWith("java.vm.name = ")), is(true));
79-
assertThat(logEvents.stream().map(LoggingEvent::getMessage)
81+
assertThat(logEvents.stream().map(LoggingEvent::getFormattedMessage)
8082
.anyMatch(m -> m.startsWith("java.home = ")), is(true));
81-
assertThat(logEvents.stream().map(LoggingEvent::getMessage)
83+
assertThat(logEvents.stream().map(LoggingEvent::getFormattedMessage)
8284
.anyMatch(m -> m.startsWith("user.home = ")), is(true));
8385

8486
// custom system properties
85-
assertThat(logEvents.stream().map(LoggingEvent::getMessage)
87+
assertThat(logEvents.stream().map(LoggingEvent::getFormattedMessage)
8688
.anyMatch(m -> m.equals("sparwings.test = " + nonSecretValue)), is(true));
87-
assertThat(logEvents.stream().map(LoggingEvent::getMessage)
89+
assertThat(logEvents.stream().map(LoggingEvent::getFormattedMessage)
8890
.anyMatch(m -> m.equals("sparwings.test.password = " + InitializationUtil.MASK_STRING)), is(true));
89-
assertThat(logEvents.stream().map(LoggingEvent::getMessage)
91+
assertThat(logEvents.stream().map(LoggingEvent::getFormattedMessage)
9092
.anyMatch(m -> m.equals("sparwings.test.secret = " + InitializationUtil.MASK_STRING)), is(true));
91-
assertThat(logEvents.stream().map(LoggingEvent::getMessage)
93+
assertThat(logEvents.stream().map(LoggingEvent::getFormattedMessage)
9294
.anyMatch(m -> m.contains(secretValue)), is(false));
9395

9496
// teardown

0 commit comments

Comments
 (0)