CI: fix Ubuntu #22
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 | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.14" | |
| - name: Install linters | |
| run: pip install ruff 'black<26' | |
| - name: Run ruff check | |
| run: ruff check plugins/ tests/ demos/ utils/ | |
| - name: Run black check | |
| run: black --check plugins/ tests/ demos/ utils/ | |
| build: | |
| needs: lint | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| gst-install: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| gstreamer1.0-plugins-base \ | |
| gstreamer1.0-plugins-good \ | |
| gstreamer1.0-plugins-bad \ | |
| gir1.2-gstreamer-1.0 \ | |
| gir1.2-gst-plugins-base-1.0 \ | |
| gir1.2-gst-plugins-bad-1.0 \ | |
| python3-gi \ | |
| python3-gi-cairo \ | |
| python3-gst-1.0 \ | |
| gstreamer1.0-python3-plugin-loader \ | |
| libcairo2 \ | |
| libcairo2-dev \ | |
| pkg-config \ | |
| libgirepository-2.0-dev \ | |
| libglib2.0-dev \ | |
| python3-dev | |
| - os: macos-latest | |
| gst-install: | | |
| brew install gstreamer cairo pkg-config pygobject3 gobject-introspection | |
| echo "DYLD_LIBRARY_PATH=$(brew --prefix)/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV | |
| echo "GI_TYPELIB_PATH=$(brew --prefix)/lib/girepository-1.0" >> $GITHUB_ENV | |
| - os: windows-latest | |
| gst-install: | | |
| choco install gstreamer gstreamer-devel --yes | |
| "C:\gstreamer\1.0\msvc_x86_64\bin" >> $env:GITHUB_PATH | |
| "GST_PLUGIN_PATH=C:\gstreamer\1.0\msvc_x86_64\lib\gstreamer-1.0" >> $env:GITHUB_ENV | |
| "PKG_CONFIG_PATH=C:\gstreamer\1.0\msvc_x86_64\lib\pkgconfig" >> $env:GITHUB_ENV | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.14" | |
| - name: Install GStreamer | |
| run: ${{ matrix.gst-install }} | |
| - name: Create venv and install CPU dependencies | |
| shell: bash | |
| run: | | |
| python -m venv --system-site-packages .venv | |
| if [[ "$RUNNER_OS" == "Windows" ]]; then | |
| source .venv/Scripts/activate | |
| else | |
| source .venv/bin/activate | |
| fi | |
| pip install --no-deps -e . | |
| pip install numpy opencv-python-headless ultralytics | |
| # pygobject/pycairo from pip need C build deps; install only where available | |
| pip install pygobject pycairo || echo "pygobject/pycairo pip install failed (using system packages)" | |
| - name: Verify core imports | |
| shell: bash | |
| continue-on-error: ${{ runner.os != 'Linux' }} | |
| run: | | |
| if [[ "$RUNNER_OS" == "Windows" ]]; then | |
| source .venv/Scripts/activate | |
| else | |
| source .venv/bin/activate | |
| fi | |
| python -c " | |
| import importlib, sys | |
| modules = [ | |
| 'plugins.python.streammux', | |
| 'plugins.python.streamdemux', | |
| 'plugins.python.overlay', | |
| 'plugins.python.engine.ml_engine', | |
| 'plugins.python.engine.engine_factory', | |
| ] | |
| failed = [] | |
| for m in modules: | |
| try: | |
| importlib.import_module(m) | |
| print(f' OK {m}') | |
| except Exception as e: | |
| print(f' FAIL {m}: {e}') | |
| failed.append(m) | |
| if failed: | |
| print(f'\n{len(failed)} import(s) failed') | |
| sys.exit(1) | |
| print('\nAll imports OK') | |
| " | |
| - name: Check GStreamer plugin discovery (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| export GST_PLUGIN_PATH=${{ github.workspace }}/plugins:$GST_PLUGIN_PATH | |
| gst-inspect-1.0 python || echo "gst-python loader not available in CI (expected without gstreamer1.0-python3-plugin-loader)" |