CI: Use uv for installing dependency packages for faster workflow runs
#502
Workflow file for this run
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: Tests | |
| on: | |
| pull_request: ~ | |
| push: | |
| branches: [ main ] | |
| # Allow job to be triggered manually. | |
| workflow_dispatch: | |
| # Cancel in-progress jobs when pushing to the same branch. | |
| concurrency: | |
| cancel-in-progress: true | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| jobs: | |
| tests: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ "ubuntu-22.04" ] # , macos-latest, windows-latest ] | |
| python-version: [ | |
| "3.7", | |
| "3.8", | |
| "3.9", | |
| "3.10", | |
| "3.11", | |
| "3.12", | |
| "3.13", | |
| "3.14", | |
| ] | |
| mosquitto-version: [ "2.0" ] | |
| influxdb-version: [ "1.8" ] | |
| grafana-version: [ "12.4.0" ] | |
| include: | |
| # - grafana-version: "7.5.17" | |
| # python-version: "3.14" | |
| # mosquitto-version: "2.0" | |
| # influxdb-version: "1.8" | |
| # os: "ubuntu-22.04" | |
| # - grafana-version: "8.5.27" | |
| # python-version: "3.14" | |
| # mosquitto-version: "2.0" | |
| # influxdb-version: "1.8" | |
| # os: "ubuntu-22.04" | |
| # - grafana-version: "9.5.21" | |
| # python-version: "3.14" | |
| # mosquitto-version: "2.0" | |
| # influxdb-version: "1.8" | |
| # os: "ubuntu-22.04" | |
| # - grafana-version: "10.4.19" | |
| # python-version: "3.14" | |
| # mosquitto-version: "2.0" | |
| # influxdb-version: "1.8" | |
| # os: "ubuntu-22.04" | |
| # - grafana-version: "11.6.12" | |
| # python-version: "3.14" | |
| # mosquitto-version: "2.0" | |
| # influxdb-version: "1.8" | |
| # os: "ubuntu-22.04" | |
| - grafana-version: "12.3.4" | |
| python-version: "3.14" | |
| mosquitto-version: "2.0" | |
| influxdb-version: "1.8" | |
| os: "ubuntu-22.04" | |
| # https://docs.github.com/en/free-pro-team@latest/actions/guides/about-service-containers | |
| services: | |
| influxdb: | |
| image: influxdb:${{ matrix.influxdb-version }} | |
| ports: | |
| - 8083:8083 | |
| - 8086:8086 | |
| grafana: | |
| image: grafana/grafana:${{ matrix.grafana-version }} | |
| ports: | |
| - 3000:3000 | |
| env: | |
| GF_SECURITY_ADMIN_PASSWORD: admin | |
| mongodb: | |
| image: mongo:8 | |
| ports: | |
| - 27017:27017 | |
| env: | |
| OS: ${{ matrix.os }} | |
| PYTHON: ${{ matrix.python-version }} | |
| UV_SYSTEM_PYTHON: true | |
| name: Python ${{ matrix.python-version }}, Grafana ${{ matrix.grafana-version }}, Mosquitto ${{ matrix.mosquitto-version }}, InfluxDB ${{ matrix.influxdb-version }} | |
| steps: | |
| - name: Acquire sources | |
| uses: actions/checkout@v6 | |
| - name: Start Mosquitto | |
| uses: namoshek/mosquitto-github-action@v1 | |
| with: | |
| version: ${{ matrix.mosquitto-version }} | |
| ports: '1883:1883 8883:8883' | |
| # certificates: ${{ github.workspace }}/.ci/tls-certificates | |
| config: ${{ github.workspace }}/etc/test/mosquitto-no-auth.conf | |
| # container-name: 'mqtt' | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| architecture: x64 | |
| cache: 'pip' | |
| cache-dependency-path: | | |
| setup.py | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| cache-dependency-glob: | | |
| setup.py | |
| cache-suffix: ${{ matrix.python-version }} | |
| enable-cache: true | |
| version: "latest" | |
| - name: Install dependency packages | |
| run: | | |
| uv venv --seed .venv | |
| uv pip install --upgrade --editable='.[full,test]' --overrides .github/workflows/requirements-overrides.txt | |
| - name: Run tests, with coverage | |
| run: | | |
| uv run poe test-coverage | |
| # https://github.com/codecov/codecov-action | |
| - name: Upload coverage results to Codecov | |
| uses: codecov/codecov-action@v5 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| with: | |
| env_vars: OS,PYTHON | |
| fail_ci_if_error: true |