Merge pull request #1084 from confident-ai/release-v1.3.9 #54
This file contains 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: DeepEval Test Run with Enhanced Configuration | |
on: | |
push: | |
pull_request: | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
# - name: Load cached venv | |
# id: cached-poetry-dependencies | |
# uses: actions/cache@v3 | |
# with: | |
# path: .venv | |
# key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction | |
- name: List Installed Packages | |
run: poetry run pip list | |
- name: Check if 'deepeval' script is available | |
run: ls -l $(poetry env info --path)/bin/deepeval || echo "deepeval script not found" | |
- name: Run deepeval login | |
env: | |
CONFIDENT_API_KEY: ${{ secrets.CONFIDENT_API_KEY }} | |
run: poetry run deepeval login --confident-api-key "$CONFIDENT_API_KEY" | |
- name: Run deepeval tests and capture output | |
run: poetry run deepeval test run tests/test_deployment.py > output.txt 2>&1 | |
- name: Display output.txt | |
if: always() | |
run: cat output.txt | |
- name: Remove ANSI codes from output | |
run: sed -i -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" output.txt | |
- name: Save test results to environment variable | |
run: echo "test_result<<EOF" >> $GITHUB_ENV && cat output.txt >> $GITHUB_ENV && echo "EOF" >> $GITHUB_ENV |