-
Notifications
You must be signed in to change notification settings - Fork 886
197 lines (174 loc) · 6.89 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: CI
env:
PYTHONUNBUFFERED: 1
on:
push:
branches: [ master ]
tags: [ "v*" ]
pull_request:
branches: [ master ]
jobs:
ci:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-12]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
architecture: [x64]
include:
- os: windows-latest
python-version: '3.11'
architecture: x86
exclude:
- os: windows-latest
python-version: '3.8'
- os: windows-latest
python-version: '3.9'
- os: windows-latest
python-version: '3.10'
- os: windows-latest
python-version: '3.12'
- os: macOS-12
python-version: '3.8'
- os: macOS-12
python-version: '3.9'
- os: macOS-12
python-version: '3.10'
- os: macOS-12
python-version: '3.12'
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Setup SDR Drivers (Windows)
if: startsWith(matrix.os, 'windows')
run: |
choco install wget --no-progress
wget -nv -O windrivers.zip https://github.com/jopohl/sdrbuild/releases/download/v1.1/win-$ARCH.zip
7z x windrivers.zip -osrc/urh/dev/native/lib/shared
ls src/urh/dev/native/lib/shared
shell: bash
env:
ARCH: ${{ matrix.architecture }}
- name: Install Dependencies
run: |
pip install wheel
pip install -r data/requirements.txt
if [[ $OS == ubuntu* ]]
then
sudo apt-get update
sudo apt-get install libhackrf-dev librtlsdr-dev xvfb libxkbcommon-x11-0 x11-utils libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0
pip install PyVirtualDisplay==0.2.5
elif [[ $OS == windows* ]]
then
pip install pywin32 pyaudio
elif [[ $OS == mac* ]]
then
brew install airspy hackrf librtlsdr libbladerf pothosware/homebrew-pothos/limesuite portaudio uhd
wget -nv https://github.com/analogdevicesinc/libiio/releases/download/v0.23/macOS-10.15.pkg
sudo installer -pkg macOS-10.15.pkg -target /
sudo cp /Library/Frameworks/iio.framework/iio /usr/local/lib/libiio.dylib
sudo install_name_tool -id "/usr/local/lib/libiio.dylib" /usr/local/lib/libiio.dylib
file /usr/local/lib/libiio.dylib
otool -L /usr/local/lib/libiio.dylib
sudo cp /Library/Frameworks/iio.framework/Versions/0.23/Headers/iio.h /usr/local/include
wget -nv https://www.sdrplay.com/software/SDRplay_RSP_API-MacOSX-2.13.2.pkg
sudo installer -pkg SDRplay_RSP_API-MacOSX-2.13.2.pkg -target /
pip install pyaudio
pip install pillow
fi
pip install twine setuptools pytest pytest-xvfb pytest-cov pytest-faulthandler six appdirs packaging pyinstaller
python -c "import tempfile, os; open(os.path.join(tempfile.gettempdir(), 'urh_releasing'), 'w').close()"
shell: bash
env:
OS: ${{ matrix.os }}
- name: Build Cython Extensions
run: python src/urh/cythonext/build.py
- name: Create sdist
if: ${{ matrix.python-version == '3.11' && startsWith(matrix.os, 'ubuntu') }}
run: python setup.py sdist
- run: python setup.py bdist_wheel
if: ${{ !startsWith(matrix.os, 'ubuntu') }}
- name: Build manylinux wheels
if: startsWith(matrix.os, 'ubuntu')
run: |
docker run --rm \
-e PYVER=$(python -c "import sys; print('%s%s' % (sys.version_info.major, sys.version_info.minor))") \
-v `pwd`:/io jopohl/urh_manylinux2_28 /io/data/make_manylinux_wheels.sh
- name: Check wheel
if: startsWith(matrix.os, 'ubuntu')
run: |
pip install dist/*.whl
urh --version
xvfb-run urh autoclose
python data/check_native_backends.py
- name: Build .exe Installer
if: startsWith(matrix.os, 'windows')
run: |
python data/pyinstaller_helper.py
for /f %%i in ('python src/urh/version.py') do set URHVERSION=%%i
iscc /dMyAppVersion=%URHVERSION% /dArch=%PYARCH% data/inno.iss
shell: cmd
env:
PYARCH: ${{ matrix.architecture }}
- name: Check urh_debug.exe
if: startsWith(matrix.os, 'windows')
run: |
cd pyinstaller\urh
urh_debug.exe autoclose
shell: cmd
- name: Build DMG
if: startsWith(matrix.os, 'macos')
run: |
cp data/pyinstaller_macos.spec urh.spec
pyinstaller --clean --distpath ./pyinstaller --workpath ./urh_build urh.spec
mkdir -p dist
cat pyinstaller/main.app/Contents/Info.plist
hdiutil create -volname Universal.Radio.Hacker \
-srcfolder pyinstaller/main.app \
-ov -format UDZO \
dist/Universal.Radio.Hacker-"$(python src/urh/version.py)".dmg
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.architecture }}
path: dist
- name: Run pytest with coverage
if: ${{ startsWith(matrix.os, 'ubuntu') && matrix.python-version == '3.11' }}
run: |
touch tests/show_gui
cp tests/.coveragerc .
pytest -s -v --junitxml=junit/test-results.xml --cov=src --cov-config=.coveragerc tests
coverage xml
coverage html
- name: Run pytest without coverage
if: ${{ !startsWith(matrix.os, 'ubuntu') || matrix.python-version != '3.11' }}
run: pytest -s -v --junitxml=junit/test-results.xml tests
- uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/')
with:
artifacts: "dist/*.exe,dist/*.dmg"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
generateReleaseNotes: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
- name: Upload to PyPi
if: startsWith(github.ref, 'refs/tags/')
run: |
if [[ $OS == ubuntu* ]]
then
twine upload --skip-existing dist/*
else
twine upload --skip-existing dist/*.whl
fi
shell: bash
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_REPOSITORY_URL: "https://upload.pypi.org/legacy/"
OS: ${{ matrix.os }}