diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2019-05-26 18:38:37 -0400 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2019-05-26 18:38:37 -0400 |
commit | 61e833684fecb405357fdd67088431a958579b7b (patch) | |
tree | d632192c80461b93ef020916ae46f21962697c44 | |
parent | 8ce4bfaddff295e4ba2d4902a681da572f01f757 (diff) | |
download | py-bcrypt-git-61e833684fecb405357fdd67088431a958579b7b.tar.gz |
add azure pipelines wheel builder for bcrypt (#177)
* add azure pipelines wheel builder for bcrypt
* fix manifest, remove jenkins
-rw-r--r-- | .azure-pipelines/wheel-builder.yml | 160 | ||||
-rw-r--r-- | .jenkins/Jenkinsfile-wheel-builder | 179 | ||||
-rw-r--r-- | MANIFEST.in | 8 |
3 files changed, 163 insertions, 184 deletions
diff --git a/.azure-pipelines/wheel-builder.yml b/.azure-pipelines/wheel-builder.yml new file mode 100644 index 0000000..8118c51 --- /dev/null +++ b/.azure-pipelines/wheel-builder.yml @@ -0,0 +1,160 @@ +trigger: none +pr: none + +jobs: + - job: 'macOS' + pool: + vmImage: 'macOS-10.14' + strategy: + matrix: + Python27: + python.version: '2.7' + PYTHON_DOWNLOAD_URL: "https://www.python.org/ftp/python/2.7.16/python-2.7.16-macosx10.6.pkg" + PYTHON_BIN_PATH: /Library/Frameworks/Python.framework/Versions/2.7/bin/python + Python3: + python.version: '3.4' + PYTHON_DOWNLOAD_URL: "https://www.python.org/ftp/python/3.7.3/python-3.7.3-macosx10.6.pkg" + PYTHON_BIN_PATH: /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 + steps: + - script: | + set -e + set -x + + curl "$PYTHON_DOWNLOAD_URL" -o python.pkg + sudo installer -pkg python.pkg -target / + displayName: Download and install Python + + - script: $PYTHON_BIN_PATH -m pip install -U virtualenv + displayName: Install virtualenv + - script: $PYTHON_BIN_PATH -m virtualenv .venv + displayName: Create virtualenv + - script: .venv/bin/pip install -U wheel + displayName: Update wheel to the latest version + - script: .venv/bin/pip install cffi six + displayName: Install our Python dependencies + + - script: | + set -e + set -x + + REGEX="3\.([0-9])*" + if [[ "$PYTHON_VERSION" =~ $REGEX ]]; then + PY_LIMITED_API="--build-option --py-limited-api=cp3${BASH_REMATCH[1]}" + fi + + .venv/bin/pip wheel bcrypt --no-use-pep517 --wheel-dir=wheelhouse --no-binary bcrypt --no-deps $PY_LIMITED_API + displayName: Build the wheel + - script: .venv/bin/pip install --no-index -f wheelhouse bcrypt + displayName: Test installing the wheel + - script: | + .venv/bin/python -c "import bcrypt;password = b'super secret password';hashed = bcrypt.hashpw(password, bcrypt.gensalt());bcrypt.checkpw(password, hashed)" + displayName: Test the installed wheel + - task: PublishBuildArtifacts@1 + inputs: + pathToPublish: wheelhouse/ + artifactName: bcrypt-macos-python$(python.version) + + - job: 'manylinux1' + pool: + vmImage: 'ubuntu-16.04' + container: 'pyca/cryptography-manylinux1:x86_64' + strategy: + matrix: + Python27m: + PYTHON_VERSION: 'cp27-cp27m' + Python27mu: + PYTHON_VERSION: 'cp27-cp27mu' + Python3m: + PYTHON_VERSION: 'cp34-cp34m' + steps: + - script: /opt/python/$PYTHON_VERSION/bin/python -m virtualenv .venv + displayName: Create virtualenv + - script: .venv/bin/pip install cffi six + displayName: Install our Python dependencies + - script: | + set -e + set -x + + REGEX="cp3([0-9])*" + if [[ "$PYTHON_VERSION" =~ $REGEX ]]; then + PY_LIMITED_API="--build-option --py-limited-api=cp3${BASH_REMATCH[1]}" + fi + .venv/bin/pip wheel bcrypt --no-use-pep517 --no-binary bcrypt --no-deps --wheel-dir=tmpwheelhouse $PY_LIMITED_API + displayName: Build the wheel + - script: auditwheel repair tmpwheelhouse/bcrypt*.whl -w wheelhouse/ + displayName: Run auditwheel + - script: .venv/bin/pip install bcrypt --no-index -f wheelhouse/ + displayName: Test installing the wheel + - script: | + .venv/bin/python -c "import bcrypt;password = b'super secret password';hashed = bcrypt.hashpw(password, bcrypt.gensalt());bcrypt.checkpw(password, hashed)" + displayName: Test the installed wheel + - task: PublishBuildArtifacts@1 + inputs: + pathToPublish: wheelhouse/ + artifactName: bcrypt-manylinux1-$(PYTHON_VERSION) + + - job: 'windows' + pool: + vmImage: 'windows-2019' + container: $[variables.containerImage] + strategy: + matrix: + Python27-x86: + containerImage: 'pyca/cryptography-runner-windows:py27-x86' + PYTHON_VERSION: '27' + WINDOWS_ARCH: 'x86' + Python27-x86-64: + containerImage: 'pyca/cryptography-runner-windows:py27-x86_64' + PYTHON_VERSION: '27' + WINDOWS_ARCH: 'x86_64' + Python34-x86: + containerImage: 'pyca/cryptography-runner-windows:py34-x86' + PYTHON_VERSION: '34' + WINDOWS_ARCH: 'x86' + Python34-x86-64: + containerImage: 'pyca/cryptography-runner-windows:py34-x86_64' + PYTHON_VERSION: '34' + WINDOWS_ARCH: 'x86_64' + Python35-x86: + containerImage: 'pyca/cryptography-runner-windows:py35-x86' + PYTHON_VERSION: '35' + WINDOWS_ARCH: 'x86' + Python35-x86-64: + containerImage: 'pyca/cryptography-runner-windows:py35-x86_64' + PYTHON_VERSION: '35' + WINDOWS_ARCH: 'x86_64' + Python36-x86: + containerImage: 'pyca/cryptography-runner-windows:py3-x86' + PYTHON_VERSION: '36' + WINDOWS_ARCH: 'x86' + Python36-x86-64: + containerImage: 'pyca/cryptography-runner-windows:py3-x86_64' + PYTHON_VERSION: '36' + WINDOWS_ARCH: 'x86_64' + Python37-x86: + containerImage: 'pyca/cryptography-runner-windows:py3-x86' + PYTHON_VERSION: '37' + WINDOWS_ARCH: 'x86' + Python37-x86-64: + containerImage: 'pyca/cryptography-runner-windows:py3-x86_64' + PYTHON_VERSION: '37' + WINDOWS_ARCH: 'x86_64' + steps: + - script: '"C:/Python%PYTHON_VERSION%/Scripts/pip" install wheel cffi six' + displayName: Install wheel and our Python dependencies + - script: | + C:/Python%PYTHON_VERSION%/Scripts/pip wheel bcrypt --no-use-pep517 --wheel-dir=wheelhouse --no-binary bcrypt + displayName: Build the wheel + - script: '"C:/Python%PYTHON_VERSION%/Scripts/pip" install -f wheelhouse bcrypt --no-index' + displayName: Test installing the wheel + - script: | + "C:/Python%PYTHON_VERSION%/python" -c "import bcrypt;password = b'super secret password';hashed = bcrypt.hashpw(password, bcrypt.gensalt());bcrypt.checkpw(password, hashed)" + displayName: Test the installed wheel + - script: mkdir bcrypt-wheelhouse + displayName: Create a directory for placing the final wheel in + - script: move wheelhouse\bcrypt*.whl bcrypt-wheelhouse\ + displayName: Move the bcrypt wheel into the final wheel house + - task: PublishBuildArtifacts@1 + inputs: + pathToPublish: bcrypt-wheelhouse/ + artifactName: bcrypt-windows-$(WINDOWS_ARCH)-python$(PYTHON_VERSION) diff --git a/.jenkins/Jenkinsfile-wheel-builder b/.jenkins/Jenkinsfile-wheel-builder deleted file mode 100644 index ab628df..0000000 --- a/.jenkins/Jenkinsfile-wheel-builder +++ /dev/null @@ -1,179 +0,0 @@ -def configs = [ - [ - label: 'windows', - versions: ['py27', 'py34', 'py35', 'py36', 'py37'], - ], - [ - label: 'windows64', - versions: ['py27', 'py34', 'py35', 'py36', 'py37'], - ], - [ - label: 'sierra', - versions: ['py27', 'py34'], - ], - [ - label: 'docker', - imageName: 'quay.io/pypa/manylinux1_x86_64', - versions: [ - 'cp27-cp27m', 'cp27-cp27mu', 'cp34-cp34m', - ], - ], - [ - label: 'docker', - imageName: 'quay.io/pypa/manylinux1_i686', - versions: [ - 'cp27-cp27m', 'cp27-cp27mu', 'cp34-cp34m', - ], - ], -] - - -def build(version, label, imageName) { - try { - timeout(time: 30, unit: 'MINUTES') { - if (label.contains("windows")) { - def pythonPath = [ - py27: "C:\\Python27\\python.exe", - py34: "C:\\Python34\\python.exe", - py35: "C:\\Python35\\python.exe", - py36: "C:\\Python36\\python.exe", - py37: "C:\\Python37\\python.exe" - ] - bat """ - wmic qfe - @set PATH="C:\\Python27";"C:\\Python27\\Scripts";%PATH% - @set PYTHON="${pythonPath[version]}" - - virtualenv -p %PYTHON% .release - call .release\\Scripts\\activate - pip install wheel virtualenv - pip wheel bcrypt --wheel-dir=wheelhouse --no-binary bcrypt - pip install -f wheelhouse bcrypt --no-index - python -c "import bcrypt;password = b'super secret password';hashed = bcrypt.hashpw(password, bcrypt.gensalt());bcrypt.checkpw(password, hashed)" - """ - } else if (label.contains("sierra")) { - def pythonPath = [ - py27: "/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7", - py34: "/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4", - ] - ansiColor { - sh """#!/usr/bin/env bash - set -xe - # output the list of things we've installed as a point in time check of how up - # to date the builder is - /usr/sbin/system_profiler SPInstallHistoryDataType - - # Jenkins logs in as a non-interactive shell, so we don't even have /usr/local/bin in PATH - export PATH="/usr/local/bin:\${PATH}" - export PATH="/Users/jenkins/.pyenv/shims:\${PATH}" - - printenv - - virtualenv .venv -p ${pythonPath[version]} - source .venv/bin/activate - pip install -U wheel # upgrade wheel to latest before we use it to build the wheel - pip install cffi six # install this with pip so we get TLS 1.2 - REGEX="py3([0-9])*" - if [[ "${version}" =~ \$REGEX ]]; then - PY_LIMITED_API="--build-option --py-limited-api=cp3\${BASH_REMATCH[1]}" - fi - pip wheel bcrypt --no-binary bcrypt --no-deps --wheel-dir=wheelhouse \$PY_LIMITED_API - pip install -f wheelhouse bcrypt --no-index - python -c "import bcrypt;password = b'super secret password';hashed = bcrypt.hashpw(password, bcrypt.gensalt());bcrypt.checkpw(password, hashed)" - """ - } - } else if (label.contains("docker")) { - linux32 = "" - if (imageName.contains("i686")) { - linux32 = "linux32" - } - sh """#!/usr/bin/env bash - set -x -e - LIBFFI_SHA256="d06ebb8e1d9a22d19e38d63fdb83954253f39bedc5d46232a05645685722ca37" - LIBFFI_VERSION="3.2.1" - - function check_sha256sum { - local fname=\$1 - local sha256=\$2 - echo "\${sha256} \${fname}" > \${fname}.sha256 - sha256sum -c \${fname}.sha256 - } - # Because we are doing this as root in the container, but we write to a mounted dir that is outside the container - # we need to make sure we set these files writable such that the jenkins user can delete them afterwards - mkdir -p tmpwheelhouse - mkdir -p wheelhouse - chmod -R 777 tmpwheelhouse - chmod -R 777 wheelhouse - - # We need libffi because pip wheel won't use wheels at all - curl -#O https://mirrors.ocf.berkeley.edu/debian/pool/main/libf/libffi/libffi_\${LIBFFI_VERSION}.orig.tar.gz - check_sha256sum libffi_\${LIBFFI_VERSION}.orig.tar.gz \${LIBFFI_SHA256} - tar zxf libffi_\${LIBFFI_VERSION}.orig.tar.gz - # More root use permission nonsense - chmod -R 777 libffi* - pushd libffi-\${LIBFFI_VERSION} - # CFLAGS needed to override the Makefile and prevent -march optimization - # This flag set taken from Ubuntu 14.04's defaults. We should update it - # to use -fstack-protector-strong if/when gcc 4.9+ is added to the - # manylinux1 images. - $linux32 ./configure CFLAGS="-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security" - $linux32 make install - popd - # More root use permission nonsense - chmod -R 777 libffi* - - $linux32 /opt/python/$version/bin/pip install cffi six - REGEX="cp3([0-9])*" - if [[ "${version}" =~ \$REGEX ]]; then - PY_LIMITED_API="--build-option --py-limited-api=cp3\${BASH_REMATCH[1]}" - fi - $linux32 /opt/python/$version/bin/pip wheel bcrypt --no-binary bcrypt --no-deps --wheel-dir=tmpwheelhouse \$PY_LIMITED_API - $linux32 auditwheel repair tmpwheelhouse/bcrypt*.whl -w wheelhouse/ - $linux32 /opt/python/$version/bin/pip install bcrypt --no-index -f wheelhouse/ - $linux32 /opt/python/$version/bin/python -c "import bcrypt;password = b'super secret password';hashed = bcrypt.hashpw(password, bcrypt.gensalt());bcrypt.checkpw(password, hashed)" - """ - } - archiveArtifacts artifacts: "**/wheelhouse/bcrypt*.whl" - } - } finally { - deleteDir() - } - -} - -def builders = [:] -for (config in configs) { - def label = config["label"] - def versions = config["versions"] - - for (_version in versions) { - def version = _version - - if (label.contains("docker")) { - def imageName = config["imageName"] - def combinedName = "${imageName}-${version}" - builders[combinedName] = { - node(label) { - stage(combinedName) { - def buildImage = docker.image(imageName) - buildImage.pull() - buildImage.inside("-u root") { - build(version, label, imageName) - } - } - } - } - } else { - def combinedName = "${label}-${version}" - builders[combinedName] = { - node(label) { - stage(combinedName) { - build(version, label, "") - } - } - } - } - } -} - -parallel builders diff --git a/MANIFEST.in b/MANIFEST.in index 4c5553d..14dd0bf 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -8,11 +8,9 @@ include src/build_bcrypt.py recursive-include src/_csrc * recursive-include tests *.py -exclude requirements.txt tasks.py .travis.yml wheel-scripts Jenkinsfile azure-pipelines.yml +exclude requirements.txt tasks.py .travis.yml azure-pipelines.yml -exclude .jenkins -recursive-exclude .jenkins * - -recursive-exclude wheel-scripts * +exclude .azure-pipelines +recursive-exclude .azure-pipelines * prune .travis |