Skip to content
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
2 changes: 1 addition & 1 deletion .github/header-checker-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ ignoreFiles:
- ".github/sync-repo-settings.yaml"
- ".kokoro/**"
- "**/requirements.txt"
- "**/requirements-test.txt"
- "**/requirements*.txt"
6 changes: 5 additions & 1 deletion .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ branchProtectionRules:
requiredStatusCheckContexts:
- "cla/google"
- "lint"
- "integration-test-pr (langchain-redis-query-testing)"
- "integration-test-pr-py38 (langchain-redis-query-testing)"
- "integration-test-pr-py39 (langchain-redis-query-testing)"
- "integration-test-pr-py310 (langchain-redis-query-testing)"
- "integration-test-pr-py311 (langchain-redis-query-testing)"
- "integration-test-pr-py312 (langchain-redis-query-testing)"
- "conventionalcommits.org"
- "header-check"
# - Add required status checks like presubmit tests
Expand Down
79 changes: 79 additions & 0 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# DEVELOPER.md

## Versioning

This library follows [Semantic Versioning](http://semver.org/).

## Processes

### Conventional Commit messages

This repository uses tool [Release Please](https://github.com/googleapis/release-please) to create GitHub and PyPi releases. It does so by parsing your
git history, looking for [Conventional Commit messages](https://www.conventionalcommits.org/),
and creating release PRs.

Learn more by reading [How should I write my commits?](https://github.com/googleapis/release-please?tab=readme-ov-file#how-should-i-write-my-commits)

## Testing

### Run tests locally

1. Run pytest to automatically run all tests:

```bash
pytest
```

### CI Platform Setup

Cloud Build is used to run tests against Google Cloud resources in test project: langchain-redis-query-testing.
Each test has a corresponding Cloud Build trigger, see [all triggers][triggers].
These tests are registered as required tests in `.github/sync-repo-settings.yaml`.

#### Trigger Setup

Cloud Build triggers (for Python versions 3.8 to 3.11) were created with the following specs:

```YAML
name: integration-test-pr-py38
description: Run integration tests on PR for Python 3.8
filename: integration.cloudbuild.yaml
github:
name: langchain-google-memorystore-redis-python
owner: googleapis
pullRequest:
branch: .*
commentControl: COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY
ignoredFiles:
- docs/**
- .kokoro/**
- .github/**
- "*.md"
substitutions:
_VERSION: "3.8"
_WORKER_POOL: ""
_REDIS_URL: ""
```

Use `gcloud builds triggers import --source=trigger.yaml` create triggers via the command line

#### Project Setup

1. Create an Memorystore for Redis instance
1. Create a Cloud Build private worker pool
1. Setup Cloud Build triggers (above)

#### Run tests with Cloud Build

* Run integration test:

```bash
gcloud builds submit --config integration.cloudbuild.yaml --region us-central1 --substitutions=_WORKER_POOL="path-to-worker-pool",_REDIS_URL="redis://..."
```

#### Trigger

To run Cloud Build tests on GitHub from external contributors, ie RenovateBot, comment: `/gcbrun`.


[triggers]: https://console.cloud.google.com/cloud-build/triggers?e=13802955&project=langchain-redis-query-testing
22 changes: 15 additions & 7 deletions integration.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,30 @@

steps:
- id: Install dependencies
name: python:3.11
entrypoint: pip
args: ["install", "--user", "-r", "requirements.txt"]
name: python:${_VERSION}
entrypoint: /bin/bash
args:
- -c
- |
if [[ $_VERSION == "3.8" ]]; then version="-3.8"; fi
pip install --user -r requirements${version}.txt

- id: Install module (and test requirements)
name: python:3.11
name: python:${_VERSION}
entrypoint: pip
args: ["install", ".[test]", "--user"]

- id: Run integration tests
name: python:3.11
name: python:${_VERSION}
entrypoint: python
args: ["-m", "pytest"]
env:
- 'REDIS_URL=$_REDIS_URL'
- "REDIS_URL=$_REDIS_URL"

substitutions:
_VERSION: "3.8"

options:
pool:
name: '$_WORKER_POOL'
name: "$_WORKER_POOL"
dynamicSubstitutions: true
4 changes: 4 additions & 0 deletions requirements-3.8.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
langchain-core==0.1.32
langchain-community==0.0.28
redis==5.0.3
numpy==1.24.4