Skip to content

Commit ac40343

Browse files
committed
Moving from travis-ci to GitHub workflows
The main reason is that we need armv6 and armv7 images under qemu.
1 parent a19f28c commit ac40343

File tree

3 files changed

+188
-136
lines changed

3 files changed

+188
-136
lines changed

.github/workflows/main.yml

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
name: PyPi Upload
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
- 'develop'
8+
tags:
9+
- 'v*'
10+
pull_request:
11+
branches:
12+
- '*'
13+
14+
jobs:
15+
ubuntu20:
16+
name: Ubuntu 20.04 x86_64
17+
runs-on: ubuntu-20.04
18+
steps:
19+
- uses: actions/checkout@v1
20+
with:
21+
submodules: recursive
22+
23+
- name: Get tags
24+
run: |
25+
git fetch --tags
26+
echo $?
27+
git tag --list
28+
29+
- name: Install patchelf
30+
run: sudo apt-get install -y patchelf python3-pip
31+
32+
- name: Install prerequisites
33+
run: |
34+
pip3 install -r requirements.txt -r requirements-dev.txt
35+
pip3 install auditwheel
36+
37+
- name: Create wheel
38+
run: |
39+
python3 setup.py bdist_wheel
40+
mkdir wheelhouse
41+
export PATH=$PATH:$HOME/.local/bin
42+
auditwheel repair --plat manylinux2014_x86_64 dist/*.whl
43+
44+
- name: Check the artifacts
45+
run: |
46+
ls -lh "wheelhouse/"
47+
48+
- name: Upload to PyPi
49+
if: startsWith(github.ref, 'refs/tags/')
50+
run: |
51+
TWINE_NON_INTERACTIVE=1 twine upload wheelhouse/*.whl
52+
53+
ubuntu20-other:
54+
name: Ubuntu 20.04 ${{ matrix.arch }}
55+
runs-on: ubuntu-20.04
56+
57+
strategy:
58+
matrix:
59+
include:
60+
- arch: armv6l
61+
- arch: armv7l
62+
- arch: aarch64
63+
64+
steps:
65+
- uses: actions/checkout@v1
66+
with:
67+
submodules: recursive
68+
69+
- name: Get tags
70+
run: |
71+
git fetch --tags
72+
echo $?
73+
git tag --list
74+
75+
- name: Install patchelf
76+
run: sudo apt-get install -y patchelf python3-pip
77+
78+
- name: Install prerequisites
79+
run: |
80+
pip3 install -r requirements.txt -r requirements-dev.txt
81+
82+
- name: Create wheel
83+
run: |
84+
export MAVSDK_SERVER_ARCH=${{ matrix.arch }}
85+
python3 setup.py bdist_wheel
86+
ls dist/*any.whl | sed -e 'p;s/any/linux_${{ matrix.arch }}/' | xargs -n2 mv
87+
88+
- name: Check the artifacts
89+
run: |
90+
ls -lh "dist/"
91+
92+
- name: Upload to PyPi
93+
if: startsWith(github.ref, 'refs/tags/')
94+
run: |
95+
TWINE_NON_INTERACTIVE=1 twine upload dist/*.whl
96+
97+
macOS:
98+
name: macOS
99+
runs-on: macos-latest
100+
steps:
101+
- uses: actions/checkout@v1
102+
with:
103+
submodules: recursive
104+
105+
- name: Get tags
106+
run: |
107+
git fetch --tags
108+
echo $?
109+
git tag --list
110+
111+
- name: Install prerequisites
112+
run: |
113+
pip3 install -r requirements.txt -r requirements-dev.txt
114+
pip3 install delocate twine
115+
116+
- name: Create wheel
117+
run: |
118+
python3 setup.py bdist_wheel
119+
delocate-wheel -w wheelhouse -v dist/*.whl
120+
ls wheelhouse/*any.whl | sed -e 'p;s/any/macosx_10_9_x86_64/' | xargs -n2 mv
121+
122+
- name: Check the artifacts
123+
run: |
124+
ls -lh "wheelhouse/"
125+
126+
- name: Upload to PyPi
127+
if: startsWith(github.ref, 'refs/tags/')
128+
run: |
129+
TWINE_NON_INTERACTIVE=1 twine upload wheelhouse/*.whl
130+
131+
Windows:
132+
name: Windows (${{ matrix.arch }})
133+
runs-on: windows-latest
134+
135+
strategy:
136+
matrix:
137+
include:
138+
- arch: x86
139+
wheel_arch: win32
140+
- arch: x64
141+
wheel_arch: win_amd64
142+
143+
steps:
144+
- uses: actions/checkout@v1
145+
with:
146+
submodules: recursive
147+
148+
- name: Get tags
149+
run: |
150+
git fetch --tags
151+
echo $?
152+
git tag --list
153+
154+
- name: Set up Python
155+
uses: actions/setup-python@v2
156+
with:
157+
python-version: 3.7
158+
architecture: ${{ matrix.arch }}
159+
160+
- name: Install prerequisites
161+
run: |
162+
pip3 install -r requirements.txt -r requirements-dev.txt
163+
pip3 install twine wheel
164+
165+
- name: Create wheel
166+
run: |
167+
python setup.py bdist_wheel
168+
Dir "dist/" | rename-item -NewName {$_.name -replace '-any.whl','-${{ matrix.wheel_arch }}.whl'}
169+
170+
- name: Check the artifacts
171+
run: |
172+
ls "dist/"
173+
174+
- name: Upload to PyPi
175+
if: startsWith(github.ref, 'refs/tags/')
176+
run: |
177+
TWINE_NON_INTERACTIVE=1 twine upload dist/*.whl

.travis.yml

Lines changed: 0 additions & 128 deletions
This file was deleted.

setup.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import urllib.request
88
import os
9-
import platform
109
import stat
1110
import sys
1211
import subprocess
@@ -53,14 +52,18 @@ def platform_suffix(self):
5352
"""
5453
Trying to detect the platform to know which `mavsdk_server` executable to download
5554
"""
56-
if sys.platform.startswith('linux') and platform.machine() == "x86_64":
55+
if sys.platform.startswith('linux') and 'MAVSDK_SERVER_ARCH' in os.environ:
56+
if os.environ['MAVSDK_SERVER_ARCH'] == "armv6l":
57+
return 'musl_armv6'
58+
elif os.environ['MAVSDK_SERVER_ARCH'] == "armv7l":
59+
return 'musl_armv7'
60+
elif os.environ['MAVSDK_SERVER_ARCH'] == "aarch64":
61+
return 'musl_aarch64'
62+
else:
63+
raise NotImplementedError(
64+
f"Error: unknown MAVSDK_SERVER_ARCH: {os.environ['MAVSDK_SERVER_ARCH']}")
65+
elif sys.platform.startswith('linux'):
5766
return 'musl_x86_64'
58-
elif sys.platform.startswith('linux') and platform.machine() == "armv6l":
59-
return 'musl_armv6'
60-
elif sys.platform.startswith('linux') and platform.machine() == "armv7l":
61-
return 'musl_armv7'
62-
elif sys.platform.startswith('linux') and platform.machine() == "aarch64":
63-
return 'musl_aarch64'
6467
elif sys.platform.startswith('darwin'):
6568
return 'macos'
6669
elif sys.platform.startswith('win'):

0 commit comments

Comments
 (0)