Adding HydraSDR support #310
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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] | |
| python-version: ['3.9', '3.10', '3.11', '3.12'] | |
| architecture: [x64] | |
| include: | |
| - os: windows-latest | |
| python-version: '3.12' | |
| architecture: x86 | |
| - os: windows-latest | |
| python-version: '3.12' | |
| architecture: x64 | |
| - os: macOS-13 | |
| python-version: '3.12' | |
| architecture: x64 | |
| 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: Setup MSYS2 | |
| if: startsWith(matrix.os, 'windows') | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: MINGW64 | |
| update: true | |
| install: >- | |
| mingw-w64-x86_64-cmake | |
| mingw-w64-x86_64-gcc | |
| mingw-w64-x86_64-make | |
| mingw-w64-x86_64-pkg-config | |
| git | |
| wget | |
| unzip | |
| p7zip | |
| - name: Build rfone_host (Windows) | |
| if: startsWith(matrix.os, 'windows') | |
| shell: msys2 {0} | |
| run: | | |
| # Clone rfone_host | |
| git clone https://github.com/hydrasdr/rfone_host.git | |
| cd rfone_host | |
| # Download libusb as specified in README | |
| wget -nv https://github.com/libusb/libusb/releases/download/v1.0.23/libusb-1.0.23.7z | |
| # Extract libusb-1.0.23.7z to rfone_host directory | |
| 7z x libusb-1.0.23.7z | |
| # Verify we have rfone_host/libusb-1.0.23 with proper structure | |
| ls -la libusb-1.0.23/ | |
| # Download pthreads as specified in README | |
| wget -nv https://gcc.gnu.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip | |
| # Extract pthreads-w32-2-9-1-release.zip to rfone_host directory as libpthread-2-9-1-win | |
| unzip -q pthreads-w32-2-9-1-release.zip | |
| mv pthreads-w32-2-9-1-release libpthread-2-9-1-win | |
| # Verify we have rfone_host/libpthread-2-9-1-win with dll, include, lib directories | |
| ls -la libpthread-2-9-1-win/ | |
| # Create build directory and build using MSYS2/MinGW64 as per README | |
| mkdir build | |
| cd build | |
| # Configure with cmake using MSYS Makefiles | |
| cmake ../ -G "MSYS Makefiles" -DLIBUSB_INCLUDE_DIR=/mingw64/include/libusb-1.0/ | |
| # Build | |
| make -j$(nproc) | |
| make install | |
| - 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 build-essential cmake git pkg-config | |
| git clone https://github.com/hydrasdr/rfone_host.git | |
| cd rfone_host | |
| mkdir build | |
| cd build | |
| cmake -DCMAKE_INSTALL_PREFIX="/usr" .. | |
| make -j$(nproc) | |
| sudo make install | |
| sudo ldconfig | |
| cd ../.. | |
| pip install PyVirtualDisplay==0.2.5 | |
| elif [[ $OS == windows* ]] | |
| then | |
| pip install pywin32 pyaudio | |
| elif [[ $OS == mac* ]] | |
| then | |
| brew install airspy hackrf librtlsdr libbladerf 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 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: ${{ startsWith(matrix.os, 'ubuntu') && matrix.python-version == '3.12' }} | |
| 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.12' }} | |
| 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.12' }} | |
| 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 }} |