denet 0.7.0

a simple process monitor
Documentation
name: denet CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
  workflow_dispatch:

jobs:
  test:
    name: Test on ${{ matrix.os }} (py${{ matrix.python-version }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
        python-version: ["3.12", "3.13"]

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy, rustfmt, llvm-tools-preview

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

      - name: Install pixi
        run: |
          curl -fsSL https://pixi.sh/install.sh | bash
          echo "$HOME/.pixi/bin" >> $GITHUB_PATH

      - name: Cache pixi environments
        uses: actions/cache@v4
        with:
          path: ~/.pixi
          key: ${{ runner.os }}-pixi-${{ hashFiles('pixi.lock') }}
          restore-keys: |
            ${{ runner.os }}-pixi-

      - name: Install dependencies
        run: |
          pixi install
          if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
            cargo install cargo-llvm-cov --force
          fi

      - name: Lint and format check
        run: |
          cargo fmt --all -- --check
          pixi run lint-all

      # Run Rust tests with coverage on Linux, regular tests on macOS
      - name: Run Rust tests
        env:
          PYO3_USE_ABI3_FORWARD_COMPATIBILITY: 1
        run: |
          if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
            echo "Running Rust tests with coverage on Linux"
            pixi run coverage-rust
          else
            echo "Running Rust tests on macOS"
            pixi run test-rust
          fi

      - name: Build and install Python package
        env:
          PYO3_USE_ABI3_FORWARD_COMPATIBILITY: 1
        run: |
          pixi run develop

      - name: Run python tests
        run: |
          if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
            pixi run pytest-with-coverage
          else
            pixi run pytest
          fi

      - name: Upload Python coverage to Codecov
        if: matrix.os == 'ubuntu-latest'
        uses: codecov/codecov-action@v3
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: ./coverage.xml
          flags: python
          name: python-coverage
          fail_ci_if_error: false
          verbose: true

      - name: Upload Rust coverage to Codecov
        if: matrix.os == 'ubuntu-latest'
        uses: codecov/codecov-action@v3
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: ./lcov.info
          flags: rust
          name: rust-coverage
          fail_ci_if_error: false
          verbose: true

  build-wheels:
    name: Build wheels on ${{ matrix.os }} (py${{ matrix.python-version }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
        python-version: ["3.12", "3.13"]

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

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

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          python -m pip install maturin twine pytest

      - name: Build wheels
        env:
          PYO3_USE_ABI3_FORWARD_COMPATIBILITY: 1
        run: |
          maturin build --release

      - name: Upload wheels
        uses: actions/upload-artifact@v4
        with:
          name: wheels-${{ matrix.os }}-${{ matrix.python-version }}
          path: target/wheels/*.whl

  test-wheels:
    name: Test wheels on ${{ matrix.os }} (py${{ matrix.python-version }})
    needs: build-wheels
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
        python-version: ["3.12", "3.13"]

    steps:
      - uses: actions/checkout@v4

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

      - name: Download wheels
        uses: actions/download-artifact@v4
        with:
          name: wheels-${{ matrix.os }}-${{ matrix.python-version }}
          path: dist

      - name: Install wheel and test
        run: |
          python -m pip install --upgrade pip
          python -m pip install pytest
          python -m pip install dist/*.whl
          python -c "import denet; print(denet.__doc__)"
          cd tests/python && python -m pytest -xvs