Skip to content

Commit

Permalink
infra: configurable scheduled tests
Browse files Browse the repository at this point in the history
  • Loading branch information
efriis committed Dec 3, 2024
1 parent 926e452 commit 4d789b2
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 13 deletions.
59 changes: 47 additions & 12 deletions .github/workflows/scheduled_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,67 @@ name: Scheduled tests

on:
workflow_dispatch: # Allows to trigger the workflow manually in GitHub UI
inputs:
working-directory-force:
type: string
description: "From which folder this pipeline executes - defaults to all in matrix"
python-version-force:
type: string
description: "Python version to use - defaults to 3.9 and 3.11 in matrix"
schedule:
- cron: '0 13 * * *'

env:
POETRY_VERSION: "1.8.4"
DEFAULT_LIBS: >
[
"libs/partners/openai",
"libs/partners/anthropic",
"libs/partners/fireworks",
"libs/partners/groq",
"libs/partners/mistralai",
"libs/partners/google-vertexai",
"libs/partners/google-genai",
"libs/partners/aws"
]
jobs:
compute-matrix:
if: github.repository_owner == 'langchain-ai' || github.event_name != 'schedule'
runs-on: ubuntu-latest
name: Compute matrix
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Set matrix
id: set-matrix
env:
DEFAULT_LIBS: ${{ env.DEFAULT_LIBS }}
WORKING_DIRECTORY_FORCE: ${{ github.event.inputs.working-directory-force || '' }}
PYTHON_VERSION_FORCE: ${{ github.event.inputs.python-version-force || '' }}
run: |
# echo "matrix=..." where matrix is a json formatted str with keys python-version and working-directory
# python-version should default to 3.9 and 3.11, but is overridden to [PYTHON_VERSION_FORCE] if set
# working-directory should default to DEFAULT_LIBS, but is overridden to [WORKING_DIRECTORY_FORCE] if set
python_version='["3.9", "3.11"]'
working_directory="$DEFAULT_LIBS"
if [ -n "$PYTHON_VERSION_FORCE" ]; then
python_version="[$PYTHON_VERSION_FORCE]"
fi
if [ -n "$WORKING_DIRECTORY_FORCE" ]; then
working_directory="[$WORKING_DIRECTORY_FORCE]"
fi
echo 'matrix={"python-version": $python_version, "working-directory": $working_directory}' >> $GITHUB_OUTPUT
build:
if: github.repository_owner == 'langchain-ai' || github.event_name != 'schedule'
name: Python ${{ matrix.python-version }} - ${{ matrix.working-directory }}
runs-on: ubuntu-latest
needs: [compute-matrix]
strategy:
fail-fast: false
matrix:
python-version:
- "3.9"
- "3.11"
working-directory:
- "libs/partners/openai"
- "libs/partners/anthropic"
- "libs/partners/fireworks"
- "libs/partners/groq"
- "libs/partners/mistralai"
- "libs/partners/google-vertexai"
- "libs/partners/google-genai"
- "libs/partners/aws"
python-version: ${{ fromJSON(needs.compute-matrix.outputs.matrix).python-version }}
working-directory: ${{ fromJSON(needs.compute-matrix.outputs.matrix).working-directory }}

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion libs/partners/anthropic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ TEST_FILE ?= tests/unit_tests/
integration_test integration_tests: TEST_FILE=tests/integration_tests/

test tests integration_test integration_tests:
poetry run pytest $(TEST_FILE)
poetry run pytest -vvv $(TEST_FILE)

test_watch:
poetry run ptw --snapshot-update --now . -- -vv $(TEST_FILE)
Expand Down

0 comments on commit 4d789b2

Please sign in to comment.