From ac403434e892164897076551320148b6c98c672a Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 21 Oct 2020 06:41:09 +0200 Subject: [PATCH] Moving from travis-ci to GitHub workflows The main reason is that we need armv6 and armv7 images under qemu. --- .github/workflows/main.yml | 177 +++++++++++++++++++++++++++++++++++++ .travis.yml | 128 --------------------------- setup.py | 19 ++-- 3 files changed, 188 insertions(+), 136 deletions(-) create mode 100644 .github/workflows/main.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..782500ad --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,177 @@ +name: PyPi Upload + +on: + push: + branches: + - 'master' + - 'develop' + tags: + - 'v*' + pull_request: + branches: + - '*' + +jobs: + ubuntu20: + name: Ubuntu 20.04 x86_64 + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v1 + with: + submodules: recursive + + - name: Get tags + run: | + git fetch --tags + echo $? + git tag --list + + - name: Install patchelf + run: sudo apt-get install -y patchelf python3-pip + + - name: Install prerequisites + run: | + pip3 install -r requirements.txt -r requirements-dev.txt + pip3 install auditwheel + + - name: Create wheel + run: | + python3 setup.py bdist_wheel + mkdir wheelhouse + export PATH=$PATH:$HOME/.local/bin + auditwheel repair --plat manylinux2014_x86_64 dist/*.whl + + - name: Check the artifacts + run: | + ls -lh "wheelhouse/" + + - name: Upload to PyPi + if: startsWith(github.ref, 'refs/tags/') + run: | + TWINE_NON_INTERACTIVE=1 twine upload wheelhouse/*.whl + + ubuntu20-other: + name: Ubuntu 20.04 ${{ matrix.arch }} + runs-on: ubuntu-20.04 + + strategy: + matrix: + include: + - arch: armv6l + - arch: armv7l + - arch: aarch64 + + steps: + - uses: actions/checkout@v1 + with: + submodules: recursive + + - name: Get tags + run: | + git fetch --tags + echo $? + git tag --list + + - name: Install patchelf + run: sudo apt-get install -y patchelf python3-pip + + - name: Install prerequisites + run: | + pip3 install -r requirements.txt -r requirements-dev.txt + + - name: Create wheel + run: | + export MAVSDK_SERVER_ARCH=${{ matrix.arch }} + python3 setup.py bdist_wheel + ls dist/*any.whl | sed -e 'p;s/any/linux_${{ matrix.arch }}/' | xargs -n2 mv + + - name: Check the artifacts + run: | + ls -lh "dist/" + + - name: Upload to PyPi + if: startsWith(github.ref, 'refs/tags/') + run: | + TWINE_NON_INTERACTIVE=1 twine upload dist/*.whl + + macOS: + name: macOS + runs-on: macos-latest + steps: + - uses: actions/checkout@v1 + with: + submodules: recursive + + - name: Get tags + run: | + git fetch --tags + echo $? + git tag --list + + - name: Install prerequisites + run: | + pip3 install -r requirements.txt -r requirements-dev.txt + pip3 install delocate twine + + - name: Create wheel + run: | + python3 setup.py bdist_wheel + delocate-wheel -w wheelhouse -v dist/*.whl + ls wheelhouse/*any.whl | sed -e 'p;s/any/macosx_10_9_x86_64/' | xargs -n2 mv + + - name: Check the artifacts + run: | + ls -lh "wheelhouse/" + + - name: Upload to PyPi + if: startsWith(github.ref, 'refs/tags/') + run: | + TWINE_NON_INTERACTIVE=1 twine upload wheelhouse/*.whl + + Windows: + name: Windows (${{ matrix.arch }}) + runs-on: windows-latest + + strategy: + matrix: + include: + - arch: x86 + wheel_arch: win32 + - arch: x64 + wheel_arch: win_amd64 + + steps: + - uses: actions/checkout@v1 + with: + submodules: recursive + + - name: Get tags + run: | + git fetch --tags + echo $? + git tag --list + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.7 + architecture: ${{ matrix.arch }} + + - name: Install prerequisites + run: | + pip3 install -r requirements.txt -r requirements-dev.txt + pip3 install twine wheel + + - name: Create wheel + run: | + python setup.py bdist_wheel + Dir "dist/" | rename-item -NewName {$_.name -replace '-any.whl','-${{ matrix.wheel_arch }}.whl'} + + - name: Check the artifacts + run: | + ls "dist/" + + - name: Upload to PyPi + if: startsWith(github.ref, 'refs/tags/') + run: | + TWINE_NON_INTERACTIVE=1 twine upload dist/*.whl diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d5a653d7..00000000 --- a/.travis.yml +++ /dev/null @@ -1,128 +0,0 @@ -language: python -branches: - only: - - master - - "/^\\d+\\.\\d+\\.\\d+$/" -matrix: - fast_finish: true - include: - - os: linux - name: linux (pure wheel) - dist: bionic - python: - - 3.6 - - 3.7 - before_install: - python3 --version; - pip3 --version; - env: - - BUILD_TARGET=linux_pure_wheel - - PYTHON_BIN=python3 - - MAVSDK_BUILD_PURE=ON - addons: - apt: - packages: - - patchelf - - os: linux - name: Linux - dist: bionic - python: - - 3.6 - - 3.7 - before_install: - python3 --version; - pip3 --version; - env: - - BUILD_TARGET=linux - - PYTHON_BIN=python3 - addons: - apt: - packages: - - patchelf - - os: osx - name: macOS - osx_image: xcode11.2 - language: shell # python not working - before_install: - python3 --version; - pip3 --version; - env: - - BUILD_TARGET=macos - - PYTHON_BIN=python3 - - os: windows - language: shell # python not supported yet - name: windows64 - before_install: - choco install python3 --version=3.7.5; - python -m pip install --upgrade pip; - python --version; - pip3 --version; - env: - - BUILD_TARGET=windows64 - - PATH=/c/Python37:/c/Python37/Scripts:$PATH - - PYTHON_BIN=python - - os: windows - language: shell # python not supported yet - name: windows32 - before_install: - choco install python3 --forcex86 --version=3.7.5; - python -m pip install --upgrade pip; - python --version; - pip3 --version; - env: - - BUILD_TARGET=windows32 - - PATH=/c/Python37:/c/Python37/Scripts:$PATH - - PYTHON_BIN=python -install: -- set -e -- pip3 install -r requirements.txt -r requirements-dev.txt -- pip3 install auditwheel twine -- if [[ "${BUILD_TARGET}" = "linux" ]]; then - pip3 install sphinx numpydoc s3cmd; - fi -- if [[ "${BUILD_TARGET}" = "macos" ]]; then - pip3 install delocate; - fi -script: -- set -e -- $PYTHON_BIN setup.py bdist_wheel -- if [[ "${BUILD_TARGET}" = "linux_pure_wheel" ]]; then - mkdir wheelhouse; - mv dist/*.whl wheelhouse; - fi -- if [[ "${BUILD_TARGET}" = "linux" ]]; then - auditwheel repair --plat manylinux2010_x86_64 dist/*.whl; - make -C mavsdk html; - fi -- if [[ "${BUILD_TARGET}" = "macos" ]]; then - delocate-wheel -w wheelhouse -v dist/*.whl; - ls wheelhouse/*any.whl | sed -e 'p;s/any/macosx_10_9_x86_64/' | xargs -n2 mv; - fi -- if [[ "${BUILD_TARGET}" = "windows64" ]]; then - mkdir wheelhouse; - ls dist/*any.whl | sed -e 'p;s/any/win_amd64/' | xargs -n2 cp; - mv dist/*win_amd64.whl wheelhouse/; - fi -- if [[ "${BUILD_TARGET}" = "windows32" ]]; then - mkdir wheelhouse; - ls dist/*any.whl | sed -e 'p;s/any/win32/' | xargs -n2 cp; - mv dist/*win32.whl wheelhouse/; - fi -- if [[ ! -z "${TRAVIS_TAG}" ]]; then - echo "Deploying to PyPi"; - TWINE_NON_INTERACTIVE=1 twine upload wheelhouse/*.whl; - else - echo "Not deploying without git tag."; - fi -- if [[ "${BUILD_TARGET}" = "linux" ]] && [[ ! -z "${TRAVIS_TAG}" ]]; then - echo "Uploading docs"; - other/tools/upload_docs.sh; - else - echo "Not uploading docs without git tag."; - fi -env: - global: - - secure: cpJLKiOqUTYB1ozkVus4SlPBP/XJ1uUxfMKos+XLWxEVOTguLIW+bKhLfquY9+PlY2rajl5jxxzrX5RZOgZR0fbHHh9FAzioWhzEEUQb76IKnDD7St8J6Pq65bO1Vk8o0sdtQ+ht8+RK54TJL6d8jxVh4RNV3txBB6wFzkFcw5WTDxgWr/+HsYfC9IQkIXGf8NJmvdCUBunL2xDULZ3rlPzEG/YmXjR79g51juNWvZjDKFjLmpHe/qN8VSws1QrI7tKtTtNrNutlAVnOWSlcnJspzex0WfG4EINyjJH7WQZppLiax55jWSBAzxee3/7jXyDVDOJBPl8JT/GyqoQL/qHDmiJuHm53Ktpgg0saGlcSuYuA643PVVJ2Q1SerTtboukJIfNi08GykSPLIbT6PHqhB7NzaA+rWXWgTIoMUyPQ38M+/2lpVqNc6fwAClAbYrJKxyiH7g6GLShV5/UOqDWK18OGGYnpWs+X2eFPXFXLVfZ540VvqlZimwMd6PZuB6RpgKBcBPH1FMac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6b65XSa5BsJq5TBnYmB8XGeOBQ7TEGmN7qu67/ncAmY0lLd7/ZdD5Ak=" diff --git a/setup.py b/setup.py index 9228e05a..9e7bfc15 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,6 @@ import urllib.request import os -import platform import stat import sys import subprocess @@ -53,14 +52,18 @@ def platform_suffix(self): """ Trying to detect the platform to know which `mavsdk_server` executable to download """ - if sys.platform.startswith('linux') and platform.machine() == "x86_64": + if sys.platform.startswith('linux') and 'MAVSDK_SERVER_ARCH' in os.environ: + if os.environ['MAVSDK_SERVER_ARCH'] == "armv6l": + return 'musl_armv6' + elif os.environ['MAVSDK_SERVER_ARCH'] == "armv7l": + return 'musl_armv7' + elif os.environ['MAVSDK_SERVER_ARCH'] == "aarch64": + return 'musl_aarch64' + else: + raise NotImplementedError( + f"Error: unknown MAVSDK_SERVER_ARCH: {os.environ['MAVSDK_SERVER_ARCH']}") + elif sys.platform.startswith('linux'): return 'musl_x86_64' - elif sys.platform.startswith('linux') and platform.machine() == "armv6l": - return 'musl_armv6' - elif sys.platform.startswith('linux') and platform.machine() == "armv7l": - return 'musl_armv7' - elif sys.platform.startswith('linux') and platform.machine() == "aarch64": - return 'musl_aarch64' elif sys.platform.startswith('darwin'): return 'macos' elif sys.platform.startswith('win'):