Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 1 | if (env.BRANCH_NAME == "master") { |
| 2 | properties([pipelineTriggers([cron('@daily')])]) |
| 3 | } |
| 4 | |
| 5 | def configs = [ |
| 6 | [ |
| 7 | label: 'windows', |
Paul Kehrer | 4ee1cb9 | 2018-06-27 20:07:14 -0700 | [diff] [blame] | 8 | toxenvs: ['py27', 'py34', 'py35', 'py36', 'py37'], |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 9 | ], |
| 10 | [ |
| 11 | label: 'windows64', |
Paul Kehrer | 4ee1cb9 | 2018-06-27 20:07:14 -0700 | [diff] [blame] | 12 | toxenvs: ['py27', 'py34', 'py35', 'py36', 'py37'], |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 13 | ], |
| 14 | [ |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 15 | label: 'sierra', |
Paul Kehrer | 9037555 | 2017-09-20 20:49:03 +0800 | [diff] [blame] | 16 | toxenvs: ['py27', 'py36'], |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 17 | ], |
| 18 | [ |
| 19 | label: 'yosemite', |
| 20 | toxenvs: ['py27'], |
| 21 | ], |
| 22 | [ |
| 23 | label: 'docker', |
| 24 | imageName: 'pyca/cryptography-runner-centos7', |
| 25 | toxenvs: ['py27'], |
| 26 | ], |
| 27 | [ |
| 28 | label: 'docker', |
| 29 | imageName: 'pyca/cryptography-runner-wheezy', |
| 30 | toxenvs: ['py27'], |
| 31 | ], |
| 32 | [ |
| 33 | label: 'docker', |
| 34 | imageName: 'pyca/cryptography-runner-jessie', |
| 35 | toxenvs: ['py27', 'py34'], |
| 36 | ], |
| 37 | [ |
| 38 | label: 'docker', |
Alex Gaynor | 70639ed | 2017-07-08 11:53:58 -0400 | [diff] [blame] | 39 | imageName: 'pyca/cryptography-runner-stretch', |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 40 | toxenvs: ['py27', 'py35'], |
| 41 | ], |
| 42 | [ |
| 43 | label: 'docker', |
Alex Gaynor | 70639ed | 2017-07-08 11:53:58 -0400 | [diff] [blame] | 44 | imageName: 'pyca/cryptography-runner-buster', |
Alex Gaynor | 20128c7 | 2017-10-28 19:16:49 -0400 | [diff] [blame] | 45 | toxenvs: ['py27', 'py36'], |
Alex Gaynor | 70639ed | 2017-07-08 11:53:58 -0400 | [diff] [blame] | 46 | ], |
| 47 | [ |
| 48 | label: 'docker', |
| 49 | imageName: 'pyca/cryptography-runner-sid', |
Alex Gaynor | a87daea | 2017-10-11 21:36:30 -0400 | [diff] [blame] | 50 | toxenvs: ['py27', 'py36'], |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 51 | ], |
| 52 | [ |
| 53 | label: 'docker', |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 54 | imageName: 'pyca/cryptography-runner-ubuntu-xenial', |
| 55 | toxenvs: ['py27', 'py35'], |
| 56 | ], |
| 57 | [ |
| 58 | label: 'docker', |
| 59 | imageName: 'pyca/cryptography-runner-ubuntu-rolling', |
Alex Gaynor | f2a0333 | 2017-10-21 09:13:42 -0400 | [diff] [blame] | 60 | toxenvs: ['py27', 'py36', 'randomorder'], |
Alex Gaynor | 4022637 | 2017-05-23 14:14:18 -0700 | [diff] [blame] | 61 | ], |
| 62 | [ |
| 63 | label: 'docker', |
Paul Kehrer | 6bdae78 | 2017-06-06 08:45:01 -1000 | [diff] [blame] | 64 | imageName: 'pyca/cryptography-runner-sid', |
Alex Gaynor | 4022637 | 2017-05-23 14:14:18 -0700 | [diff] [blame] | 65 | toxenvs: ['docs'], |
| 66 | artifacts: 'cryptography/docs/_build/html/**', |
| 67 | artifactExcludes: '**/*.doctree', |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 68 | ], |
| 69 | [ |
| 70 | label: 'docker', |
| 71 | imageName: 'pyca/cryptography-runner-fedora', |
Alex Gaynor | 2e64a3f | 2017-07-13 08:30:24 -0400 | [diff] [blame] | 72 | toxenvs: ['py27', 'py36'], |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 73 | ], |
Paul Kehrer | 8c0e731 | 2017-06-25 12:22:07 -1000 | [diff] [blame] | 74 | [ |
| 75 | label: 'docker', |
| 76 | imageName: 'pyca/cryptography-runner-alpine:latest', |
| 77 | toxenvs: ['py36'], |
| 78 | ], |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 79 | ] |
| 80 | |
| 81 | /* Add the linkcheck job to our config list if we're on master */ |
| 82 | if (env.BRANCH_NAME == "master") { |
| 83 | configs.add( |
| 84 | [ |
| 85 | label: 'docker', |
Alex Gaynor | 378a267 | 2018-08-30 18:04:57 -0400 | [diff] [blame^] | 86 | imageName: 'pyca/cryptography-runner-buster', |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 87 | toxenvs: ['docs-linkcheck'], |
| 88 | ] |
| 89 | ) |
| 90 | } |
| 91 | |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 92 | def checkout_git(label) { |
Alex Gaynor | 42b2571 | 2017-06-03 12:04:32 -0400 | [diff] [blame] | 93 | retry(3) { |
| 94 | def script = "" |
| 95 | if (env.BRANCH_NAME.startsWith('PR-')) { |
| 96 | script = """ |
| 97 | git clone --depth=1 https://github.com/pyca/cryptography |
| 98 | cd cryptography |
| 99 | git fetch origin +refs/pull/${env.CHANGE_ID}/merge: |
| 100 | git checkout -qf FETCH_HEAD |
Paul Kehrer | a119d2e | 2017-05-23 22:02:50 -0700 | [diff] [blame] | 101 | """ |
Alex Gaynor | 42b2571 | 2017-06-03 12:04:32 -0400 | [diff] [blame] | 102 | if (label.contains("windows")) { |
| 103 | bat script |
| 104 | } else { |
| 105 | sh """#!/bin/sh |
| 106 | set -xe |
| 107 | ${script} |
| 108 | """ |
| 109 | } |
| 110 | } else { |
| 111 | checkout([ |
| 112 | $class: 'GitSCM', |
| 113 | branches: [[name: "*/${env.BRANCH_NAME}"]], |
| 114 | doGenerateSubmoduleConfigurations: false, |
| 115 | extensions: [[ |
| 116 | $class: 'RelativeTargetDirectory', |
| 117 | relativeTargetDir: 'cryptography' |
| 118 | ]], |
| 119 | submoduleCfg: [], |
| 120 | userRemoteConfigs: [[ |
| 121 | 'url': 'https://github.com/pyca/cryptography' |
| 122 | ]] |
| 123 | ]) |
Paul Kehrer | a119d2e | 2017-05-23 22:02:50 -0700 | [diff] [blame] | 124 | } |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 125 | } |
| 126 | if (label.contains("windows")) { |
Paul Kehrer | a119d2e | 2017-05-23 22:02:50 -0700 | [diff] [blame] | 127 | bat """ |
| 128 | cd cryptography |
| 129 | git rev-parse HEAD |
| 130 | """ |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 131 | } else { |
Paul Kehrer | a119d2e | 2017-05-23 22:02:50 -0700 | [diff] [blame] | 132 | sh """ |
| 133 | cd cryptography |
| 134 | git rev-parse HEAD |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 135 | """ |
| 136 | } |
| 137 | } |
Alex Gaynor | 4022637 | 2017-05-23 14:14:18 -0700 | [diff] [blame] | 138 | def build(toxenv, label, imageName, artifacts, artifactExcludes) { |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 139 | try { |
| 140 | timeout(time: 30, unit: 'MINUTES') { |
| 141 | |
| 142 | checkout_git(label) |
Alex Gaynor | 2e85a92 | 2018-07-16 11:18:33 -0400 | [diff] [blame] | 143 | checkout([ |
| 144 | $class: 'GitSCM', |
| 145 | extensions: [[ |
| 146 | $class: 'RelativeTargetDirectory', |
| 147 | relativeTargetDir: 'wycheproof', |
| 148 | ]], |
| 149 | userRemoteConfigs: [[ |
| 150 | 'url': 'https://github.com/google/wycheproof', |
| 151 | ]] |
| 152 | ]) |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 153 | |
| 154 | withCredentials([string(credentialsId: 'cryptography-codecov-token', variable: 'CODECOV_TOKEN')]) { |
| 155 | withEnv(["LABEL=$label", "TOXENV=$toxenv", "IMAGE_NAME=$imageName"]) { |
| 156 | if (label.contains("windows")) { |
| 157 | def pythonPath = [ |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 158 | py27: "C:\\Python27\\python.exe", |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 159 | py34: "C:\\Python34\\python.exe", |
| 160 | py35: "C:\\Python35\\python.exe", |
Paul Kehrer | 4ee1cb9 | 2018-06-27 20:07:14 -0700 | [diff] [blame] | 161 | py36: "C:\\Python36\\python.exe", |
| 162 | py37: "C:\\Python37\\python.exe" |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 163 | ] |
Paul Kehrer | 4ee1cb9 | 2018-06-27 20:07:14 -0700 | [diff] [blame] | 164 | if (toxenv == "py35" || toxenv == "py36" || toxenv == "py37") { |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 165 | opensslPaths = [ |
| 166 | "windows": [ |
| 167 | "include": "C:\\OpenSSL-Win32-2015\\include", |
| 168 | "lib": "C:\\OpenSSL-Win32-2015\\lib" |
| 169 | ], |
| 170 | "windows64": [ |
| 171 | "include": "C:\\OpenSSL-Win64-2015\\include", |
| 172 | "lib": "C:\\OpenSSL-Win64-2015\\lib" |
| 173 | ] |
| 174 | ] |
| 175 | } else { |
| 176 | opensslPaths = [ |
| 177 | "windows": [ |
| 178 | "include": "C:\\OpenSSL-Win32-2010\\include", |
| 179 | "lib": "C:\\OpenSSL-Win32-2010\\lib" |
| 180 | ], |
| 181 | "windows64": [ |
| 182 | "include": "C:\\OpenSSL-Win64-2010\\include", |
| 183 | "lib": "C:\\OpenSSL-Win64-2010\\lib" |
| 184 | ] |
| 185 | ] |
| 186 | } |
| 187 | bat """ |
| 188 | cd cryptography |
| 189 | @set PATH="C:\\Python27";"C:\\Python27\\Scripts";%PATH% |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 190 | @set PYTHON="${pythonPath[toxenv]}" |
| 191 | |
| 192 | @set INCLUDE="${opensslPaths[label]['include']}";%INCLUDE% |
| 193 | @set LIB="${opensslPaths[label]['lib']}";%LIB% |
Alex Gaynor | 2e85a92 | 2018-07-16 11:18:33 -0400 | [diff] [blame] | 194 | tox -r -- --wycheproof-root=../wycheproof |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 195 | IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL% |
| 196 | virtualenv .codecov |
| 197 | call .codecov/Scripts/activate |
Paul Kehrer | e535985 | 2017-09-13 09:30:51 +0800 | [diff] [blame] | 198 | REM this pin must be kept in sync with tox.ini |
Paul Kehrer | cb17506 | 2017-06-03 08:26:56 -1000 | [diff] [blame] | 199 | pip install coverage==4.3.4 |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 200 | pip install codecov |
Paul Kehrer | 8396d43 | 2017-09-06 23:23:15 +0800 | [diff] [blame] | 201 | codecov -e JOB_BASE_NAME,LABEL,TOXENV |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 202 | """ |
| 203 | } else if (label.contains("sierra") || label.contains("yosemite")) { |
| 204 | ansiColor { |
| 205 | sh """#!/usr/bin/env bash |
| 206 | set -xe |
| 207 | # Jenkins logs in as a non-interactive shell, so we don't even have /usr/local/bin in PATH |
| 208 | export PATH="/usr/local/bin:\${PATH}" |
| 209 | export PATH="/Users/jenkins/.pyenv/shims:\${PATH}" |
| 210 | cd cryptography |
Paul Kehrer | adeaacf | 2017-05-24 12:49:18 -0700 | [diff] [blame] | 211 | CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS=1 \ |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 212 | LDFLAGS="/usr/local/opt/openssl\\@1.1/lib/libcrypto.a /usr/local/opt/openssl\\@1.1/lib/libssl.a" \ |
Paul Kehrer | b637aec | 2017-05-30 20:56:15 -0500 | [diff] [blame] | 213 | CFLAGS="-I/usr/local/opt/openssl\\@1.1/include -Werror -Wno-error=deprecated-declarations -Wno-error=incompatible-pointer-types -Wno-error=unused-function -Wno-error=unused-command-line-argument -mmacosx-version-min=10.9" \ |
Alex Gaynor | 2e85a92 | 2018-07-16 11:18:33 -0400 | [diff] [blame] | 214 | tox -r -- --color=yes --wycheproof-root=../wycheproof |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 215 | virtualenv .venv |
| 216 | source .venv/bin/activate |
Paul Kehrer | e535985 | 2017-09-13 09:30:51 +0800 | [diff] [blame] | 217 | # This pin must be kept in sync with tox.ini |
Paul Kehrer | cb17506 | 2017-06-03 08:26:56 -1000 | [diff] [blame] | 218 | pip install coverage==4.3.4 |
Paul Kehrer | 8396d43 | 2017-09-06 23:23:15 +0800 | [diff] [blame] | 219 | bash <(curl -s https://codecov.io/bash) -e JOB_BASE_NAME,LABEL,TOXENV |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 220 | """ |
| 221 | } |
| 222 | } else { |
| 223 | ansiColor { |
| 224 | sh """#!/usr/bin/env bash |
| 225 | set -xe |
| 226 | cd cryptography |
Alex Gaynor | 2e85a92 | 2018-07-16 11:18:33 -0400 | [diff] [blame] | 227 | tox -r -- --color=yes --wycheproof-root=../wycheproof |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 228 | virtualenv .venv |
| 229 | source .venv/bin/activate |
Paul Kehrer | e535985 | 2017-09-13 09:30:51 +0800 | [diff] [blame] | 230 | # This pin must be kept in sync with tox.ini |
Alex Gaynor | af3f9b8 | 2018-04-20 00:29:28 -0400 | [diff] [blame] | 231 | pip install coverage==4.3.4 |
Paul Kehrer | 8396d43 | 2017-09-06 23:23:15 +0800 | [diff] [blame] | 232 | bash <(curl -s https://codecov.io/bash) -e JOB_BASE_NAME,LABEL,TOXENV,IMAGE_NAME |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 233 | """ |
| 234 | } |
Alex Gaynor | 4022637 | 2017-05-23 14:14:18 -0700 | [diff] [blame] | 235 | if (artifacts) { |
| 236 | archiveArtifacts artifacts: artifacts, excludes: artifactExcludes |
| 237 | } |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 238 | } |
| 239 | } |
| 240 | } |
| 241 | } |
| 242 | } finally { |
| 243 | deleteDir() |
| 244 | } |
| 245 | |
| 246 | } |
| 247 | |
| 248 | def builders = [:] |
| 249 | for (config in configs) { |
| 250 | def label = config["label"] |
| 251 | def toxenvs = config["toxenvs"] |
Alex Gaynor | 4022637 | 2017-05-23 14:14:18 -0700 | [diff] [blame] | 252 | def artifacts = config["artifacts"] |
| 253 | def artifactExcludes = config["artifactExcludes"] |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 254 | |
| 255 | for (_toxenv in toxenvs) { |
| 256 | def toxenv = _toxenv |
| 257 | |
| 258 | if (label.contains("docker")) { |
| 259 | def imageName = config["imageName"] |
| 260 | def combinedName = "${imageName}-${toxenv}" |
| 261 | builders[combinedName] = { |
| 262 | node(label) { |
| 263 | stage(combinedName) { |
Paul Kehrer | c033c90 | 2017-07-07 13:20:29 -0500 | [diff] [blame] | 264 | def buildImage = docker.image(imageName) |
| 265 | buildImage.pull() |
| 266 | buildImage.inside { |
Alex Gaynor | 4022637 | 2017-05-23 14:14:18 -0700 | [diff] [blame] | 267 | build(toxenv, label, imageName, artifacts, artifactExcludes) |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 268 | } |
| 269 | } |
| 270 | } |
| 271 | } |
| 272 | } else { |
| 273 | def combinedName = "${label}-${toxenv}" |
| 274 | builders[combinedName] = { |
| 275 | node(label) { |
| 276 | stage(combinedName) { |
Alex Gaynor | 4022637 | 2017-05-23 14:14:18 -0700 | [diff] [blame] | 277 | build(toxenv, label, '', null, null) |
Paul Kehrer | ba58e1f | 2017-05-22 18:08:29 -0700 | [diff] [blame] | 278 | } |
| 279 | } |
| 280 | } |
| 281 | } |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | /* Add the python setup.py test builder */ |
| 286 | builders["setup.py-test"] = { |
| 287 | node("docker") { |
| 288 | stage("python setup.py test") { |
| 289 | docker.image("pyca/cryptography-runner-ubuntu-rolling").inside { |
| 290 | try { |
| 291 | checkout_git("docker") |
| 292 | sh """#!/usr/bin/env bash |
| 293 | set -xe |
| 294 | cd cryptography |
| 295 | virtualenv .venv |
| 296 | source .venv/bin/activate |
| 297 | python setup.py test |
| 298 | """ |
| 299 | } finally { |
| 300 | deleteDir() |
| 301 | } |
| 302 | |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | } |
| 307 | |
Paul Kehrer | 3d96afd | 2017-10-04 10:53:18 +0800 | [diff] [blame] | 308 | parallel builders |