|
| 1 | +# ************************************************************************************ |
| 2 | +# Copyright (c) 2024 SingleStore, Inc. |
| 3 | +# |
| 4 | +# This library is free software; you can redistribute it and/or |
| 5 | +# modify it under the terms of the GNU Library General Public |
| 6 | +# License as published by the Free Software Foundation; either |
| 7 | +# version 2.1 of the License, or (at your option) any later version. |
| 8 | +# |
| 9 | +# This library is distributed in the hope that it will be useful, |
| 10 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | +# Library General Public License for more details. |
| 13 | +# |
| 14 | +# You should have received a copy of the GNU Library General Public |
| 15 | +# License along with this library; if not see <http://www.gnu.org/licenses> |
| 16 | +# or write to the Free Software Foundation, Inc., |
| 17 | +# 51 Franklin St., Fifth Floor, Boston, MA 02110, USA |
| 18 | +# *************************************************************************************/ |
| 19 | + |
| 20 | +# Use the latest 2.1 version of CircleCI pipeline process engine. See: https://circleci.com/docs/2.0/configuration-reference |
| 21 | +version: 2.1 |
| 22 | +commands: |
| 23 | + setup_environment: |
| 24 | + description: "Setup the machine environment" |
| 25 | + parameters: |
| 26 | + sbt_version: |
| 27 | + type: string |
| 28 | + default: 1.3.5 |
| 29 | + java_version: |
| 30 | + type: string |
| 31 | + default: '8' |
| 32 | + steps: |
| 33 | + - run: |
| 34 | + name: Setup Machine |
| 35 | + command: | |
| 36 | + sudo apt-get update |
| 37 | + sudo apt-get clean |
| 38 | + sudo apt-get install -y sbt python3-pip git mariadb-client-core-10.6 |
| 39 | + sudo apt-get autoclean |
| 40 | + # Install Java |
| 41 | + sudo apt-get install -y openjdk-8-jdk |
| 42 | + sudo apt-get install -y openjdk-11-jdk |
| 43 | + sudo apt-get install -y openjdk-17-jdk |
| 44 | + sudo apt-get install -y openjdk-21-jdk |
| 45 | +
|
| 46 | +jobs: |
| 47 | + test: |
| 48 | + parameters: |
| 49 | + singlestore_version: |
| 50 | + type: string |
| 51 | + singlestore_password: |
| 52 | + type: string |
| 53 | + machine_class: |
| 54 | + type: string |
| 55 | + working_directory: ~/singlestore-jdbc-client |
| 56 | + machine: |
| 57 | + image: ubuntu-2204:2024.01.1 |
| 58 | + resource_class: << parameters.machine_class >> |
| 59 | + environment: |
| 60 | + SINGLESTORE_VERSION: << parameters.singlestore_version >> |
| 61 | + SINGLESTORE_PASSWORD: << parameters.singlestore_password >> |
| 62 | + JAVA_HOME: /usr/lib/jvm/java-11-openjdk-amd64 |
| 63 | + RUN_LONG_TEST: true |
| 64 | + TEST_ENVIRON: CIRCLE_CI |
| 65 | + steps: |
| 66 | + - setup_environment: |
| 67 | + java_version: '8' |
| 68 | + - checkout |
| 69 | + - run: |
| 70 | + name: Setup test cluster |
| 71 | + command: ./scripts/ensure-test-singlestore-cluster-password.sh |
| 72 | + - restore_cache: # restore the saved cache after the first run or if `pom.xml` has changed |
| 73 | + # Read about caching dependencies: https://circleci.com/docs/2.0/caching/ |
| 74 | + key: singlestore-jdbc-client-{{ checksum "pom.xml" }} |
| 75 | + - run: mvn dependency:go-offline # gets the project dependencies |
| 76 | + - save_cache: # saves the project dependencies |
| 77 | + paths: |
| 78 | + - ~/.m2 |
| 79 | + key: singlestore-jdbc-client-{{ checksum "pom.xml" }} |
| 80 | + - run: mvn package -DjavadocExecutable=/usr/lib/jvm/java-8-openjdk-amd64/bin/javadoc |
| 81 | + - store_test_results: # uploads the test metadata from the `target/surefire-reports` directory so that it can show up in the CircleCI dashboard. |
| 82 | + # Upload test results for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/ |
| 83 | + path: target/surefire-reports |
| 84 | + - store_artifacts: # store the jar as an artifact |
| 85 | + # Upload test summary for display in Artifacts: https://circleci.com/docs/2.0/artifacts/ |
| 86 | + path: target/singlestore-jdbc-client-1.2.8.jar |
| 87 | + - store_artifacts: |
| 88 | + path: target/singlestore-jdbc-client-1.2.8-browser-sso-uber.jar |
| 89 | + # See https://circleci.com/docs/2.0/deployment-integrations/ for deploy examples |
| 90 | + test_jdk: |
| 91 | + parameters: |
| 92 | + java_version: |
| 93 | + type: string |
| 94 | + singlestore_version: |
| 95 | + type: string |
| 96 | + singlestore_password: |
| 97 | + type: string |
| 98 | + machine_class: |
| 99 | + type: string |
| 100 | + working_directory: ~/singlestore-jdbc-client |
| 101 | + machine: |
| 102 | + image: ubuntu-2204:2024.01.1 |
| 103 | + resource_class: << parameters.machine_class >> |
| 104 | + environment: |
| 105 | + SINGLESTORE_VERSION: << parameters.singlestore_version >> |
| 106 | + SINGLESTORE_PASSWORD: << parameters.singlestore_password >> |
| 107 | + TEST_ENVIRON: CIRCLE_CI |
| 108 | + RUN_LONG_TEST: false |
| 109 | + JAVA_HOME: /usr/lib/jvm/java-11-openjdk-amd64 |
| 110 | + JAVA_HOME_ROOT: /usr/lib/jvm |
| 111 | + JAVA_VERSION: << parameters.java_version >> |
| 112 | + steps: |
| 113 | + - setup_environment: |
| 114 | + java_version: << parameters.java_version >> |
| 115 | + - checkout |
| 116 | + - run: |
| 117 | + name: Setup test cluster |
| 118 | + command: ./scripts/ensure-test-singlestore-cluster-password.sh |
| 119 | + - restore_cache: # restore the saved cache after the first run or if `pom.xml` has changed |
| 120 | + # Read about caching dependencies: https://circleci.com/docs/2.0/caching/ |
| 121 | + key: singlestore-jdbc-client-{{ checksum "pom.xml" }} |
| 122 | + - run: mvn dependency:go-offline # gets the project dependencies |
| 123 | + - save_cache: # saves the project dependencies |
| 124 | + paths: |
| 125 | + - ~/.m2 |
| 126 | + key: singlestore-jdbc-client-{{ checksum "pom.xml" }} |
| 127 | + - run: |
| 128 | + name: Compile |
| 129 | + command: | |
| 130 | + echo "Compile with JDK ${JAVA_HOME}" |
| 131 | + if [ "${JAVA_VERSION}" = "8" ]; then |
| 132 | + mvn clean test-compile -Pjava8 |
| 133 | + else |
| 134 | + mvn clean test-compile |
| 135 | + fi |
| 136 | + - run: |
| 137 | + name: Run JDK tests |
| 138 | + command: | |
| 139 | + echo "Run tests with JDK ${JAVA_VERSION}" |
| 140 | + mvn --global-toolchains ci/toolchains.xml -Ptest-jdk surefire:test@jdk-${JAVA_VERSION} |
| 141 | + - store_test_results: # uploads the test metadata from the `target/surefire-reports` directory so that it can show up in the CircleCI dashboard. |
| 142 | + # Upload test results for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/ |
| 143 | + path: target/surefire-reports |
| 144 | + publish: |
| 145 | + machine: |
| 146 | + image: ubuntu-2204:2024.01.1 |
| 147 | + environment: |
| 148 | + # JAVA_HOME: /usr/lib/jvm/java-8-openjdk-amd64 |
| 149 | + SONATYPE_USERNAME: memsql |
| 150 | + steps: |
| 151 | + - setup_environment: |
| 152 | + java_version: '8' |
| 153 | + - checkout |
| 154 | + - run: |
| 155 | + name: Import GPG key |
| 156 | + command: | |
| 157 | + openssl enc -d -aes-256-cbc -K ${ENCRYPTION_KEY} -iv ${ENCRYPTION_IV} -in ci/secring.asc.enc -out ci/secring.asc |
| 158 | + gpg --import ci/secring.asc |
| 159 | + - run: |
| 160 | + name: Maven Settings |
| 161 | + command: | |
| 162 | + mkdir -p ~/.m2 |
| 163 | + cp ci/settings.xml ~/.m2/settings.xml |
| 164 | + - run: |
| 165 | + name: Publish |
| 166 | + command: | |
| 167 | + mvn clean deploy -DskipTests -DjavadocExecutable=/usr/lib/jvm/java-8-openjdk-amd64/bin/javadoc |
| 168 | +workflows: |
| 169 | + test: |
| 170 | + jobs: |
| 171 | + - test: |
| 172 | + filters: |
| 173 | + tags: |
| 174 | + only: /^v.*/ |
| 175 | + matrix: |
| 176 | + parameters: |
| 177 | + machine_class: |
| 178 | + - large |
| 179 | + singlestore_password: |
| 180 | + - password |
| 181 | + singlestore_version: |
| 182 | + - '8.1.52-21a41f6e49' |
| 183 | + - '8.5.30-4f46ab16a5' |
| 184 | + - '8.7.21-f0b8de04d5' |
| 185 | + - '8.9.3-bfa36a984a' |
| 186 | + publish: |
| 187 | + jobs: |
| 188 | + - test_jdk: |
| 189 | + filters: |
| 190 | + tags: |
| 191 | + only: /^v.*/ |
| 192 | + branches: |
| 193 | + ignore: /.*/ |
| 194 | + matrix: |
| 195 | + parameters: |
| 196 | + machine_class: |
| 197 | + - large |
| 198 | + singlestore_password: |
| 199 | + - password |
| 200 | + singlestore_version: |
| 201 | + - '' |
| 202 | + java_version: |
| 203 | + - '8' |
| 204 | + - '11' |
| 205 | + - '17' |
| 206 | + - '21' |
| 207 | + - approve-publish: |
| 208 | + requires: |
| 209 | + - test_jdk |
| 210 | + type: approval |
| 211 | + filters: |
| 212 | + tags: |
| 213 | + only: /^v.*/ |
| 214 | + branches: |
| 215 | + ignore: /.*/ |
| 216 | + - publish: |
| 217 | + requires: |
| 218 | + - approve-publish |
| 219 | + filters: |
| 220 | + tags: |
| 221 | + only: /^v.*/ |
| 222 | + branches: |
| 223 | + ignore: /.*/ |
0 commit comments