Migrate to uv #383
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: Python tests | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'pyproject.toml' | |
| - 'uv.lock' | |
| - '**.py' | |
| - '.github/workflows/python-tests.yml' | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - 'pyproject.toml' | |
| - 'uv.lock' | |
| - '**.py' | |
| - '.github/workflows/python-tests.yml' | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| env: | |
| # Display must be available globally for linux to know where xvfb is | |
| DISPLAY: ":99.0" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| version: latest | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| # from https://stackoverflow.com/questions/60692711 | |
| sudo apt-get install -y xvfb libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0 libxcb-shape0 libglib2.0-0 libgl1-mesa-dev | |
| sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev | |
| # start xvfb in the background | |
| sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 & | |
| - name: Install dependencies | |
| run: uv sync --no-group docs | |
| - name: Lint with ruff | |
| run: uv run ruff check . --statistics | |
| - name: Test with pytest | |
| run: uv run pytest --cov=./ | |
| - name: Upload coverage data to coveralls.io | |
| continue-on-error: true | |
| run: | | |
| pipx run coveralls | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| COVERALLS_FLAG_NAME: ${{ matrix.python-version }} | |
| COVERALLS_PARALLEL: true | |
| coveralls: | |
| name: Indicate completion to coveralls.io | |
| needs: test | |
| runs-on: ubuntu-latest | |
| container: python:3-slim | |
| steps: | |
| - name: Install coveralls | |
| run: pip3 install --upgrade coveralls | |
| - name: Finished | |
| continue-on-error: true | |
| run: coveralls --finish | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |