Run ruff format on inference-monitor and training-monitor #5
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 — Inference Monitor | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "inference-monitor/**" | |
| - ".github/workflows/ci-inference-monitor.yml" | |
| pull_request: | |
| paths: | |
| - "inference-monitor/**" | |
| concurrency: | |
| group: ci-inference-monitor-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }}/inference-monitor | |
| jobs: | |
| lint: | |
| name: Lint & Type Check | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| working-directory: inference-monitor | |
| run: | | |
| pip install -e ".[dev]" | |
| - name: Ruff lint | |
| working-directory: inference-monitor | |
| run: ruff check src/ tests/ | |
| - name: Ruff format check | |
| working-directory: inference-monitor | |
| run: ruff format --check src/ tests/ | |
| - name: Mypy type check | |
| working-directory: inference-monitor | |
| run: mypy src/ --ignore-missing-imports | |
| unit-tests: | |
| name: Unit Tests | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| working-directory: inference-monitor | |
| run: pip install -e ".[dev]" | |
| - name: Run tests with coverage | |
| working-directory: inference-monitor | |
| run: | | |
| pytest tests/ -v \ | |
| --cov=src \ | |
| --cov-report=xml:coverage.xml \ | |
| --cov-report=term-missing \ | |
| --junitxml=junit.xml \ | |
| -m "not gpu" | |
| - name: Upload coverage | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: inference-monitor-coverage | |
| path: inference-monitor/coverage.xml | |
| gpu-tests: | |
| name: GPU Integration Tests | |
| needs: unit-tests | |
| runs-on: [self-hosted, gpu, cuda] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| working-directory: inference-monitor | |
| run: pip install -e ".[dev,gpu]" | |
| - name: Run GPU tests | |
| working-directory: inference-monitor | |
| run: | | |
| nvidia-smi | |
| pytest tests/ -v -m gpu --timeout=300 | |
| overhead-benchmark: | |
| name: Overhead Benchmark | |
| needs: unit-tests | |
| runs-on: [self-hosted, gpu, cuda] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: pip install -e inference-monitor/.[dev,gpu] | |
| - name: Run overhead benchmark | |
| run: | | |
| python benchmarks/overhead_measurement/inference_monitor_overhead.py \ | |
| --output inference_overhead.json | |
| - name: Upload benchmark results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: inference-monitor-benchmark | |
| path: inference_overhead.json | |
| docker: | |
| name: Docker Image | |
| needs: [lint, unit-tests] | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Container Registry | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=sha | |
| type=ref,event=branch | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: inference-monitor/packaging/Dockerfile | |
| push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |