Repository navigation
Build and Test #8
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: Build and Test | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| workflow_dispatch: | |
| jobs: | |
| # Build for Ubuntu 22.04 + Python 3.11 only | |
| build: | |
| name: Build (Ubuntu 22.04, Python 3.11) | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake build-essential | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build wheel setuptools>=64 | |
| pip install torch>=2.0.0 numpy>=1.20.0 | |
| pip install pytest pytest-cov | |
| - name: Build package | |
| run: | | |
| python -m build --wheel | |
| env: | |
| AMMS_ENABLE_CUDA: "0" | |
| - name: Install package | |
| run: | | |
| pip install dist/*.whl | |
| - name: Run tests | |
| run: | | |
| pytest tests/ -v --cov=sage.libs.amms --cov-report=xml | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| - name: Upload wheel | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheel-ubuntu22.04-py311 | |
| path: dist/*.whl | |
| # Code quality checks | |
| lint: | |
| name: Code Quality | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install black ruff mypy numpy torch | |
| - name: Check formatting with Black | |
| run: | | |
| black --check sage/ tests/ | |
| - name: Lint with Ruff | |
| run: | | |
| ruff check sage/ tests/ | |
| - name: Type check with mypy | |
| run: | | |
| mypy sage/libs/amms/ --ignore-missing-imports || true |