Upgrade Python versions in CI #188
Workflow file for this run
This file contains 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, windows-2019, macos-11] | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
architecture: [x64] | |
include: | |
- os: windows-2019 | |
python-version: '3.8' | |
architecture: x86 | |
exclude: | |
- os: windows-2019 | |
python-version: '3.9' | |
- os: windows-2019 | |
python-version: '3.10' | |
- os: windows-2019 | |
python-version: '3.11' | |
- os: windows-2019 | |
python-version: '3.12' | |
- os: macOS-11 | |
python-version: '3.8' | |
- os: macOS-11 | |
python-version: '3.9' | |
- os: macOS-11 | |
python-version: '3.10' | |
- os: macOS-11 | |
python-version: '3.12' | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
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 tap pothosware/homebrew-pothos | |
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 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@v3 | |
with: | |
name: dist-${{ matrix.os }} | |
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 }} |