name: coverage

on: [push, pull_request]

jobs:
  ubuntu:
    runs-on: Ubuntu-22.04

    strategy:
      matrix:
        python-version: ["3.10"]

    steps:
      - name: Checkout pygraphviz
        uses: actions/checkout@v4

      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}

      - name: Update apt-get
        run: sudo apt-get update

      - name: Install graphviz
        run: sudo apt-get install graphviz graphviz-dev

      - name: Install packages
        run: |
          pip install --upgrade pip wheel setuptools
          pip install -r requirements/doc.txt
          pip install -r requirements/test.txt
          pip install -e .
          pip list

      - name: Coverage report for pygraphviz
        run: |
          pytest --cov=pygraphviz --doctest-modules --durations=10 --pyargs pygraphviz
          codecov
