|
| 1 | +# |
| 2 | +# The MIT License |
| 3 | +# |
| 4 | +# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 | +# of this software and associated documentation files (the "Software"), to deal |
| 6 | +# in the Software without restriction, including without limitation the rights |
| 7 | +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 8 | +# copies of the Software, and to permit persons to whom the Software is |
| 9 | +# furnished to do so, subject to the following conditions: |
| 10 | +# |
| 11 | +# The above copyright notice and this permission notice shall be included in |
| 12 | +# all copies or substantial portions of the Software. |
| 13 | +# |
| 14 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 17 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 18 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 19 | +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 20 | +# THE SOFTWARE. |
| 21 | +# |
| 22 | + |
| 23 | +version: 2 |
| 24 | +jobs: |
| 25 | + check-dependencies: |
| 26 | + docker: |
| 27 | + - image: cimg/openjdk:11.0 |
| 28 | + steps: |
| 29 | + - checkout |
| 30 | + - restore_cache: |
| 31 | + name: Restoring Maven Cache |
| 32 | + keys: |
| 33 | + - maven-cache_v1-cimg/openjdk:11.0- |
| 34 | + - run: |
| 35 | + name: Check dependency rules |
| 36 | + command: mvn enforcer:enforce -Denforcer.rules=banDuplicatePomDependencyVersions,dependencyConvergence |
| 37 | + check-licenses: |
| 38 | + docker: |
| 39 | + - image: cimg/openjdk:11.0 |
| 40 | + steps: |
| 41 | + - checkout |
| 42 | + - restore_cache: |
| 43 | + name: Restoring Maven Cache |
| 44 | + keys: |
| 45 | + - maven-cache_v1-cimg/openjdk:11.0- |
| 46 | + - run: |
| 47 | + name: Check dependency licenses |
| 48 | + command: mvn license:check -Dlicense.dependencies.enforce=true |
| 49 | + check-generate-site: |
| 50 | + docker: |
| 51 | + - image: cimg/openjdk:11.0 |
| 52 | + steps: |
| 53 | + - checkout |
| 54 | + - restore_cache: |
| 55 | + name: Restoring Maven Cache |
| 56 | + keys: |
| 57 | + - maven-cache_v1-cimg/openjdk:11.0- |
| 58 | + - run: |
| 59 | + name: Check generate site |
| 60 | + command: mvn clean site site:stage -DskipTests |
| 61 | + jdk-11: |
| 62 | + docker: |
| 63 | + - image: cimg/openjdk:11.0 |
| 64 | + steps: |
| 65 | + - checkout |
| 66 | + - restore_cache: |
| 67 | + name: Restoring Maven Cache |
| 68 | + keys: |
| 69 | + - maven-cache_v1-cimg/openjdk:11.0-{{ checksum "pom.xml" }} |
| 70 | + - maven-cache_v3-cimg/openjdk:11.0- |
| 71 | + - run: |
| 72 | + name: Running tests |
| 73 | + command: | |
| 74 | + mvn -B -U clean install -DargLine="@{argLine} " |
| 75 | + - save_cache: |
| 76 | + name: Saving Maven Cache |
| 77 | + key: maven-cache_v1-cimg/openjdk:11.0-{{ checksum "pom.xml" }} |
| 78 | + paths: |
| 79 | + - ~/.m2 |
| 80 | +# - run: |
| 81 | +# name: Copying test results |
| 82 | +# when: always |
| 83 | +# command: | |
| 84 | +# mkdir test-results |
| 85 | +# cp target/surefire-reports/*.xml test-results/ || true |
| 86 | +# - store_test_results: |
| 87 | +# path: test-results |
| 88 | +# - run: |
| 89 | +# name: Copying artifacts |
| 90 | +# command: | |
| 91 | +# mkdir artifacts |
| 92 | +# cp -r target/*.jar artifacts/ |
| 93 | +# - store_artifacts: |
| 94 | +# path: artifacts |
| 95 | +# - run: |
| 96 | +# name: Collecting coverage reports |
| 97 | +# command: | |
| 98 | +# curl -Os https://uploader.codecov.io/latest/linux/codecov |
| 99 | +# curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM |
| 100 | +# curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig |
| 101 | +# curl -s https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import |
| 102 | +# gpgv codecov.SHA256SUM.sig codecov.SHA256SUM |
| 103 | +# shasum -a 256 -c codecov.SHA256SUM |
| 104 | +# chmod +x ./codecov |
| 105 | +# ./codecov |
| 106 | + jdk-17: |
| 107 | + docker: |
| 108 | + - image: cimg/openjdk:17.0 |
| 109 | + steps: |
| 110 | + - checkout |
| 111 | + - restore_cache: |
| 112 | + name: Restoring Maven Cache |
| 113 | + keys: |
| 114 | + - maven-cache_v1-cimg/openjdk:17.0-{{ checksum "pom.xml" }} |
| 115 | + - maven-cache_v3-cimg/openjdk:17.0- |
| 116 | + - run: |
| 117 | + name: Running tests |
| 118 | + command: | |
| 119 | + mvn -B -U clean install -DargLine="@{argLine} --add-opens=java.base/java.nio=ALL-UNNAMED" |
| 120 | + - save_cache: |
| 121 | + name: Saving Maven Cache |
| 122 | + key: maven-cache_v1-cimg/openjdk:17.0-{{ checksum "pom.xml" }} |
| 123 | + paths: |
| 124 | + - ~/.m2 |
| 125 | + - run: |
| 126 | + name: Copying test results |
| 127 | + when: always |
| 128 | + command: | |
| 129 | + mkdir test-results |
| 130 | + cp target/surefire-reports/*.xml test-results/ || true |
| 131 | + - store_test_results: |
| 132 | + path: test-results |
| 133 | + - run: |
| 134 | + name: Copying artifacts |
| 135 | + command: | |
| 136 | + mkdir artifacts |
| 137 | + cp -r target/*.jar artifacts/ |
| 138 | + - store_artifacts: |
| 139 | + path: artifacts |
| 140 | + - run: |
| 141 | + name: Collecting coverage reports |
| 142 | + command: | |
| 143 | + curl -Os https://uploader.codecov.io/latest/linux/codecov |
| 144 | + curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM |
| 145 | + curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig |
| 146 | + curl -s https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import |
| 147 | + gpgv codecov.SHA256SUM.sig codecov.SHA256SUM |
| 148 | + shasum -a 256 -c codecov.SHA256SUM |
| 149 | + chmod +x ./codecov |
| 150 | + ./codecov |
| 151 | + jdk-20: |
| 152 | + docker: |
| 153 | + - image: cimg/openjdk:20.0 |
| 154 | + steps: |
| 155 | + - checkout |
| 156 | + - restore_cache: |
| 157 | + name: Restoring Maven Cache |
| 158 | + keys: |
| 159 | + - maven-cache_v1-cimg/openjdk:20.0-{{ checksum "pom.xml" }} |
| 160 | + - maven-cache_v3-cimg/openjdk:20.0- |
| 161 | + - run: |
| 162 | + name: Running tests |
| 163 | + command: | |
| 164 | + mvn -B -U clean install -DargLine="@{argLine} --add-opens=java.base/java.nio=ALL-UNNAMED" |
| 165 | + - save_cache: |
| 166 | + name: Saving Maven Cache |
| 167 | + key: maven-cache_v1-cimg/openjdk:20.0-{{ checksum "pom.xml" }} |
| 168 | + paths: |
| 169 | + - ~/.m2 |
| 170 | + - run: |
| 171 | + name: Copying test results |
| 172 | + when: always |
| 173 | + command: | |
| 174 | + mkdir test-results |
| 175 | + cp target/surefire-reports/*.xml test-results/ || true |
| 176 | + - store_test_results: |
| 177 | + path: test-results |
| 178 | + - run: |
| 179 | + name: Copying artifacts |
| 180 | + command: | |
| 181 | + mkdir artifacts |
| 182 | + cp -r target/*.jar artifacts/ |
| 183 | + - store_artifacts: |
| 184 | + path: artifacts |
| 185 | + - run: |
| 186 | + name: Collecting coverage reports |
| 187 | + command: | |
| 188 | + curl -Os https://uploader.codecov.io/latest/linux/codecov |
| 189 | + curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM |
| 190 | + curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig |
| 191 | + curl -s https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import |
| 192 | + gpgv codecov.SHA256SUM.sig codecov.SHA256SUM |
| 193 | + shasum -a 256 -c codecov.SHA256SUM |
| 194 | + chmod +x ./codecov |
| 195 | + ./codecov |
| 196 | + jdk-21: |
| 197 | + docker: |
| 198 | + - image: cimg/openjdk:21.0 |
| 199 | + steps: |
| 200 | + - checkout |
| 201 | + - restore_cache: |
| 202 | + name: Restoring Maven Cache |
| 203 | + keys: |
| 204 | + - maven-cache_v1-cimg/openjdk:21.0-{{ checksum "pom.xml" }} |
| 205 | + - maven-cache_v3-cimg/openjdk:21.0- |
| 206 | + - run: |
| 207 | + name: Running tests |
| 208 | + command: | |
| 209 | + mvn -B -U clean install -DargLine="@{argLine} --add-opens=java.base/java.nio=ALL-UNNAMED" |
| 210 | + - save_cache: |
| 211 | + name: Saving Maven Cache |
| 212 | + key: maven-cache_v1-cimg/openjdk:21.0-{{ checksum "pom.xml" }} |
| 213 | + paths: |
| 214 | + - ~/.m2 |
| 215 | + - run: |
| 216 | + name: Copying test results |
| 217 | + when: always |
| 218 | + command: | |
| 219 | + mkdir test-results |
| 220 | + cp target/surefire-reports/*.xml test-results/ || true |
| 221 | + - store_test_results: |
| 222 | + path: test-results |
| 223 | + - run: |
| 224 | + name: Copying artifacts |
| 225 | + command: | |
| 226 | + mkdir artifacts |
| 227 | + cp -r target/*.jar artifacts/ |
| 228 | + - store_artifacts: |
| 229 | + path: artifacts |
| 230 | + - run: |
| 231 | + name: Collecting coverage reports |
| 232 | + command: | |
| 233 | + curl -Os https://uploader.codecov.io/latest/linux/codecov |
| 234 | + curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM |
| 235 | + curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig |
| 236 | + curl -s https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import |
| 237 | + gpgv codecov.SHA256SUM.sig codecov.SHA256SUM |
| 238 | + shasum -a 256 -c codecov.SHA256SUM |
| 239 | + chmod +x ./codecov |
| 240 | + ./codecov |
| 241 | + deploy-snapshot: |
| 242 | + docker: |
| 243 | + - image: cimg/openjdk:11.0 |
| 244 | + steps: |
| 245 | + - run: |
| 246 | + name: Early return if this build is from a forked repository |
| 247 | + command: | |
| 248 | + if [[ $CIRCLE_PROJECT_USERNAME != "InfluxCommunity" ]]; then |
| 249 | + echo "Nothing to do for forked repositories, so marking this step successful" |
| 250 | + circleci step halt |
| 251 | + fi |
| 252 | + - checkout |
| 253 | + - run: |
| 254 | + name: Early return if this build is not a Snapshot version |
| 255 | + command: | |
| 256 | + sudo apt-get update |
| 257 | + sudo apt-get install libxml2-utils |
| 258 | + export PROJECT_VERSION=$(xmllint --xpath "//*[local-name()='project']/*[local-name()='version']/text()" pom.xml) |
| 259 | + echo "Project version: $PROJECT_VERSION" |
| 260 | + if [[ $PROJECT_VERSION != *SNAPSHOT ]]; then |
| 261 | + echo "Nothing to do for this build, so marking this step successful" |
| 262 | + circleci step halt |
| 263 | + fi |
| 264 | + - restore_cache: |
| 265 | + name: Restoring Maven Cache |
| 266 | + keys: |
| 267 | + - maven-cache-deploy_v1-{{ checksum "pom.xml" }} |
| 268 | + - maven-cache-deploy_v1- |
| 269 | + - run: |
| 270 | + name: Deploying Snapshot |
| 271 | + command: | |
| 272 | + mvn -s ./deploy-settings.xml -DskipTests=true clean deploy |
| 273 | + - save_cache: |
| 274 | + name: Saving Maven Cache |
| 275 | + key: maven-cache-deploy_v1-{{ checksum "pom.xml" }} |
| 276 | + paths: |
| 277 | + - ~/.m2 |
| 278 | +workflows: |
| 279 | + version: 2 |
| 280 | + build: |
| 281 | + jobs: |
| 282 | + - check-dependencies |
| 283 | + - check-licenses |
| 284 | + - check-generate-site |
| 285 | + - jdk-11 |
| 286 | + - jdk-17 |
| 287 | + - jdk-20 |
| 288 | + - jdk-21 |
| 289 | + - deploy-snapshot: |
| 290 | + filters: |
| 291 | + branches: |
| 292 | + only: main |
| 293 | + requires: |
| 294 | + - check-dependencies |
| 295 | + - check-licenses |
| 296 | + - check-generate-site |
| 297 | + - jdk-11 |
| 298 | + - jdk-17 |
| 299 | + - jdk-20 |
| 300 | + - jdk-21 |
| 301 | + upstream: |
| 302 | + check-dependencies: |
| 303 | + - success |
| 304 | + check-licenses: |
| 305 | + - success |
| 306 | + check-generate-site: |
| 307 | + - success |
| 308 | + jdk-11: |
| 309 | + - success |
| 310 | + jdk-17: |
| 311 | + - success |
| 312 | + jdk-20: |
| 313 | + - success |
| 314 | + jdk-21: |
| 315 | + - success |
0 commit comments