|  | 
|  | 1 | +# DEVELOPER.md | 
|  | 2 | + | 
|  | 3 | +## Versioning | 
|  | 4 | + | 
|  | 5 | +This library follows [Semantic Versioning](http://semver.org/). | 
|  | 6 | + | 
|  | 7 | +## Processes | 
|  | 8 | + | 
|  | 9 | +### Conventional Commit messages | 
|  | 10 | + | 
|  | 11 | +This repository uses tool [Release Please](https://github.com/googleapis/release-please) to create GitHub and PyPi releases. It does so by parsing your | 
|  | 12 | +git history, looking for [Conventional Commit messages](https://www.conventionalcommits.org/), | 
|  | 13 | +and creating release PRs. | 
|  | 14 | + | 
|  | 15 | +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) | 
|  | 16 | + | 
|  | 17 | +## Testing | 
|  | 18 | + | 
|  | 19 | +### Run tests locally | 
|  | 20 | + | 
|  | 21 | +1. Run pytest to automatically run all tests: | 
|  | 22 | + | 
|  | 23 | +    ```bash | 
|  | 24 | +    pytest | 
|  | 25 | +    ``` | 
|  | 26 | + | 
|  | 27 | +### CI Platform Setup | 
|  | 28 | + | 
|  | 29 | +Cloud Build is used to run tests against Google Cloud resources in test project: langchain-redis-query-testing. | 
|  | 30 | +Each test has a corresponding Cloud Build trigger, see [all triggers][triggers]. | 
|  | 31 | +These tests are registered as required tests in `.github/sync-repo-settings.yaml`. | 
|  | 32 | + | 
|  | 33 | +#### Trigger Setup | 
|  | 34 | + | 
|  | 35 | +Cloud Build triggers (for Python versions 3.8 to 3.11) were created with the following specs: | 
|  | 36 | + | 
|  | 37 | +```YAML | 
|  | 38 | +name: integration-test-pr-py38 | 
|  | 39 | +description: Run integration tests on PR for Python 3.8 | 
|  | 40 | +filename: integration.cloudbuild.yaml | 
|  | 41 | +github: | 
|  | 42 | +  name: langchain-google-memorystore-redis-python | 
|  | 43 | +  owner: googleapis | 
|  | 44 | +  pullRequest: | 
|  | 45 | +    branch: .* | 
|  | 46 | +    commentControl: COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY | 
|  | 47 | +ignoredFiles: | 
|  | 48 | +  - docs/** | 
|  | 49 | +  - .kokoro/** | 
|  | 50 | +  - .github/** | 
|  | 51 | +  - "*.md" | 
|  | 52 | +substitutions: | 
|  | 53 | +  _VERSION: "3.8" | 
|  | 54 | +  _WORKER_POOL: "" | 
|  | 55 | +  _REDIS_URL: "" | 
|  | 56 | +``` | 
|  | 57 | + | 
|  | 58 | +Use `gcloud builds triggers import --source=trigger.yaml` create triggers via the command line | 
|  | 59 | + | 
|  | 60 | +#### Project Setup | 
|  | 61 | + | 
|  | 62 | +1. Create an Memorystore for Redis instance | 
|  | 63 | +1. Create a Cloud Build private worker pool | 
|  | 64 | +1. Setup Cloud Build triggers (above) | 
|  | 65 | + | 
|  | 66 | +#### Run tests with Cloud Build | 
|  | 67 | + | 
|  | 68 | +* Run integration test: | 
|  | 69 | + | 
|  | 70 | +    ```bash | 
|  | 71 | +    gcloud builds submit --config integration.cloudbuild.yaml --region us-central1 --substitutions=_WORKER_POOL="path-to-worker-pool",_REDIS_URL="redis://..." | 
|  | 72 | +    ``` | 
|  | 73 | + | 
|  | 74 | +#### Trigger | 
|  | 75 | + | 
|  | 76 | +To run Cloud Build tests on GitHub from external contributors, ie RenovateBot, comment: `/gcbrun`. | 
|  | 77 | + | 
|  | 78 | + | 
|  | 79 | +[triggers]: https://console.cloud.google.com/cloud-build/triggers?e=13802955&project=langchain-redis-query-testing | 
0 commit comments