Configure Vast.ai CI/CD integration with GitHub Actions and automated GPU testing.
Use when setting up automated testing on GPU instances,
or integrating Vast.ai provisioning into CI/CD pipelines.
Trigger with phrases like "vastai CI", "vastai github actions",
"vastai automated testing", "vastai pipeline".
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
Configure Vast.ai CI/CD integration with GitHub Actions and automated GPU testing.
Use when setting up automated testing on GPU instances,
or integrating Vast.ai provisioning into CI/CD pipelines.
Trigger with phrases like "vastai CI", "vastai github actions",
"vastai automated testing", "vastai pipeline".
allowed-tools
Read, Write, Edit, Bash(vastai:*), Grep
version
1.11.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
["saas","vast-ai","ci-cd"]
compatibility
Designed for Claude Code, also compatible with Codex and OpenClaw
Vast.ai CI Integration
Overview
Integrate Vast.ai GPU provisioning into CI/CD pipelines. Run GPU-accelerated tests, model validation, and benchmarks as part of your automated workflow using GitHub Actions with the Vast.ai CLI.
Prerequisites
GitHub repository with Actions enabled
VASTAI_API_KEY stored as GitHub Actions secret
Docker image for GPU workload published to a registry
# scripts/ci_gpu_test.py — wrapper with budget controlsimport subprocess, json, time, sys, os
MAX_COST = float(os.environ.get("CI_GPU_BUDGET", "1.00")) # $1 max per run
MAX_DURATION = int(os.environ.get("CI_GPU_TIMEOUT", "1800")) # 30 mindefci_gpu_test(test_command):
# Search for cheapest offer
offers = json.loads(subprocess.run(
["vastai", "search", "offers",
"num_gpus=1 gpu_ram>=8 reliability>0.90 dph_total<=0.20",
"--order", "dph_total", "--raw", "--limit", "1"],
capture_output=True, text=True, check=True).stdout)
ifnot offers:
print("No GPU offers available — skipping GPU tests")
return0
cost_per_hour = offers[0]["dph_total"]
max_hours = MAX_COST / cost_per_hour
print(f"GPU: {offers[0]['gpu_name']} at ${cost_per_hour:.3f}/hr "f"(budget allows {max_hours:.1f}hrs)")
# Provision, run, destroy (with timeout)# ... (use managed_instance pattern from sdk-patterns)
Step 3: Mock Mode for Non-GPU CI
# conftest.py — skip GPU tests when no API key availableimport pytest, os
defpytest_collection_modifyitems(config, items):
ifnot os.environ.get("VASTAI_API_KEY"):
skip_gpu = pytest.mark.skip(reason="VASTAI_API_KEY not set")
for item in items:
if"gpu"in item.keywords:
item.add_marker(skip_gpu)
Output
GitHub Actions workflow with GPU instance lifecycle