docs: Add FAQ section to README #25
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: | |
| - '**' | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11", "3.12", "3.13"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install package in editable mode | |
| run: uv pip install -e . --system | |
| - name: Install test dependencies | |
| run: uv pip install -e ".[test]" --system | |
| - name: Run unit tests with coverage | |
| run: uv run pytest tests/unit/ -m unit -v -n auto --cov=glpkg --cov-report=xml --cov-report=term | |
| - name: Upload coverage reports | |
| if: matrix.python-version == '3.11' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: | | |
| coverage.xml | |
| htmlcov/ | |
| retention-days: 7 | |
| - name: Check coverage threshold | |
| if: matrix.python-version == '3.11' | |
| run: | | |
| # Extract coverage percentage from XML | |
| COVERAGE=$(python -c " | |
| import xml.etree.ElementTree as ET | |
| tree = ET.parse('coverage.xml') | |
| root = tree.getroot() | |
| line_rate = float(root.get('line-rate', 0)) | |
| print(f'{line_rate * 100:.2f}') | |
| ") | |
| echo "Coverage: ${COVERAGE}%" | |
| # Check if below 95% warning threshold | |
| if (( $(echo "$COVERAGE < 95" | bc -l) )); then | |
| echo "::warning::Coverage is below 95% target: ${COVERAGE}%" | |
| fi | |
| # The --cov-fail-under=90 in pytest already handles the failure threshold | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: pytest-results-${{ matrix.python-version }} | |
| path: | | |
| .pytest_cache/ | |
| htmlcov/ | |
| retention-days: 7 |