Skip to content

Commit 49f574e

Browse files
Excavator: Render CircleCI file using template specified in .circleci/template.sh
1 parent ca313c9 commit 49f574e

File tree

1 file changed

+61
-76
lines changed

1 file changed

+61
-76
lines changed

.circleci/config.yml

Lines changed: 61 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44

55
version: 2.1
66
jobs:
7-
compile:
7+
8+
check:
89
docker: [{ image: 'cimg/openjdk:11.0.10-node' }]
910
resource_class: large
1011
environment:
1112
CIRCLE_TEST_REPORTS: /home/circleci/junit
1213
CIRCLE_ARTIFACTS: /home/circleci/artifacts
1314
GRADLE_OPTS: -Dorg.gradle.workers.max=2 -Dorg.gradle.jvmargs='-Xmx2g --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
14-
_JAVA_OPTIONS: -XX:ActiveProcessorCount=4 -XX:MaxRAM=8g -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
15+
_JAVA_OPTIONS: -XX:ActiveProcessorCount=4 -XX:MaxRAM=8g -XX:+CrashOnOutOfMemoryError -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
1516
steps:
1617
- checkout
1718
- run:
@@ -38,66 +39,30 @@ jobs:
3839
3940
echo "Detected tag build, deleting all tags except '$CIRCLE_TAG' which point to HEAD: [${TAGS_TO_DELETE/$'\n'/,}]"
4041
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 -Porg.gradle.java.installations.fromEnv=JAVA_8_HOME,JAVA_11_HOME,JAVA_15_HOME,JAVA_17_HOME,JAVA_HOME
44-
- save_cache:
45-
key: 'gradle-wrapper-v2-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}'
46-
paths: [ ~/.gradle/wrapper ]
47-
- save_cache:
48-
key: 'compile-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
49-
paths: [ ~/.gradle/caches ]
50-
- store_test_results: { path: ~/junit }
51-
- store_artifacts: { path: ~/artifacts }
42+
- restore_cache: { key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
43+
- restore_cache: { key: 'check-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
44+
- run:
45+
name: check-setup
46+
command: |
47+
if [ -x .circleci/check-setup.sh ]; then
48+
echo "Running check-setup" && .circleci/check-setup.sh && echo "check-setup complete"
49+
fi
50+
- run: ./gradlew --parallel --stacktrace --continue --max-workers=2 check -Porg.gradle.java.installations.fromEnv=JAVA_8_HOME,JAVA_11_HOME,JAVA_15_HOME,JAVA_17_HOME,JAVA_HOME
5251
- persist_to_workspace:
5352
root: /home/circleci
54-
paths: [ project, .gradle/init.gradle ]
55-
56-
check:
57-
docker: [{ image: 'cimg/openjdk:11.0.10-node' }]
58-
resource_class: medium
59-
environment:
60-
CIRCLE_TEST_REPORTS: /home/circleci/junit
61-
CIRCLE_ARTIFACTS: /home/circleci/artifacts
62-
GRADLE_OPTS: -Dorg.gradle.workers.max=1 -Dorg.gradle.jvmargs='-Xmx2g --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
63-
_JAVA_OPTIONS: -XX:ActiveProcessorCount=2 -XX:MaxRAM=4g -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
64-
steps:
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 -Porg.gradle.java.installations.fromEnv=JAVA_8_HOME,JAVA_11_HOME,JAVA_15_HOME,JAVA_17_HOME,JAVA_HOME
53+
paths: [ project ]
6954
- save_cache:
70-
key: 'check-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
71-
paths: [ ~/.gradle/caches ]
72-
- run:
73-
command: mkdir -p ~/junit && find . -type f -regex ".*/build/.*TEST.*xml" -exec cp --parents {} ~/junit/ \;
74-
when: always
75-
- store_test_results: { path: ~/junit }
76-
- store_artifacts: { path: ~/artifacts }
77-
78-
unit-test:
79-
docker: [{ image: 'cimg/openjdk:11.0.10-node' }]
80-
resource_class: large
81-
environment:
82-
CIRCLE_TEST_REPORTS: /home/circleci/junit
83-
CIRCLE_ARTIFACTS: /home/circleci/artifacts
84-
GRADLE_OPTS: -Dorg.gradle.workers.max=2 -Dorg.gradle.jvmargs='-Xmx2g --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
85-
_JAVA_OPTIONS: -XX:ActiveProcessorCount=4 -XX:MaxRAM=8g -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
86-
steps:
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 -Porg.gradle.java.installations.fromEnv=JAVA_8_HOME,JAVA_11_HOME,JAVA_15_HOME,JAVA_17_HOME,JAVA_HOME
55+
key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}'
56+
paths: [ ~/.gradle/wrapper ]
9157
- save_cache:
92-
key: 'unit-test-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
58+
key: 'check-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
9359
paths: [ ~/.gradle/caches ]
9460
- run:
9561
command: mkdir -p ~/junit && find . -type f -regex ".*/build/.*TEST.*xml" -exec cp --parents {} ~/junit/ \;
9662
when: always
9763
- store_test_results: { path: ~/junit }
9864
- store_artifacts: { path: ~/artifacts }
9965

100-
10166
build:
10267
machine: { docker_layer_caching: true }
10368
environment:
@@ -106,18 +71,24 @@ jobs:
10671
_JAVA_OPTIONS: -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false -Xmx8192m
10772
JAVA_HOME: /opt/java11
10873
steps:
109-
- attach_workspace: { at: /home/circleci }
110-
- restore_cache: { key: 'gradle-wrapper-v2-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
111-
- restore_cache: { key: 'build-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
74+
- checkout
75+
- restore_cache: { key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
76+
- restore_cache: { key: 'build-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
11277
- run:
11378
name: Install Java 11
11479
command: |
11580
sudo mkdir -p /opt/java && cd /opt/java && sudo chown -R circleci:circleci .
116-
curl https://cdn.azul.com/zulu/bin/zulu11.54.23-ca-jdk11.0.14-linux_x64.tar.gz | tar -xzf - -C /opt/java
81+
curl https://cdn.azul.com/zulu/bin/zulu11.64.19-ca-jdk11.0.19-linux_x64.tar.gz | tar -xzf - -C /opt/java
11782
sudo ln -s /opt/java/zulu*/ /opt/java11
83+
- run:
84+
name: build-setup
85+
command: |
86+
if [ -x .circleci/build-setup.sh ]; then
87+
echo "Running build-setup" && .circleci/build-setup.sh && echo "build-setup complete"
88+
fi
11889
- run: ./gradlew --parallel --stacktrace build -x test -x check -Porg.gradle.java.installations.fromEnv=JAVA_8_HOME,JAVA_11_HOME,JAVA_15_HOME,JAVA_17_HOME,JAVA_HOME
11990
- save_cache:
120-
key: 'build-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
91+
key: 'build-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
12192
paths: [ ~/.gradle/caches ]
12293
- run:
12394
command: mkdir -p ~/junit && find . -type f -regex ".*/build/.*TEST.*xml" -exec cp --parents {} ~/junit/ \; || true
@@ -132,17 +103,41 @@ jobs:
132103
CIRCLE_TEST_REPORTS: /home/circleci/junit
133104
CIRCLE_ARTIFACTS: /home/circleci/artifacts
134105
GRADLE_OPTS: -Dorg.gradle.workers.max=1 -Dorg.gradle.jvmargs='-Xmx2g --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
135-
_JAVA_OPTIONS: -XX:ActiveProcessorCount=2 -XX:MaxRAM=4g -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
106+
_JAVA_OPTIONS: -XX:ActiveProcessorCount=2 -XX:MaxRAM=4g -XX:+CrashOnOutOfMemoryError -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
136107
steps:
137-
- attach_workspace: { at: /home/circleci }
138-
- restore_cache: { key: 'gradle-wrapper-v2-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
139-
- restore_cache: { key: 'trial-publish-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
108+
- checkout
109+
- run:
110+
name: delete_unrelated_tags
111+
command: |
112+
ALL_TAGS=$(git tag --points-at HEAD)
113+
114+
if [ -z "$ALL_TAGS" ]; then
115+
echo "No-op as there are no tags on the current commit ($(git rev-parse HEAD))"
116+
exit 0
117+
fi
118+
119+
if [ -z "${CIRCLE_TAG:+x}" ]; then
120+
echo "Non-tag build, deleting all tags which point to HEAD: [${ALL_TAGS/$'\n'/,}]"
121+
echo "$ALL_TAGS" | while read -r TAG; do git tag -d "$TAG" 1>/dev/null; done
122+
exit 0
123+
fi
124+
125+
TAGS_TO_DELETE=$(echo "$ALL_TAGS" | grep -v "^$CIRCLE_TAG$" || :)
126+
if [ -z "$TAGS_TO_DELETE" ]; then
127+
echo "No-op as exactly one tag ($CIRCLE_TAG) points to HEAD"
128+
exit 0
129+
fi
130+
131+
echo "Detected tag build, deleting all tags except '$CIRCLE_TAG' which point to HEAD: [${TAGS_TO_DELETE/$'\n'/,}]"
132+
echo "$TAGS_TO_DELETE" | while read -r TAG; do git tag -d "$TAG" 1>/dev/null; done
133+
- restore_cache: { key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
134+
- restore_cache: { key: 'trial-publish-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
140135
- run: ./gradlew --stacktrace publishToMavenLocal -Porg.gradle.java.installations.fromEnv=JAVA_8_HOME,JAVA_11_HOME,JAVA_15_HOME,JAVA_17_HOME,JAVA_HOME
141136
- run:
142137
command: git status --porcelain
143138
when: always
144139
- save_cache:
145-
key: 'trial-publish-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
140+
key: 'trial-publish-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
146141
paths: [ ~/.gradle/caches ]
147142
- store_test_results: { path: ~/junit }
148143
- store_artifacts: { path: ~/artifacts }
@@ -154,18 +149,18 @@ jobs:
154149
CIRCLE_TEST_REPORTS: /home/circleci/junit
155150
CIRCLE_ARTIFACTS: /home/circleci/artifacts
156151
GRADLE_OPTS: -Dorg.gradle.workers.max=1 -Dorg.gradle.jvmargs='-Xmx2g --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
157-
_JAVA_OPTIONS: -XX:ActiveProcessorCount=2 -XX:MaxRAM=4g -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
152+
_JAVA_OPTIONS: -XX:ActiveProcessorCount=2 -XX:MaxRAM=4g -XX:+CrashOnOutOfMemoryError -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
158153
steps:
159154
- attach_workspace: { at: /home/circleci }
160-
- restore_cache: { key: 'gradle-wrapper-v2-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
161-
- restore_cache: { key: 'publish-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
155+
- restore_cache: { key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
156+
- restore_cache: { key: 'publish-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
162157
- deploy:
163158
command: ./gradlew --parallel --stacktrace --continue publish -Porg.gradle.java.installations.fromEnv=JAVA_8_HOME,JAVA_11_HOME,JAVA_15_HOME,JAVA_17_HOME,JAVA_HOME
164159
- run:
165160
command: git status --porcelain
166161
when: always
167162
- save_cache:
168-
key: 'publish-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
163+
key: 'publish-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
169164
paths: [ ~/.gradle/caches ]
170165
- store_test_results: { path: ~/junit }
171166
- store_artifacts: { path: ~/artifacts }
@@ -175,25 +170,15 @@ workflows:
175170
version: 2
176171
build:
177172
jobs:
178-
- compile:
179-
filters: { tags: { only: /.*/ } }
180-
181-
- unit-test:
182-
requires: [ compile ]
183-
filters: { tags: { only: /.*/ } }
184-
185173
- check:
186-
requires: [ compile ]
187174
filters: { tags: { only: /.*/ } }
188175

189176
- build:
190-
requires: [ compile ]
191177
filters: { tags: { only: /.*/ } }
192178

193179
- trial-publish:
194-
requires: [ compile ]
195180
filters: { branches: { ignore: develop } }
196181

197182
- publish:
198-
requires: [ unit-test, check, build, trial-publish ]
183+
requires: [ check, build, trial-publish ]
199184
filters: { tags: { only: /.*/ }, branches: { only: develop } }

0 commit comments

Comments
 (0)