From 406ff8d6c7998eac47c8adb067e1ef24fd174752 Mon Sep 17 00:00:00 2001 From: odidev Date: Tue, 15 Mar 2022 03:15:00 -0400 Subject: [PATCH] Linux AArch64 builds --- .appveyor.yml | 2 +- .circleci/config.yml | 29 +++++++++----- ci/appveyor/fix_version.py | 5 ++- ci/build-manylinux.sh | 21 +++++++--- ci/docker/manylinux/Dockerfile.2014_x86_64 | 33 ++++++++++++++++ ci/docker/manylinux/Dockerfile.aarch64 | 34 ++++++++++++++++ ci/osx-wheel.sh | 2 +- ci/pyenv-wheel.sh | 45 ---------------------- 8 files changed, 109 insertions(+), 62 deletions(-) create mode 100644 ci/docker/manylinux/Dockerfile.2014_x86_64 create mode 100644 ci/docker/manylinux/Dockerfile.aarch64 delete mode 100755 ci/pyenv-wheel.sh diff --git a/.appveyor.yml b/.appveyor.yml index fc77fc68..e9603517 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -17,7 +17,7 @@ environment: PYTHON_DEF: "C:\\Python38-x64" PYTHON_VERSION: "3.8" # Python versions to build wheels for - PYTHONVERS: C:\Python36-x64 C:\Python37-x64 C:\Python38-x64 C:\Python39-x64 + PYTHONVERS: C:\Python36-x64 C:\Python37-x64 C:\Python38-x64 C:\Python39-x64 C:\Python310-x64 PYTHON_ARCH: "64" install: diff --git a/.circleci/config.yml b/.circleci/config.yml index c9173950..b79c882c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -72,10 +72,10 @@ jobs: command: | twine upload --skip-existing -u $PYPI_USER -p $PYPI_PASSWORD wheels/* - manylinux: + manylinux-x86_64: machine: image: ubuntu-1604:201903-01 - steps: + steps: &manylinux-steps - checkout - run: name: sdist @@ -93,7 +93,8 @@ jobs: - run: name: Deps command: | - sudo apt-get install python-pip + sudo apt-get install python3-pip + pyenv global 3.7.0 || pyenv global 3.9.1 pip install -U pip pip install twine which twine @@ -112,6 +113,12 @@ jobs: command: | twine upload --skip-existing -u $PYPI_USER -p $PYPI_PASSWORD dist/* wheelhouse/* + manylinux2014-aarch64: + machine: + image: ubuntu-2004:202101-01 + resource_class: arm.medium + steps: *manylinux-steps + workflows: version: 2.1 main: @@ -126,17 +133,21 @@ workflows: filters: tags: ignore: /.*/ - - manylinux: + - manylinux-x86_64: &manylinux-wf context: Docker - filters: - tags: - only: /.*/ - branches: - ignore: /.*/ +# filters: +# tags: +# only: /.*/ +# branches: +# ignore: /.*/ + - manylinux2014-aarch64: *manylinux-wf - osx: matrix: parameters: xcode_ver: + - "13.1.0" + - "13.0.0" + - "12.5.1" - "11.6.0" - "11.1.0" context: Docker diff --git a/ci/appveyor/fix_version.py b/ci/appveyor/fix_version.py index 582af74a..1d5b2caa 100644 --- a/ci/appveyor/fix_version.py +++ b/ci/appveyor/fix_version.py @@ -5,7 +5,10 @@ import sys def get_describe_tag(): - return subprocess.check_output(['git', 'describe', '--tags']).strip().decode('utf-8') + tag = subprocess.check_output(['git', 'describe', '--tags']).strip().decode('utf-8') + tag = "+".join(tag.rsplit("-", 1)) + return tag + def make_version_file(basedir): rev = os.environ.get('APPVEYOR_REPO_COMMIT', diff --git a/ci/build-manylinux.sh b/ci/build-manylinux.sh index ef2a36cf..ae000245 100755 --- a/ci/build-manylinux.sh +++ b/ci/build-manylinux.sh @@ -1,12 +1,23 @@ #!/bin/bash -xe docker_tag="parallelssh/ssh-manylinux" +docker_files=("ci/docker/manylinux/Dockerfile" "ci/docker/manylinux/Dockerfile.2014_x86_64") rm -rf local build ssh/libssh.* ssh/*.so python ci/appveyor/fix_version.py . -docker pull $docker_tag || echo -docker build --pull --cache-from $docker_tag ci/docker/manylinux -t $docker_tag -if [[ -z "$CIRCLE_PR_NUMBER" ]]; then docker push $docker_tag; fi -docker run --rm -v `pwd`:/io $docker_tag /io/ci/build-wheels.sh -ls wheelhouse/ +if [[ `uname -m` == "aarch64" ]]; then + docker_tag=${docker_tag}:aarch64 + docker_files=("ci/docker/manylinux/Dockerfile.aarch64") +fi + +for docker_file in ${docker_files[@]}; do + if [[ ${docker_file} == "ci/docker/manylinux/Dockerfile_2014_x86_64" ]]; then + docker_tag = "${docker_tag}:2014_x86_64" + fi + docker pull $docker_tag || echo + docker build --pull --cache-from $docker_tag ci/docker/manylinux -t $docker_tag -f ${docker_file} + if [[ -z "$CIRCLE_PR_NUMBER" ]]; then docker push $docker_tag; fi + docker run --rm -v `pwd`:/io $docker_tag /io/ci/build-wheels.sh + ls wheelhouse/ +done diff --git a/ci/docker/manylinux/Dockerfile.2014_x86_64 b/ci/docker/manylinux/Dockerfile.2014_x86_64 new file mode 100644 index 00000000..b9f09dea --- /dev/null +++ b/ci/docker/manylinux/Dockerfile.2014_x86_64 @@ -0,0 +1,33 @@ +FROM quay.io/pypa/manylinux2014_x86_64 + +ENV OPENSSL openssl-1.1.1g +ENV LIBSSH 0.9.5 +ENV SYSTEM_LIBSSH 1 + +RUN yum install zlib-devel cmake3 -y + +ADD libssh-${LIBSSH}.tar.xz libssh.tar.xz +ADD https://www.openssl.org/source/${OPENSSL}.tar.gz ${OPENSSL}.tar.gz +ADD krb5-1.18.2.tar.xz krb5-1.18.2.tar.xz + +RUN tar -xzf ${OPENSSL}.tar.gz +# Openssl +RUN cd ${OPENSSL} && \ + ./config --prefix=/usr --openssldir=/usr/openssl threads shared && \ + make -j6 && make install + +# Kerberos +RUN cd krb5-1.18.2.tar.xz/krb5-1.18.2/src && \ + ./configure && \ + make -j6 && \ + make install + +# Libssh +RUN mkdir -p build_libssh && cd build_libssh && \ + cmake3 ../libssh.tar.xz/libssh-${LIBSSH} -DCMAKE_BUILD_TYPE=Release \ + -DWITH_GSS_API=ON && \ + make -j6 install + +RUN rm -rf ${OPENSSL}* libssh build_libssh krb5-1.18.2.tar.xz + +VOLUME /var/cache diff --git a/ci/docker/manylinux/Dockerfile.aarch64 b/ci/docker/manylinux/Dockerfile.aarch64 new file mode 100644 index 00000000..40fb19d4 --- /dev/null +++ b/ci/docker/manylinux/Dockerfile.aarch64 @@ -0,0 +1,34 @@ +FROM quay.io/pypa/manylinux2014_aarch64 + +ENV OPENSSL openssl-1.1.1g +ENV LIBSSH 0.9.5 +ENV SYSTEM_LIBSSH 1 + +RUN yum install epel-release -y +RUN yum install zlib-devel cmake3 -y + +ADD libssh-${LIBSSH}.tar.xz libssh.tar.xz +ADD https://www.openssl.org/source/${OPENSSL}.tar.gz ${OPENSSL}.tar.gz +ADD krb5-1.18.2.tar.xz krb5-1.18.2.tar.xz + +RUN tar -xzf ${OPENSSL}.tar.gz +# Openssl +RUN cd ${OPENSSL} && \ + ./config --prefix=/usr --openssldir=/usr/openssl threads shared && \ + make -j6 && make install + +# Kerberos +RUN cd krb5-1.18.2.tar.xz/krb5-1.18.2/src && \ + ./configure && \ + make -j6 && \ + make install + +# Libssh +RUN mkdir -p build_libssh && cd build_libssh && \ + cmake3 ../libssh.tar.xz/libssh-${LIBSSH} -DCMAKE_BUILD_TYPE=Release \ + -DWITH_GSS_API=ON && \ + make -j6 install + +RUN rm -rf ${OPENSSL}* libssh build_libssh krb5-1.18.2.tar.xz + +VOLUME /var/cache diff --git a/ci/osx-wheel.sh b/ci/osx-wheel.sh index 537754e4..1135c2cf 100755 --- a/ci/osx-wheel.sh +++ b/ci/osx-wheel.sh @@ -20,7 +20,7 @@ ls -l wheels/*.whl rm -f /usr/local/lib/libssh* pip3 install -v wheels/*.whl pwd; mkdir -p temp; cd temp; pwd -python3 -c "from ssh.session import Session; Session()" && echo "Import successfull" +python3 -c "from ssh.session import Session; Session()" && echo "Import successful" cd ..; pwd set +x deactivate diff --git a/ci/pyenv-wheel.sh b/ci/pyenv-wheel.sh deleted file mode 100755 index 47ba5024..00000000 --- a/ci/pyenv-wheel.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -xe - -brew install pyenv || brew outdated pyenv || brew upgrade pyenv -pyenv install --list - -export PYENV_VERSION=${PYENV:-3.6.4} -if [[ ! -d "$HOME/.pyenv/versions/$PYENV_VERSION" ]]; then - pyenv install $PYENV_VERSION -fi -pyenv global $PYENV_VERSION -pyenv versions - -set +x -eval "$(pyenv init -)" -set -x - -which python -python -m pip install -U virtualenv -python -m virtualenv -p "$(which python)" venv - -set +x -source venv/bin/activate -set -x - -python -V -python -m pip install -U setuptools pip -pip install -U delocate wheel -pip wheel . -cp /usr/local/lib/libssh* . -delocate-listdeps --all *.whl -delocate-wheel -v *.whl -delocate-listdeps --all *.whl - -ls -l *.whl -rm -f *.dylib -pip install -v *.whl -pwd; mkdir -p temp; cd temp; pwd -python -c "from ssh.session import Session; Session()" && echo "Import successfull" -cd ..; pwd -set +x -deactivate -set -x - -mv -f *.whl wheels/ -ls -lh wheels