|
| 1 | +# This workflow installs dependencies, starts DataLab, and runs tests with live mode |
| 2 | +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python |
| 3 | + |
| 4 | +name: Test with Live DataLab |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [ "main", "develop" ] |
| 9 | + pull_request: |
| 10 | + branches: [ "main", "develop" ] |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +jobs: |
| 14 | + test: |
| 15 | + env: |
| 16 | + DISPLAY: ':99.0' |
| 17 | + |
| 18 | + runs-on: ubuntu-latest |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + python-version: ["3.9", "3.13"] |
| 23 | + |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - name: Set up Python ${{ matrix.python-version }} |
| 28 | + uses: actions/setup-python@v5 |
| 29 | + with: |
| 30 | + python-version: ${{ matrix.python-version }} |
| 31 | + |
| 32 | + - name: Install system dependencies |
| 33 | + run: | |
| 34 | + sudo apt-get update |
| 35 | + sudo apt-get install -y \ |
| 36 | + libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 \ |
| 37 | + libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 \ |
| 38 | + libxcb-shape0 libegl1 libgl1-mesa-glx x11-utils |
| 39 | +
|
| 40 | + - name: Start Xvfb |
| 41 | + run: | |
| 42 | + /sbin/start-stop-daemon --start --quiet \ |
| 43 | + --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background \ |
| 44 | + --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX |
| 45 | +
|
| 46 | + - name: Install Python dependencies |
| 47 | + run: | |
| 48 | + python -m pip install --upgrade pip |
| 49 | + python -m pip install ruff pytest pytest-cov |
| 50 | + python -m pip install PyQt5 |
| 51 | +
|
| 52 | + - name: Install DataLab and dependencies |
| 53 | + run: | |
| 54 | + if [ "${{ github.ref_name }}" = "develop" ]; then |
| 55 | + # Clone and install development versions |
| 56 | + cd .. |
| 57 | + git clone --depth 1 https://github.com/PlotPyStack/PythonQwt.git |
| 58 | + git clone --depth 1 --branch develop https://github.com/PlotPyStack/guidata.git |
| 59 | + git clone --depth 1 --branch develop https://github.com/PlotPyStack/plotpy.git |
| 60 | + git clone --depth 1 --branch develop https://github.com/DataLab-Platform/sigima.git |
| 61 | + git clone --depth 1 --branch develop https://github.com/DataLab-Platform/DataLab.git |
| 62 | + cd DataLab-Kernel |
| 63 | + pip install -e ../guidata |
| 64 | + pip install -e ../PythonQwt |
| 65 | + pip install -e ../plotpy |
| 66 | + pip install -e ../sigima |
| 67 | + pip install -e ../DataLab |
| 68 | + else |
| 69 | + # Install from PyPI for main branch |
| 70 | + pip install datalab-platform |
| 71 | + fi |
| 72 | +
|
| 73 | + - name: Install DataLab-Kernel |
| 74 | + run: | |
| 75 | + # Install without deps (we already have them) |
| 76 | + pip install -e . --no-deps |
| 77 | + # Install remaining deps from pyproject.toml |
| 78 | + pip install ipykernel jupyter-client numpy h5py matplotlib |
| 79 | +
|
| 80 | + - name: Lint with Ruff |
| 81 | + run: ruff check --output-format=github datalab_kernel |
| 82 | + |
| 83 | + - name: Run unit tests |
| 84 | + run: pytest datalab_kernel/tests/unit datalab_kernel/tests/contract -v --tb=long |
| 85 | + |
| 86 | + - name: Run live integration tests |
| 87 | + run: | |
| 88 | + # Run integration tests with DataLab auto-start |
| 89 | + pytest --live --start-datalab datalab_kernel/tests/integration -v --tb=long |
0 commit comments