|
| 1 | +################################################ |
| 2 | +# Evergreen Template for MongoDB CSharp Analyzer |
| 3 | +################################################ |
| 4 | + |
| 5 | +# When a task that used to pass starts to fail |
| 6 | +# Go through all versions that may have been skipped to detect |
| 7 | +# when the task started failing |
| 8 | +stepback: true |
| 9 | + |
| 10 | +# Mark a failure as a system/bootstrap failure (purple box) rather then a task |
| 11 | +# failure by default. |
| 12 | +# Actual testing tasks are marked with `type: test` |
| 13 | +command_type: system |
| 14 | + |
| 15 | +# Protect ourself against rogue test case, or curl gone wild, that runs forever |
| 16 | +exec_timeout_secs: 900 |
| 17 | + |
| 18 | +# What to do when evergreen hits the timeout (`post:` tasks are run automatically) |
| 19 | +timeout: |
| 20 | + - command: shell.exec |
| 21 | + params: |
| 22 | + script: | |
| 23 | + ls -la |
| 24 | + df -h |
| 25 | +
|
| 26 | +functions: |
| 27 | + |
| 28 | + fetch-source: |
| 29 | + # Executes git clone and applies the submitted patch, if any |
| 30 | + - command: git.get_project |
| 31 | + params: |
| 32 | + directory: mongo-csharp-analyzer |
| 33 | + # Applies the subitted patch, if any |
| 34 | + # Deprecated. Should be removed. But still needed for certain agents (ZAP) |
| 35 | + - command: git.apply_patch |
| 36 | + # Make an evergreen exapanstion file with dynamic values |
| 37 | + - command: shell.exec |
| 38 | + params: |
| 39 | + shell: bash |
| 40 | + working_dir: mongo-csharp-analyzer |
| 41 | + script: | |
| 42 | + PACKAGE_VERSION=$(git describe --tags) |
| 43 | + # Get the current unique version of this checkout |
| 44 | + if [ "${is_patch}" = "true" ]; then |
| 45 | + CURRENT_VERSION=$(git describe)-patch-${version_id} |
| 46 | + else |
| 47 | + CURRENT_VERSION=latest |
| 48 | + fi |
| 49 | +
|
| 50 | + export DOTNET_SDK_PATH="$(pwd)/../.dotnet" |
| 51 | +
|
| 52 | + if [ "Windows_NT" != "$OS" ]; then |
| 53 | + # non windows OSs don't have dotnet in the PATH |
| 54 | + export PATH=$PATH:/usr/share/dotnet |
| 55 | + fi |
| 56 | +
|
| 57 | + export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin" |
| 58 | + export PROJECT_DIRECTORY="$(pwd)" |
| 59 | +
|
| 60 | + cat <<EOT > expansion.yml |
| 61 | + PACKAGE_VERSION: "$PACKAGE_VERSION" |
| 62 | + CURRENT_VERSION: "$CURRENT_VERSION" |
| 63 | + PROJECT_DIRECTORY: "$PROJECT_DIRECTORY" |
| 64 | + DOTNET_SDK_PATH: "$DOTNET_SDK_PATH" |
| 65 | + PREPARE_SHELL: | |
| 66 | + set -o errexit |
| 67 | + set -o xtrace |
| 68 | + export PACKAGE_VERSION="$PACKAGE_VERSION" |
| 69 | + export PROJECT_DIRECTORY="$PROJECT_DIRECTORY" |
| 70 | + export DOTNET_SDK_PATH="$DOTNET_SDK_PATH" |
| 71 | + export PATH="$DOTNET_SDK_PATH:$MONGODB_BINARIES:$PATH" |
| 72 | + export PROJECT="${project}" |
| 73 | + EOT |
| 74 | + # See what we've done |
| 75 | + cat expansion.yml |
| 76 | +
|
| 77 | + # Load the expansion file to make an evergreen variable with the current unique version |
| 78 | + - command: expansions.update |
| 79 | + params: |
| 80 | + file: mongo-csharp-analyzer/expansion.yml |
| 81 | + |
| 82 | + install-dependencies: |
| 83 | + - command: shell.exec |
| 84 | + params: |
| 85 | + script: | |
| 86 | + ${PREPARE_SHELL} |
| 87 | + OS=${OS} \ |
| 88 | + ${PROJECT_DIRECTORY}/evergreen/install-dependencies.sh |
| 89 | +
|
| 90 | + upload-mo-artifacts: |
| 91 | + - command: shell.exec |
| 92 | + params: |
| 93 | + script: | |
| 94 | + ${PREPARE_SHELL} |
| 95 | + |
| 96 | + - command: s3.put |
| 97 | + params: |
| 98 | + aws_key: ${aws_key} |
| 99 | + aws_secret: ${aws_secret} |
| 100 | + local_file: mongodb-logs.tar.gz |
| 101 | + remote_file: ${build_variant}/${revision}/${version_id}/${build_id}/logs/${task_id}-${execution}-mongodb-logs.tar.gz |
| 102 | + bucket: ${aws_upload_bucket} |
| 103 | + permissions: public-read |
| 104 | + content_type: ${content_type|application/x-gzip} |
| 105 | + display_name: "mongodb-logs.tar.gz" |
| 106 | + - command: s3.put |
| 107 | + params: |
| 108 | + aws_key: ${aws_key} |
| 109 | + aws_secret: ${aws_secret} |
| 110 | + local_file: drivers-tools/.evergreen/orchestration/server.log |
| 111 | + remote_file: ${build_variant}/${revision}/${version_id}/${build_id}/logs/${task_id}-${execution}-orchestration.log |
| 112 | + bucket: ${aws_upload_bucket} |
| 113 | + permissions: public-read |
| 114 | + content_type: ${content_type|text/plain} |
| 115 | + display_name: "orchestration.log" |
| 116 | + |
| 117 | + upload-test-results: |
| 118 | + - command: attach.xunit_results |
| 119 | + params: |
| 120 | + file: ./mongo-csharp-analyzer/build/test-results/TEST*.xml |
| 121 | + |
| 122 | + get-driver-version: |
| 123 | + - command: shell.exec |
| 124 | + params: |
| 125 | + working_dir: mongo-csharp-analyzer |
| 126 | + script: | |
| 127 | + ${PREPARE_SHELL} |
| 128 | + DRIVER_VERSION=${DRIVER_VERSION} \ |
| 129 | + evergreen/get-driver-version.sh |
| 130 | +
|
| 131 | + run-tests: |
| 132 | + - command: shell.exec |
| 133 | + type: test |
| 134 | + params: |
| 135 | + working_dir: mongo-csharp-analyzer |
| 136 | + script: | |
| 137 | + ${PREPARE_SHELL} |
| 138 | + DRIVER_VERSION=${DRIVER_VERSION} \ |
| 139 | + TARGET_FRAMEWORK=${TARGET_FRAMEWORK} \ |
| 140 | + OS=${OS} \ |
| 141 | + evergreen/run-tests.sh |
| 142 | +
|
| 143 | + package-pack: |
| 144 | + - command: shell.exec |
| 145 | + params: |
| 146 | + working_dir: mongo-csharp-analyzer |
| 147 | + script: | |
| 148 | + ${PREPARE_SHELL} |
| 149 | + OS=${OS} \ |
| 150 | + PACKAGE_VERSION=${PACKAGE_VERSION} \ |
| 151 | + evergreen/run-pack.sh |
| 152 | +
|
| 153 | + package-push: |
| 154 | + - command: shell.exec |
| 155 | + params: |
| 156 | + working_dir: mongo-csharp-analyzer |
| 157 | + env: |
| 158 | + NUGET_KEY: ${nuget_key} |
| 159 | + script: | |
| 160 | + ${PREPARE_SHELL} |
| 161 | + PACKAGE_VERSION=${PACKAGE_VERSION} evergreen/run-push.sh |
| 162 | +
|
| 163 | + cleanup: |
| 164 | + - command: shell.exec |
| 165 | + params: |
| 166 | + script: | |
| 167 | + ${PREPARE_SHELL} |
| 168 | +
|
| 169 | + fix-absolute-paths: |
| 170 | + - command: shell.exec |
| 171 | + params: |
| 172 | + script: | |
| 173 | + ${PREPARE_SHELL} |
| 174 | + for filename in $(find ${DRIVERS_TOOLS} -name \*.json); do |
| 175 | + perl -p -i -e "s|ABSOLUTE_PATH_REPLACEMENT_TOKEN|${DRIVERS_TOOLS}|g" $filename |
| 176 | + done |
| 177 | +
|
| 178 | + windows-fix: |
| 179 | + - command: shell.exec |
| 180 | + params: |
| 181 | + script: | |
| 182 | + if [ "Windows_NT" = "$OS" ]; then |
| 183 | + ${PREPARE_SHELL} |
| 184 | + for i in $(find ${DRIVERS_TOOLS}/.evergreen ${PROJECT_DIRECTORY}/evergreen -name \*.sh); do |
| 185 | + cat $i | tr -d '\r' > $i.new |
| 186 | + mv $i.new $i |
| 187 | + done |
| 188 | + # Copy client certificate because symlinks do not work on Windows. |
| 189 | + cp ${DRIVERS_TOOLS}/.evergreen/x509gen/client.pem ${MONGO_ORCHESTRATION_HOME}/lib/client.pem |
| 190 | + fi |
| 191 | +
|
| 192 | + make-files-executable: |
| 193 | + - command: shell.exec |
| 194 | + params: |
| 195 | + script: | |
| 196 | + ${PREPARE_SHELL} |
| 197 | + for i in $(find ${DRIVERS_TOOLS}/.evergreen ${PROJECT_DIRECTORY}/evergreen -name \*.sh); do |
| 198 | + chmod +x $i |
| 199 | + done |
| 200 | +
|
| 201 | +pre: |
| 202 | + - func: fetch-source |
| 203 | + - func: windows-fix |
| 204 | + - func: fix-absolute-paths |
| 205 | + - func: make-files-executable |
| 206 | + - func: install-dependencies |
| 207 | + |
| 208 | +post: |
| 209 | + - func: upload-mo-artifacts |
| 210 | + - func: cleanup |
| 211 | + |
| 212 | +tasks: |
| 213 | + - name: test-netcoreapp31 |
| 214 | + commands: |
| 215 | + - func: get-driver-version |
| 216 | + - command: expansions.update |
| 217 | + params: |
| 218 | + file: mongo-csharp-analyzer/version-expansion.yml |
| 219 | + - func: run-tests |
| 220 | + vars: |
| 221 | + TARGET_FRAMEWORK: netcoreapp3.1 |
| 222 | + - func: upload-test-results |
| 223 | + |
| 224 | + - name: test-net472 |
| 225 | + commands: |
| 226 | + - func: get-driver-version |
| 227 | + - command: expansions.update |
| 228 | + params: |
| 229 | + file: mongo-csharp-analyzer/version-expansion.yml |
| 230 | + - func: run-tests |
| 231 | + vars: |
| 232 | + TARGET_FRAMEWORK: net472 |
| 233 | + - func: upload-test-results |
| 234 | + |
| 235 | + - name: package-pack |
| 236 | + depends_on: |
| 237 | + - name: test-netcoreapp31 |
| 238 | + variant: .tests-variant |
| 239 | + commands: |
| 240 | + - func: package-pack |
| 241 | + |
| 242 | + - name: package-push |
| 243 | + commands: |
| 244 | + - func: package-push |
| 245 | + |
| 246 | +axes: |
| 247 | + - id: driver |
| 248 | + display_name: MongoDB Driver Version |
| 249 | + values: |
| 250 | + - id: "latest" |
| 251 | + display_name: "latest" |
| 252 | + variables: |
| 253 | + DRIVER_VERSION: "latest" |
| 254 | + - id: "2.25" |
| 255 | + display_name: "2.25.0" |
| 256 | + variables: |
| 257 | + DRIVER_VERSION: "2.25.0" |
| 258 | + - id: "2.23" |
| 259 | + display_name: "2.23.0" |
| 260 | + variables: |
| 261 | + DRIVER_VERSION: "2.23.0" |
| 262 | + - id: "2.21" |
| 263 | + display_name: "2.21.0" |
| 264 | + variables: |
| 265 | + DRIVER_VERSION: "2.21.0" |
| 266 | + - id: "2.19.0" |
| 267 | + display_name: "2.19.0" |
| 268 | + variables: |
| 269 | + DRIVER_VERSION: "2.19.0" |
| 270 | + - id: "2.18.0" |
| 271 | + display_name: "2.18.0" |
| 272 | + variables: |
| 273 | + DRIVER_VERSION: "2.18.0" |
| 274 | + - id: "2.12.4" |
| 275 | + display_name: "2.12.4" |
| 276 | + variables: |
| 277 | + DRIVER_VERSION: "2.12.4" |
| 278 | + |
| 279 | + - id: os |
| 280 | + display_name: OS |
| 281 | + values: |
| 282 | + - id: "windows-64" |
| 283 | + display_name: "Windows 64-bit" |
| 284 | + variables: |
| 285 | + OS: "windows-64" |
| 286 | + run_on: windows-64-vs2017-test |
| 287 | + - id: "ubuntu-2004" |
| 288 | + display_name: "Ubuntu 20.04" |
| 289 | + variables: |
| 290 | + OS: "ubuntu-2004" |
| 291 | + python3_binary: "/opt/python/3.8/bin/python3" |
| 292 | + run_on: ubuntu2004-test |
| 293 | + - id: "macos-1100" |
| 294 | + display_name: "macOS 11.00" |
| 295 | + variables: |
| 296 | + OS: "macos-1100" |
| 297 | + python3_binary: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 |
| 298 | + run_on: macos-1100 |
| 299 | + |
| 300 | +buildvariants: |
| 301 | +- matrix_name: "tests-linux" |
| 302 | + matrix_spec: { os: ["ubuntu-2004"], driver: "*"} |
| 303 | + display_name: "${driver} CSharp Analyzer on ${os}, driver version ${driver}" |
| 304 | + tags: ["tests-variant"] |
| 305 | + tasks: |
| 306 | + - name: test-netcoreapp31 |
| 307 | + |
| 308 | +- matrix_name: "tests-mac" |
| 309 | + matrix_spec: { os: ["macos-1100"], driver: "*"} |
| 310 | + display_name: "${driver} CSharp Analyzer on ${os}, driver version ${driver}" |
| 311 | + tags: ["tests-variant"] |
| 312 | + tasks: |
| 313 | + - name: test-netcoreapp31 |
| 314 | + |
| 315 | +- matrix_name: "tests-windows" |
| 316 | + matrix_spec: { os: ["windows-64"], driver: "*" } |
| 317 | + display_name: "${driver} CSharp Analyzer on ${os}, driver version ${driver}" |
| 318 | + tags: ["tests-variant"] |
| 319 | + tasks: |
| 320 | + - name: test-netcoreapp31 |
| 321 | + |
| 322 | +- name: package-pack |
| 323 | + git_tag_only: true |
| 324 | + display_name: "Package Pack" |
| 325 | + run_on: ubuntu2004-small |
| 326 | + tasks: |
| 327 | + - name: package-pack |
| 328 | + |
| 329 | +- name: package-push |
| 330 | + git_tag_only: true |
| 331 | + display_name: "Package Push" |
| 332 | + run_on: ubuntu2004-small |
| 333 | + tasks: |
| 334 | + - name: package-push |
0 commit comments