|
| 1 | +# |
| 2 | +# Copyright 2016-2018 The OpenZipkin Authors |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
| 5 | +# in compliance with the License. You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software distributed under the License |
| 10 | +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
| 11 | +# or implied. See the License for the specific language governing permissions and limitations under |
| 12 | +# the License. |
| 13 | +# |
| 14 | + |
| 15 | +version: 2 |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + docker: |
| 19 | + - image: circleci/openjdk:9-jdk |
| 20 | + steps: |
| 21 | + - checkout |
| 22 | + |
| 23 | + - restore_cache: |
| 24 | + key: maven-dependencies-{{ checksum "pom.xml" }} |
| 25 | + |
| 26 | + - run: |
| 27 | + name: Download dependencies |
| 28 | + command: | |
| 29 | + sudo apt-get install xsltproc |
| 30 | + ./build-support/go-offline.sh |
| 31 | + - save_cache: |
| 32 | + key: maven-dependencies-{{ checksum "pom.xml" }} |
| 33 | + paths: |
| 34 | + - ~/.m2 |
| 35 | + |
| 36 | + - run: |
| 37 | + name: Tests |
| 38 | + command: ./mvnw clean verify |
| 39 | + |
| 40 | + - store_test_results: |
| 41 | + path: target/surefire-reports |
| 42 | + - store_artifacts: |
| 43 | + path: target/surefire-reports |
| 44 | + |
| 45 | + publish_snapshot: |
| 46 | + docker: |
| 47 | + - image: circleci/openjdk:8-jdk |
| 48 | + steps: |
| 49 | + - checkout |
| 50 | + - restore_cache: |
| 51 | + key: maven-dependencies-{{ checksum "pom.xml" }} |
| 52 | + - run: |
| 53 | + name: Publish snapshot |
| 54 | + command: | |
| 55 | + # Guard against running this on pull requests or forks |
| 56 | + [ "$CIRCLE_PROJECT_USERNAME" == "openzipkin" ] || exit 0 |
| 57 | + [ -z "$CIRCLE_PR_NUMBER" ] || exit 0 |
| 58 | + ./build-support/publish-snapshot.sh |
| 59 | +
|
| 60 | + publish_stable: |
| 61 | + docker: |
| 62 | + - image: circleci/openjdk:8-jdk |
| 63 | + steps: |
| 64 | + - checkout |
| 65 | + - restore_cache: |
| 66 | + key: maven-dependencies-{{ checksum "pom.xml" }} |
| 67 | + - run: |
| 68 | + name: Publish stable version |
| 69 | + command: | |
| 70 | + # Guard against running this on pull requests or forks |
| 71 | + [ "$CIRCLE_PROJECT_USERNAME" == "openzipkin" ] || exit 0 |
| 72 | + [ -z "$CIRCLE_PR_NUMBER" ] || exit 0 |
| 73 | + ./build-support/publish-stable.sh |
| 74 | +
|
| 75 | + trigger_publish: |
| 76 | + docker: |
| 77 | + - image: circleci/openjdk:8-jdk |
| 78 | + steps: |
| 79 | + - checkout |
| 80 | + - restore_cache: |
| 81 | + key: maven-dependencies-{{ checksum "pom.xml" }} |
| 82 | + - run: |
| 83 | + name: Configure Git for release |
| 84 | + command: | |
| 85 | + # parameters used during release |
| 86 | + # allocate commits to CI, not the owner of the deploy key |
| 87 | + git config user.name "zipkinci" |
| 88 | + git config user.email "[email protected]" |
| 89 | + # setup https authentication credentials, used by ./mvnw release:prepare |
| 90 | + git config credential.helper "store --file=.git/credentials" |
| 91 | + echo "https://$GH_TOKEN:@github.com" > .git/credentials |
| 92 | + - run: |
| 93 | + name: Trigger publish |
| 94 | + command: | |
| 95 | + # Guard against running this on pull requests or forks |
| 96 | + [ "$CIRCLE_PROJECT_USERNAME" == "openzipkin" ] || exit 0 |
| 97 | + [ -z "$CIRCLE_PR_NUMBER" ] || exit 0 |
| 98 | + ./build-support/trigger-publish.sh |
| 99 | +
|
| 100 | +
|
| 101 | +workflows: |
| 102 | + version: 2 |
| 103 | + build_and_publish: |
| 104 | + jobs: |
| 105 | + - build |
| 106 | + - publish_snapshot: |
| 107 | + requires: |
| 108 | + - build |
| 109 | + filters: |
| 110 | + branches: |
| 111 | + only: master |
| 112 | + - publish_stable: |
| 113 | + requires: |
| 114 | + - build |
| 115 | + filters: |
| 116 | + branches: |
| 117 | + ignore: /.*/ |
| 118 | + tags: |
| 119 | + only: /\d+\.\d+\.\d+/ |
| 120 | + - trigger_publish: |
| 121 | + requires: |
| 122 | + - build |
| 123 | + filters: |
| 124 | + branches: |
| 125 | + ignore: /.*/ |
| 126 | + tags: |
| 127 | + only: /release-\d+\.\d+\.\d+/ |
| 128 | + |
| 129 | +notify: |
| 130 | + webhooks: |
| 131 | + - url: https://webhooks.gitter.im/e/22adbb9973299092e6ae |
0 commit comments