circleci support for linux arm64 (#284)

This commit is contained in:
Paul Kehrer 2022-01-05 15:18:14 -06:00 committed by GitHub
parent d9c9892dad
commit 871e21914d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 133 additions and 2 deletions

33
.circleci/build-wheel.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash -ex
cd /test
echo "Building for ${PLATFORM}"
PYBIN="/opt/python/${PYTHON}/bin"
mkdir -p /test/wheelhouse.final
"${PYBIN}"/python -m venv .venv
.venv/bin/pip install -U pip wheel cffi
.venv/bin/python setup.py sdist
cd dist
tar zxf bcrypt*.tar.gz
rm -rf bcrypt*.tar.gz
cd bcrypt*
REGEX="cp3([0-9])*"
if [[ "${PYBIN}" =~ $REGEX ]]; then
PY_LIMITED_API="--py-limited-api=cp3${BASH_REMATCH[1]}"
fi
../../.venv/bin/python setup.py bdist_wheel "$PY_LIMITED_API"
auditwheel repair --plat "${PLATFORM}" -w wheelhouse/ dist/bcrypt*.whl
../../.venv/bin/pip install bcrypt --no-index -f wheelhouse/
../../.venv/bin/python -c "import bcrypt; password = b'super secret password';hashed = bcrypt.hashpw(password, bcrypt.gensalt());bcrypt.checkpw(password, hashed)"
mv wheelhouse/* /test/wheelhouse.final

97
.circleci/config.yml Normal file
View File

@ -0,0 +1,97 @@
version: 2.1
commands:
docker-pull:
parameters:
image:
type: string
steps:
- run: docker pull <<parameters.image>>
docker-run:
parameters:
image:
type: string
command:
type: string
steps:
- run: docker run -e PLATFORM -e PYTHON -v $(pwd):/test <<parameters.image>> /bin/bash -c 'cd /test;<<parameters.command>>'
jobs:
linux-arm64:
machine:
image: ubuntu-2004:202111-01
resource_class: arm.medium
parameters:
image:
type: string
toxenv:
type: string
steps:
- checkout
- docker-pull:
image: <<parameters.image>>
- docker-run:
image: <<parameters.image>>
command: tox -e <<parameters.toxenv>>
linux-arm64-wheel:
machine:
image: ubuntu-2004:202111-01
resource_class: arm.medium
parameters:
image:
type: string
platform:
type: string
python:
type: string
environment:
PLATFORM: <<parameters.platform>>
PYTHON: <<parameters.python>>
steps:
- checkout
- docker-pull:
image: <<parameters.image>>
- docker-run:
image: <<parameters.image>>
command: /test/.circleci/build-wheel.sh
- store_artifacts:
path: wheelhouse.final
workflows:
ci:
jobs:
- linux-arm64:
# Changing this name should only be done in conjunction with updating
# the required checks on GH
name: linux-arm64-ci
image: ghcr.io/pyca/cryptography-runner-ubuntu-focal:aarch64
toxenv: py38
# This makes sure it runs on all tags in addition to PRs/branches.
# By default CircleCI ignores tags.
filters:
tags:
only: /.*/
- linux-arm64-wheel:
name: manylinux2014_aarch64-wheel
image: ghcr.io/pyca/cryptography-manylinux2014_aarch64:latest
python: cp36-cp36m
platform: manylinux2014_aarch64
filters:
tags:
only: /.*/
- linux-arm64-wheel:
name: manylinux_2_24_aarch64-wheel
image: ghcr.io/pyca/cryptography-manylinux_2_24:aarch64
python: cp36-cp36m
platform: manylinux_2_24_aarch64
filters:
tags:
only: /.*/
- linux-arm64-wheel:
name: musllinux_1_1_aarch64-wheel
image: ghcr.io/pyca/cryptography-musllinux_1_1:aarch64
python: cp36-cp36m
platform: musllinux_1_1_aarch64
filters:
tags:
only: /.*/

View File

@ -8,6 +8,7 @@ include src/build_bcrypt.py
recursive-include src/_csrc *
recursive-include tests *.py
exclude requirements.txt release.py .travis.yml mypy.ini
exclude requirements.txt release.py mypy.ini
prune .travis
recursive-exclude .github *
recursive-exclude .circleci *