Skip to content

Commit c74fb83

Browse files
Excavator: Automatically convert to Circle2
1 parent b5b5bd2 commit c74fb83

File tree

2 files changed

+133
-50
lines changed

2 files changed

+133
-50
lines changed

.circleci/config.yml

Lines changed: 131 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,94 +2,175 @@
22
# To request a modification to the general template, file an issue on Excavator.
33
# To manually manage the CircleCI configuration for this project, remove the .circleci/template.sh file.
44

5-
version: 2
5+
version: 2.1
66
jobs:
7-
87
compile:
9-
docker: [{ image: 'ellisjoe/openjdk-java-openssl:java-8' }]
10-
resource_class: xlarge
8+
docker: [{ image: 'cimg/openjdk:8.0.282-node' }]
9+
resource_class: large
1110
environment:
12-
GRADLE_OPTS: -Dorg.gradle.console=plain -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false
13-
11+
CIRCLE_TEST_REPORTS: /home/circleci/junit
12+
CIRCLE_ARTIFACTS: /home/circleci/artifacts
13+
GRADLE_OPTS: -Dorg.gradle.jvmargs='-Xmx2g' -Dorg.gradle.workers.max=2
14+
_JAVA_OPTIONS: -XX:ActiveProcessorCount=4 -XX:MaxRAM=8g -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
1415
steps:
1516
- checkout
16-
- restore_cache: { key: 'gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
17-
- restore_cache: { key: 'gradle-cache-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
18-
- run: ./gradlew --no-daemon --parallel --continue classes testClasses
17+
- run:
18+
name: delete_unrelated_tags
19+
command: |
20+
ALL_TAGS=$(git tag --points-at HEAD)
21+
22+
if [ -z "$ALL_TAGS" ]; then
23+
echo "No-op as there are no tags on the current commit ($(git rev-parse HEAD))"
24+
exit 0
25+
fi
26+
27+
if [ -z "${CIRCLE_TAG:+x}" ]; then
28+
echo "Non-tag build, deleting all tags which point to HEAD: [${ALL_TAGS/$'\n'/,}]"
29+
echo "$ALL_TAGS" | while read -r TAG; do git tag -d "$TAG" 1>/dev/null; done
30+
exit 0
31+
fi
32+
33+
TAGS_TO_DELETE=$(echo "$ALL_TAGS" | grep -v "^$CIRCLE_TAG$" || :)
34+
if [ -z "$TAGS_TO_DELETE" ]; then
35+
echo "No-op as exactly one tag ($CIRCLE_TAG) points to HEAD"
36+
exit 0
37+
fi
38+
39+
echo "Detected tag build, deleting all tags except '$CIRCLE_TAG' which point to HEAD: [${TAGS_TO_DELETE/$'\n'/,}]"
40+
echo "$TAGS_TO_DELETE" | while read -r TAG; do git tag -d "$TAG" 1>/dev/null; done
41+
- restore_cache: { key: 'gradle-wrapper-v2-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
42+
- restore_cache: { key: 'compile-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
43+
- run: ./gradlew --parallel --stacktrace classes testClasses
1944
- save_cache:
20-
key: gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
45+
key: 'gradle-wrapper-v2-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}'
2146
paths: [ ~/.gradle/wrapper ]
2247
- save_cache:
23-
key: gradle-cache-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}
48+
key: 'compile-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
2449
paths: [ ~/.gradle/caches ]
50+
- store_test_results: { path: ~/junit }
51+
- store_artifacts: { path: ~/artifacts }
52+
- persist_to_workspace:
53+
root: /home/circleci
54+
paths: [ project, .gradle/init.gradle ]
2555

26-
build:
27-
docker: [{ image: 'ellisjoe/openjdk-java-openssl:java-8' }]
28-
resource_class: xlarge
56+
check:
57+
docker: [{ image: 'cimg/openjdk:8.0.282-node' }]
58+
resource_class: medium
2959
environment:
30-
GRADLE_OPTS: -Dorg.gradle.console=plain -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false
31-
60+
CIRCLE_TEST_REPORTS: /home/circleci/junit
61+
CIRCLE_ARTIFACTS: /home/circleci/artifacts
62+
GRADLE_OPTS: -Dorg.gradle.jvmargs='-Xmx2g' -Dorg.gradle.workers.max=1
63+
_JAVA_OPTIONS: -XX:ActiveProcessorCount=2 -XX:MaxRAM=4g -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
3264
steps:
33-
- checkout
34-
- restore_cache: { key: 'gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
35-
- restore_cache: { key: 'gradle-cache-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
36-
- run: ./gradlew --no-daemon --parallel --continue build
65+
- attach_workspace: { at: /home/circleci }
66+
- restore_cache: { key: 'gradle-wrapper-v2-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
67+
- restore_cache: { key: 'check-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
68+
- run: ./gradlew --parallel --stacktrace --continue check idea -x test
69+
- save_cache:
70+
key: 'check-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
71+
paths: [ ~/.gradle/caches ]
3772
- run:
3873
command: mkdir -p ~/junit && find . -type f -regex ".*/build/.*TEST.*xml" -exec cp --parents {} ~/junit/ \;
3974
when: always
4075
- store_test_results: { path: ~/junit }
41-
- store_artifacts: { path: ~/poms }
76+
- store_artifacts: { path: ~/artifacts }
4277

43-
build-ibm:
44-
docker: [{ image: 'ellisjoe/ibm-java-openssl:java-8' }]
45-
resource_class: xlarge
78+
unit-test:
79+
docker: [{ image: 'cimg/openjdk:8.0.282-node' }]
80+
resource_class: large
4681
environment:
47-
GRADLE_OPTS: -Dorg.gradle.console=plain -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false
48-
82+
CIRCLE_TEST_REPORTS: /home/circleci/junit
83+
CIRCLE_ARTIFACTS: /home/circleci/artifacts
84+
GRADLE_OPTS: -Dorg.gradle.jvmargs='-Xmx2g' -Dorg.gradle.workers.max=2
85+
_JAVA_OPTIONS: -XX:ActiveProcessorCount=4 -XX:MaxRAM=8g -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
4986
steps:
50-
- checkout
51-
- restore_cache: { key: 'gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
52-
- restore_cache: { key: 'gradle-cache-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
53-
- run: ./gradlew --no-daemon --parallel --continue crypto-core:test
87+
- attach_workspace: { at: /home/circleci }
88+
- restore_cache: { key: 'gradle-wrapper-v2-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
89+
- restore_cache: { key: 'unit-test-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
90+
- run: ./gradlew --parallel --stacktrace --continue --max-workers=2 test
91+
- save_cache:
92+
key: 'unit-test-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
93+
paths: [ ~/.gradle/caches ]
5494
- run:
5595
command: mkdir -p ~/junit && find . -type f -regex ".*/build/.*TEST.*xml" -exec cp --parents {} ~/junit/ \;
5696
when: always
5797
- store_test_results: { path: ~/junit }
98+
- store_artifacts: { path: ~/artifacts }
99+
100+
trial-publish:
101+
docker: [{ image: 'cimg/openjdk:8.0.282-node' }]
102+
resource_class: medium
103+
environment:
104+
CIRCLE_TEST_REPORTS: /home/circleci/junit
105+
CIRCLE_ARTIFACTS: /home/circleci/artifacts
106+
GRADLE_OPTS: -Dorg.gradle.jvmargs='-Xmx2g' -Dorg.gradle.workers.max=1
107+
_JAVA_OPTIONS: -XX:ActiveProcessorCount=2 -XX:MaxRAM=4g -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
108+
steps:
109+
- attach_workspace: { at: /home/circleci }
110+
- restore_cache: { key: 'gradle-wrapper-v2-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
111+
- restore_cache: { key: 'trial-publish-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
112+
- run: ./gradlew --stacktrace publishToMavenLocal
113+
- run:
114+
command: git status --porcelain
115+
when: always
116+
- save_cache:
117+
key: 'trial-publish-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
118+
paths: [ ~/.gradle/caches ]
119+
- store_test_results: { path: ~/junit }
120+
- store_artifacts: { path: ~/artifacts }
58121

59122
publish:
60-
docker: [{ image: 'ellisjoe/openjdk-java-openssl:java-8' }]
61-
resource_class: xlarge
123+
docker: [{ image: 'cimg/openjdk:8.0.282-node' }]
124+
resource_class: medium
62125
environment:
63-
GRADLE_OPTS: -Dorg.gradle.console=plain -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false
126+
CIRCLE_TEST_REPORTS: /home/circleci/junit
127+
CIRCLE_ARTIFACTS: /home/circleci/artifacts
128+
GRADLE_OPTS: -Dorg.gradle.jvmargs='-Xmx2g' -Dorg.gradle.workers.max=1
129+
_JAVA_OPTIONS: -XX:ActiveProcessorCount=2 -XX:MaxRAM=4g -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
130+
steps:
131+
- attach_workspace: { at: /home/circleci }
132+
- restore_cache: { key: 'gradle-wrapper-v2-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
133+
- restore_cache: { key: 'publish-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
134+
- deploy:
135+
command: ./gradlew --parallel --stacktrace --continue publish
136+
- run:
137+
command: git status --porcelain
138+
when: always
139+
- save_cache:
140+
key: 'publish-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
141+
paths: [ ~/.gradle/caches ]
142+
- store_test_results: { path: ~/junit }
143+
- store_artifacts: { path: ~/artifacts }
64144

145+
markdown:
146+
docker: [{ image: 'raviqqe/liche:0.1.1' }]
65147
steps:
66148
- checkout
67-
- restore_cache: { key: 'gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
68-
- restore_cache: { key: 'gradle-cache-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
69-
- deploy:
70-
command: |
71-
# publishing snapshots to bintray does not work, so we only publish from tag builds (not develop)
72-
if [[ "${CIRCLE_TAG}" =~ [0-9]+(\.[0-9]+)+(-[a-zA-Z]+[0-9]*)* ]]; then
73-
./gradlew --no-daemon --stacktrace --continue publish
74-
else
75-
./gradlew --no-daemon --parallel --continue publishToMavenLocal
76-
mkdir -p ~/poms
77-
find . -name 'pom-default.xml' -exec cp --parents {} ~/poms \;
78-
fi
149+
- run: /liche -d . -r . -v
150+
79151

80152
workflows:
81153
version: 2
82154
build:
83155
jobs:
84156
- compile:
85-
# CircleCI2 will ignore tags without this. https://circleci.com/docs/2.0/workflows/#git-tag-job-execution
86157
filters: { tags: { only: /.*/ } }
87-
- build:
158+
159+
- unit-test:
88160
requires: [ compile ]
89161
filters: { tags: { only: /.*/ } }
90-
- build-ibm:
162+
163+
- check:
91164
requires: [ compile ]
92165
filters: { tags: { only: /.*/ } }
93-
- publish:
94-
requires: [ build, build-ibm ]
166+
167+
- markdown:
95168
filters: { tags: { only: /.*/ } }
169+
170+
- trial-publish:
171+
requires: [ compile ]
172+
filters: { branches: { ignore: develop } }
173+
174+
- publish:
175+
requires: [ unit-test, check, trial-publish ]
176+
filters: { tags: { only: /.*/ }, branches: { only: develop } }

.circleci/template.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
export CIRCLECI_TEMPLATE=java-library-oss

0 commit comments

Comments
 (0)