Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci[patch]: fix Unit Tests (LangChain Integrations) Skipping Test Jobs #5914

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/unit-tests-integrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ on:
paths:
- 'langchain-core/**'
- 'libs/**/**'
workflow_dispatch: # Allows triggering the workflow manually in GitHub UI

workflow_dispatch: # Allows triggering the workflow manually in GitHub UI

# If another push to the same PR or branch happens while this workflow is still running,
# cancel the earlier run in favor of the next run.
Expand Down Expand Up @@ -48,6 +47,7 @@ jobs:
PACKAGES: "anthropic,azure-openai,cloudflare,cohere,core,community,exa,google-common,google-gauth,google-genai,google-vertexai,google-vertexai-web,google-webauth,groq,mistralai,mongo,nomic,openai,pinecone,qdrant,redis,textsplitters,weaviate,yandex,baidu-qianfan"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
matrix_length: ${{ steps.set-matrix.outputs.matrix_length }}
steps:
- id: set-matrix
run: |
Expand All @@ -71,14 +71,17 @@ jobs:
fi
done
matrix="$matrix]}"
matrix_length=$(echo $matrix | jq '.include | length')
echo "Matrix: $matrix"
echo "Matrix length: $matrix_length"
echo "matrix_length=$matrix_length" >> $GITHUB_OUTPUT
echo "matrix=$matrix" >> $GITHUB_OUTPUT

unit-tests:
name: Unit Tests
needs: prepare-matrix
# Only run this job if there are packages to test
if: ${{ fromJson(needs.prepare-matrix.outputs.matrix).include.length != 0 }}
if: needs.prepare-matrix.outputs.matrix_length > 0
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }}
Expand Down
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,15 @@ To make creating packages like this easier, we offer the [`create-langchain-inte
$ npx create-langchain-integration
```

After creating the new integration package, you should add it to the [`unit-tests-integrations.yml`](./.github/workflows/unit-tests-integrations.yml) GitHub action workflow so that it is tested in CI. To do this, simply add the integration name inside the `jobs.unit-tests.strategy.matrix.package` array:
After creating the new integration package, you should add it to the [`unit-tests-integrations.yml`](./.github/workflows/unit-tests-integrations.yml) GitHub action workflow so that it is tested in CI. To do this,simply update the `env` section of the `prepare-matrix` job with your package name inside the `PACKAGES` variable:

```yaml
jobs:
unit-tests:
name: Unit Tests
strategy:
matrix:
package: [anthropic, azure-openai, cloudflare, <your package name>]
...
prepare-matrix:
needs: get-changed-files
runs-on: ubuntu-latest
env:
PACKAGES: "anthropic,azure-openai,cloudflare,<your-package>"
...
```

### Want to add a feature that's already in Python?
Expand Down Expand Up @@ -159,6 +158,7 @@ cd libs/langchain-community
```

### Setup

**Prerequisite**: Node version 18+ is required. Please check node version `node -v` and update it if required.

To get started, you will need to install the dependencies for the project. To do so, run:
Expand Down
Loading