참고소스 수정본
This commit is contained in:
83
참고/guardrails-main/.github/workflows/cli-compatibility.yml
vendored
Normal file
83
참고/guardrails-main/.github/workflows/cli-compatibility.yml
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
name: CLI Compatibility Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
paths:
|
||||
- guardrails/**
|
||||
- pyproject.toml
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
CLI-Compatibility:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
||||
typer-version: ["0.16.0", "0.17.0", "0.18.0", "0.19.2"]
|
||||
click-version: ["8.1.0", "8.2.0"]
|
||||
exclude:
|
||||
- typer-version: "0.16.0"
|
||||
click-version: "8.2.0"
|
||||
- typer-version: "0.16.0"
|
||||
click-version: "8.2.1"
|
||||
- typer-version: "0.16.0"
|
||||
click-version: "8.3.0"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install Poetry
|
||||
uses: snok/install-poetry@v1
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
# Setup Virtual Environment
|
||||
python3 -m venv ./.venv
|
||||
source .venv/bin/activate
|
||||
|
||||
# Install dev dependencies
|
||||
poetry install --extras dev
|
||||
|
||||
# Install specific typer and click versions
|
||||
pip install typer==${{ matrix.typer-version }} click==${{ matrix.click-version }}
|
||||
|
||||
- name: Test CLI Commands
|
||||
run: |
|
||||
source .venv/bin/activate
|
||||
|
||||
# Test basic CLI help
|
||||
guardrails --help
|
||||
|
||||
# Test validate command help
|
||||
guardrails validate --help
|
||||
|
||||
# Test hub command help
|
||||
guardrails hub --help
|
||||
|
||||
# Test configure command help
|
||||
guardrails configure --help
|
||||
|
||||
# Test hub list command (end-to-end)
|
||||
guardrails hub list
|
||||
|
||||
# Create a simple RAIL spec for testing validate command
|
||||
cat > test_spec.rail << 'EOF'
|
||||
<rail version="0.1">
|
||||
<output>
|
||||
<string name="answer" description="A simple answer"/>
|
||||
</output>
|
||||
<prompt>
|
||||
Answer the question: What is 2+2?
|
||||
</prompt>
|
||||
</rail>
|
||||
EOF
|
||||
|
||||
# Test validate command end-to-end with the RAIL spec
|
||||
echo '{"answer": "4"}' | guardrails validate test_spec.rail -
|
||||
|
||||
# Clean up
|
||||
rm test_spec.rail
|
||||
Reference in New Issue
Block a user