|
| 1 | +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
| 2 | +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python |
| 3 | + |
| 4 | +# Inspired from https://pytest-qt.readthedocs.io/en/latest/troubleshooting.html#github-actions |
| 5 | + |
| 6 | +name: Build, install and test with PySide6 |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + branches: [ "master", "develop" ] |
| 11 | + pull_request: |
| 12 | + branches: [ "master", "develop" ] |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + |
| 17 | + env: |
| 18 | + DISPLAY: ':99.0' |
| 19 | + |
| 20 | + runs-on: ubuntu-latest |
| 21 | + strategy: |
| 22 | + fail-fast: false |
| 23 | + matrix: |
| 24 | + python-version: ["3.9", "3.13"] |
| 25 | + |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + - name: Set up Python ${{ matrix.python-version }} |
| 29 | + uses: actions/setup-python@v5 |
| 30 | + with: |
| 31 | + python-version: ${{ matrix.python-version }} |
| 32 | + - name: Install dependencies |
| 33 | + run: | |
| 34 | + sudo apt install libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils |
| 35 | + /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX |
| 36 | + python -m pip install --upgrade pip |
| 37 | + python -m pip install flake8 pytest |
| 38 | + pip install PySide6 setuptools numpy Cython |
| 39 | + python setup.py build_ext --inplace |
| 40 | + pip install .[test] |
| 41 | + - name: Lint with flake8 |
| 42 | + run: | |
| 43 | + # stop the build if there are Python syntax errors or undefined names |
| 44 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 45 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 46 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 47 | + - name: Test with pytest |
| 48 | + run: | |
| 49 | + pytest |
0 commit comments