Tests and polish #1
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: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| # Cancel superseded runs on the same ref (saves CI minutes on rapid pushes). | |
| concurrency: | |
| group: tests-${{ github.ref }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| # The installable project lives in the hackrfpy/ subdirectory (the one with | |
| # pyproject.toml + the pytest config + the `hardware` marker). | |
| working-directory: hackrfpy | |
| jobs: | |
| test: | |
| name: pytest (${{ matrix.os }}, py${{ matrix.python-version }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # windows-latest is first because it is the platform this library | |
| # targets; the cross-platform lifecycle stubs must pass there. | |
| os: [windows-latest, ubuntu-latest, macos-latest] | |
| python-version: ["3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - name: Sync environment (numpy + dev group, editable install) | |
| run: uv sync | |
| - name: Run test suite (hardware tests deselected) | |
| run: uv run pytest -m "not hardware" --cov=hackrfpy --cov-report=xml --cov-report=term-missing | |
| - name: Upload coverage to Codecov | |
| # Optional: only runs once linked at https://codecov.io. Tokenless for | |
| # public repos. Safe to leave in before linking - it just no-ops/soft-fails. | |
| if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: hackrfpy/coverage.xml | |
| fail_ci_if_error: false | |
| lint: | |
| name: ruff + mypy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| python-version: "3.12" | |
| - name: Sync environment | |
| run: uv sync | |
| - name: Ruff lint | |
| run: uv run ruff check . | |
| - name: Mypy | |
| # Blocking. The package ships a py.typed marker, which promises | |
| # downstream type-checkers that these annotations are real; this gate is | |
| # what keeps that promise true. | |
| run: uv run mypy |