feat(cli): Add AI support to shiny add test
#46
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Validate Test Generation Prompts | |
| on: | |
| pull_request: | |
| paths: | |
| - "shiny/pytest/_generate/**" | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: true | |
| env: | |
| PYTHON_VERSION: "3.13" | |
| ATTEMPTS: 3 | |
| PYTHONUNBUFFERED: 1 | |
| jobs: | |
| validate-prompts: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Setup py-shiny | |
| id: install | |
| uses: ./.github/py-shiny/setup | |
| - name: Install Playwright Browsers | |
| run: | | |
| make install-playwright | |
| - name: Install Test Generator Dependencies | |
| run: | | |
| uv pip install -e ".[testgen]" | |
| - name: Run Evaluation and Tests 3 Times | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| PYTHONUNBUFFERED: 1 | |
| timeout-minutes: 25 | |
| run: ./tests/inspect-ai/scripts/run-test-evaluation.sh | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-${{ github.run_id }} | |
| path: | | |
| results/ | |
| retention-days: 7 | |
| - name: Process Results | |
| timeout-minutes: 2 | |
| run: | | |
| # Results are already averaged by the bash script, just verify they exist | |
| if [ ! -f "results/summary.json" ]; then | |
| echo "No averaged summary found at results/summary.json" | |
| ls -la results/ | |
| exit 1 | |
| else | |
| echo "Using averaged results from all attempts" | |
| cat results/summary.json | |
| fi | |
| - name: Check Quality Gate | |
| timeout-minutes: 2 | |
| run: | | |
| if [ ! -f "results/summary.json" ]; then | |
| echo "Summary file not found at results/summary.json" | |
| ls -la results/ | |
| exit 1 | |
| else | |
| echo "Found summary file, checking quality gate..." | |
| python tests/inspect-ai/utils/scripts/quality_gate.py results/ | |
| fi | |
| - name: Prepare Comment Body | |
| if: github.event_name == 'pull_request' | |
| timeout-minutes: 1 | |
| run: | | |
| python tests/inspect-ai/scripts/prepare_comment.py results/summary.json | |
| - name: Comment PR Results | |
| if: github.event_name == 'pull_request' | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| with: | |
| header: inspect-ai-results | |
| path: comment_body.txt |