Skip to content

fix(cli): resolve .pub file paths in create ssh-key #473

fix(cli): resolve .pub file paths in create ssh-key

fix(cli): resolve .pub file paths in create ssh-key #473

# .github/workflows/vast-sdk-testing.yml
name: Vast SDK Testing
on:
pull_request:
# Optional, but explicitly define the types of pull requests that should trigger the workflow.
types: [opened, synchronize, reopened, ready_for_review]
# Optional: limit what changes trigger it
# paths:
# - "**/*.py"
# - "pyproject.toml"
# paths-ignore:
# - "docs/**"
# Auto-cancel older runs for the same PR. This is important to prevent the same PR from being tested multiple times.
concurrency:
group: vast-sdk-testing-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
# --------------------------------------------------------------------------
# Detect Changes
# --------------------------------------------------------------------------
detect-changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
serverless: ${{ steps.filter.outputs.serverless }}
sdk: ${{ steps.filter.outputs.sdk }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
serverless:
- 'vastai/serverless/**'
- 'tests/serverless/**'
sdk:
- 'vastai/**'
- 'tests/cli/**'
- 'tests/api/**'
- 'tests/sdk/**'
# The docs-generation scripts and their tests. Without these two,
# a scripts-only PR filters the job out entirely and tests/scripts
# never runs.
- 'scripts/**'
- 'tests/scripts/**'
# --------------------------------------------------------------------------
# Unit & Integration Tests
# --------------------------------------------------------------------------
unit-and-integration:
needs: detect-changes
if: needs.detect-changes.outputs.sdk == 'true'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Poetry and plugins
# snok/install-poetry works on Windows/macOS/Linux; the curl-pipe-python3
# bootstrap does not (no python3 alias on Windows runners).
uses: snok/install-poetry@v1
with:
version: "1.8.3"
virtualenvs-create: true
virtualenvs-in-project: false
# snok/install-poetry adds Poetry to PATH, but PowerShell on Windows
# runners does not pick up the update, so subsequent pwsh steps fail
# with "poetry: not recognized". Force bash (works on all 3 OSes).
- name: Install poetry-dynamic-versioning plugin
shell: bash
run: poetry self add "poetry-dynamic-versioning[plugin]"
- name: Install test dependencies
shell: bash
working-directory: tests
run: poetry install --no-interaction
- name: Run CLI, API, SDK, and docs-script tests
shell: bash
working-directory: tests
run: poetry run pytest -vvv -s --tb=short cli api sdk scripts
# --------------------------------------------------------------------------
# Branch protection requires a check literally named `unit-and-integration`,
# but the matrix above produces `unit-and-integration (ubuntu-latest)` etc.,
# not the bare name. This aggregator reports the bare name to satisfy the
# rule. Treats `skipped` as passing so the rule is also satisfied when
# detect-changes filters this job out.
# --------------------------------------------------------------------------
unit-and-integration-check:
name: unit-and-integration
needs: unit-and-integration
if: always()
runs-on: ubuntu-latest
steps:
- name: Aggregate matrix result
run: |
result="${{ needs.unit-and-integration.result }}"
if [ "$result" != "success" ] && [ "$result" != "skipped" ]; then
echo "Matrix job did not succeed (result=$result)"
exit 1
fi
# --------------------------------------------------------------------------
# Install Smoke (package installs + CLI entrypoint runs)
# --------------------------------------------------------------------------
# Catches packaging bugs (wheel missing files, entry-point misregistered,
# broken pyproject config) that unit tests don't, because the unit tests
# import the source tree directly rather than the installed package.
install-smoke:
needs: detect-changes
if: needs.detect-changes.outputs.sdk == 'true'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install package
env:
POETRY_DYNAMIC_VERSIONING_BYPASS: "0.0.0"
run: pip install .
- name: Invoke CLI entrypoint
run: vastai --help
# --------------------------------------------------------------------------
# Serverless Tests
# --------------------------------------------------------------------------
serverless-testing:
needs: detect-changes
if: needs.detect-changes.outputs.serverless == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Poetry and plugins
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry self add "poetry-dynamic-versioning[plugin]"
- name: Install test dependencies
run: poetry install -C tests --no-interaction
- name: Run serverless tests
run: poetry run -C tests pytest -vvv -s --tb=short --log-cli-level=INFO serverless