Skip to content

Implemented BLEU score, wrote unit tests and documentation for it. #15

Implemented BLEU score, wrote unit tests and documentation for it.

Implemented BLEU score, wrote unit tests and documentation for it. #15

name: Documentation - Test codeblocks
on:
workflow_dispatch:
inputs:
install_opik:
description: 'Enable opik installation from source files'
required: false
default: 'false'
type: choice
options:
- 'false'
- 'true'
pull_request:
paths:
- 'apps/opik-documentation/documentation/docs/*.md'
- 'apps/opik-documentation/documentation/docs/*.mdx'
- 'apps/opik-documentation/documentation/docs/**/*.md'
- 'apps/opik-documentation/documentation/docs/**/*.mdx'
jobs:
collect_test_paths:
runs-on: ubuntu-latest
outputs:
test_paths: ${{ steps.paths.outputs.paths }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for git diff
- id: paths
working-directory: apps/opik-documentation/documentation
run: |
# Get list of changed files in docs directory
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
# For pull requests, compare with base branch
echo "paths=$(
git diff --name-only origin/${{ github.base_ref }} |
grep -E '^apps/opik-documentation/documentation/docs/.*\.(md|mdx)$' |
sed 's|apps/opik-documentation/documentation/||' |
jq -R -s -c 'split("\n")[:-1]'
)" >> $GITHUB_OUTPUT
else
# For manual runs and scheduled runs, check all files
echo "paths=$(
(
ls -d docs/*/ 2>/dev/null;
find docs -maxdepth 1 -type f -name "*.md" -o -name "*.mdx"
) | jq -R -s -c 'split("\n")[:-1]'
)" >> $GITHUB_OUTPUT
fi
test:
needs: collect_test_paths
runs-on: ubuntu-latest
env:
OPENAI_API_KEY: ${{ secrets.DOCS_OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
OPIK_WORKSPACE: ${{ secrets.COMET_WORKSPACE }}
OPIK_API_KEY: ${{ secrets.COMET_API_KEY }}
strategy:
matrix:
path: ${{ fromJson(needs.collect_test_paths.outputs.test_paths) }}
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
working-directory: apps/opik-documentation/documentation
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -r requirements.txt
if [ "${{ github.event.inputs.install_opik }}" = "true" ]; then
pip install -e .
fi
- name: Run tests
working-directory: apps/opik-documentation/documentation
run: |
if [ -n "${{ matrix.path }}" ]; then
pytest ${{ matrix.path }} -v --suppress-no-test-exit-code
fi