name: Run tests

on:
  push:
    branches:
      - main

jobs:
  run-tests:
    name: Run tests
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: 3.12
      - name: Set up Rust
        uses: dtolnay/rust-toolchain@stable
      - name: Run Python tests
        run: make test
      - name: Run Rust tests
        run: make rust-test
  check-code-coverage:
    name: Check code coverage
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: 3.12
      - name: Install Python dependencies
        run: python -m pip install --upgrade coverage
      - name: Set up Rust
        uses: dtolnay/rust-toolchain@stable
      - name: Install Rust dependencies
        run: cargo install cargo-tarpaulin
      - name: Test Python code coverage
        run: make coverage-pct
      - name: Test Rust code coverage
        run: make rust-coverage-pct
