Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: CI

on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main

jobs:
lint:
name: Lint (Ruff)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install Ruff
run: pip install ruff

- name: Run Ruff check
run: ruff check . --output-format=github

- name: Run Ruff format check
run: ruff format --check .

type-check:
name: Type Check (mypy)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: pip install -e ".[dev]"

- name: Run mypy
run: mypy vastai/

test:
name: Test (${{ matrix.os }} / Python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: pip install -e ".[dev]"

- name: Run pytest with coverage
run: pytest --cov=vastai --cov-report=xml

- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

smoke-standalone:
name: Smoke Test Standalone (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install minimal dependencies (standalone mode)
run: pip install requests python-dateutil

- name: Test vast.py --help
run: python vast.py --help

- name: Test vast.py search offers --help
run: python vast.py search offers --help

- name: Test vast.py show instances --help
run: python vast.py show instances --help
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,17 @@ passed_machines.txt
failed_machines.txt
Pass_testresults.log
dist/
build/
__pycache__/
*.egg-info/
*.egg
.eggs/
*.pyc
*.pyo

# Test artifacts
.coverage
.pytest_cache/

# MkDocs build output
site/
5 changes: 4 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
from .vastai_sdk import VastAI
try:
from .vastai_sdk import VastAI
except ImportError:
pass
31 changes: 31 additions & 0 deletions benchmarks/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: "3.8"

services:
prometheus:
image: prom/prometheus:latest
container_name: prometheus
restart: unless-stopped
ports:
- "9090:9090"
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
command:
- "--config.file=/etc/prometheus/prometheus.yml"

grafana:
image: grafana/grafana:latest
container_name: grafana
restart: unless-stopped
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
depends_on:
- prometheus
volumes:
- grafana-storage:/var/lib/grafana

volumes:
grafana-storage:
Loading