Skip to content
Merged
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
87 changes: 87 additions & 0 deletions .github/workflows/cli-compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: CLI Compatibility Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
CLI-Compatibility:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
typer-version: ["0.16.0", "0.17.0", "0.18.0", "0.19.2"]
click-version: ["8.1.0", "8.2.0"]
exclude:
- python-version: "3.9"
click-version: "8.2.0"
- 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
if [ "${{ matrix.python-version }}" == "3.9" ]; then
pip install .[dev]
else
poetry install --extras dev
fi

# 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
Loading
Loading