fix(python): Rework trajectory evals #43
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: Integration Tests CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
changed_files: | |
runs-on: ubuntu-latest | |
outputs: | |
python_changed: ${{ steps.check-changes.outputs.python_changed }} | |
js_changed: ${{ steps.check-changes.outputs.js_changed }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Required for diff with main branch | |
- name: Check for file changes | |
id: check-changes | |
run: | | |
if git diff --name-only origin/main HEAD | grep -E "^python/.*\.py$"; then | |
echo "python_changed=true" >> $GITHUB_OUTPUT | |
else | |
echo "python_changed=false" >> $GITHUB_OUTPUT | |
fi | |
if git diff --name-only origin/main HEAD | grep -E "^js/.*\.(js|ts|jsx|tsx)$"; then | |
echo "js_changed=true" >> $GITHUB_OUTPUT | |
else | |
echo "js_changed=false" >> $GITHUB_OUTPUT | |
fi | |
python_integration_test: | |
name: Python Integration Test | |
needs: changed_files | |
if: > | |
(github.event_name == 'push') || | |
(github.event_name == 'pull_request' && ( | |
contains(github.event.pull_request.labels.*.name, 'release') || | |
needs.changed_files.outputs.python_changed == 'true' | |
)) || | |
(github.event_name == 'workflow_dispatch' && github.event.inputs.run-python-tests == 'true') | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
working-directory: python | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
version: "0.6.2" | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: "./python/.python-version" | |
- name: Install dependencies | |
run: | | |
uv venv | |
source .venv/bin/activate | |
uv sync | |
uv sync --group dev | |
shell: bash | |
working-directory: python | |
- name: Run integration tests | |
env: | |
LANGSMITH_TRACING: "true" | |
LANGSMITH_API_KEY: ${{ secrets.LANGSMITH_API_KEY }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
run: uv run pytest tests | |
shell: bash | |
working-directory: python | |
js_integration_test: | |
name: JS Integration Test | |
needs: changed_files | |
if: > | |
(github.event_name == 'push') || | |
(github.event_name == 'pull_request' && ( | |
contains(github.event.pull_request.labels.*.name, 'release') || | |
needs.changed_files.outputs.js_changed == 'true' | |
)) || | |
(github.event_name == 'workflow_dispatch' && github.event.inputs.run-js-tests == 'true') | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
working-directory: js | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
cache: "yarn" | |
cache-dependency-path: "js/yarn.lock" | |
- name: Install Yarn dependencies | |
run: yarn install | |
shell: bash | |
working-directory: js | |
- name: Run JS integration tests | |
env: | |
LANGSMITH_TRACING: "true" | |
LANGSMITH_API_KEY: ${{ secrets.LANGSMITH_API_KEY }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
run: yarn test src/trajectory/tests src/graph_trajectory/tests | |
shell: bash | |
working-directory: js |