name: CI

on:
  push:
    branches:
      - "main"
      - "release-*"
  pull_request:
    branches: [main]

jobs:
  build:
    name: build
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
    steps:
      - uses: actions/checkout@v4
      - name: Setup python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
          cache: 'pip'
      - name: Build
        run: |
          pip install uv
          uv venv
          uv pip install -e .[dev]
      - name: Test
        run: |
          uv run mibdump --generate-mib-texts NET-SNMP-EXAMPLES-MIB
          uv run mibdump --generate-mib-texts IF-MIB
          uv run mibdump --generate-mib-texts LEXTUDIO-TEST-MIB
          uv run mibdump --generate-mib-texts CISCO-ENHANCED-IPSEC-FLOW-MIB
          uv run pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov=com --cov-report=xml --cov-report=html
      - name: Test summary
        uses: test-summary/action@v2
        with:
          paths: "junit/*.xml"
        if: always()
      # - uses: actions/upload-artifact@v4
      #   with:
      #     name: dist
      #     path: dist
      # - uses: actions/upload-artifact@v4
      #   with:
      #     name: output
      #     path: output
