test: add physics ground-truth validation for kinematics #64
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: CI | |
| on: | |
| push: | |
| branches: ["**"] | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - run: pip install ruff | |
| - name: Ruff check | |
| run: ruff check braggtrack/ tests/ scripts/ | |
| - name: Ruff format check | |
| run: ruff format --check braggtrack/ tests/ scripts/ | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: pip-${{ matrix.python-version }}- | |
| - name: Install package | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -e ".[notebook]" | |
| python -m pip install pytest pytest-cov | |
| - name: Run pre-PR diagnostics | |
| run: python scripts/pre_pr_check.py | |
| - name: Run tests with coverage | |
| run: | | |
| python -m pytest tests/ -v --cov=braggtrack --cov-report=term-missing --cov-report=xml | |
| - name: Run acceptance gates | |
| run: python scripts/ci_report.py | |
| - name: Upload coverage | |
| if: matrix.python-version == '3.12' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: coverage.xml | |
| notebook: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: pip-3.12-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: pip-3.12- | |
| - name: Install package + notebook deps | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -e ".[notebook]" | |
| python -m pip install nbconvert | |
| - name: Execute notebook | |
| run: | | |
| python -m jupyter nbconvert \ | |
| --to notebook --execute \ | |
| --ExecutePreprocessor.timeout=600 \ | |
| notebooks/braggtrack_demo.ipynb \ | |
| --output-dir /tmp |