Skip to content

Commit

Permalink
Moving from travis-ci to GitHub workflows
Browse files Browse the repository at this point in the history
The main reason is that we need armv6 and armv7 images under qemu.
  • Loading branch information
julianoes committed Oct 21, 2020
1 parent a19f28c commit ac40343
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 136 deletions.
177 changes: 177 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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
128 changes: 0 additions & 128 deletions .travis.yml

This file was deleted.

19 changes: 11 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import urllib.request
import os
import platform
import stat
import sys
import subprocess
Expand Down Expand Up @@ -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'):
Expand Down

0 comments on commit ac40343

Please sign in to comment.