Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
2 parents 1045675 + 6f6e0f8 commit 7cf3515
Show file tree
Hide file tree
Showing 86 changed files with 3,081 additions and 333 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/on-pull-request-mvi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: On Pull Request

on:
pull_request:
branches: [main]

jobs:
test:
runs-on: macos-latest
strategy:
max-parallel: 2
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
new-python-protobuf: ["true"]
include:
- python-version: "3.7"
new-python-protobuf: "false"

env:
TEST_AUTH_TOKEN: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
TEST_CACHE_NAME: python-integration-test-${{ matrix.python-version }}-${{ matrix.new-python-protobuf }}-${{ github.sha }}
TEST_VECTOR_INDEX_NAME: python-integration-test-vector-${{ matrix.python-version }}-${{ matrix.new-python-protobuf }}-${{ github.sha }}

steps:
- uses: actions/checkout@v3

- name: Commitlint and Other Shared Build Steps
uses: momentohq/standards-and-practices/github-actions/shared-build@gh-actions-v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Bootstrap poetry
run: |
curl -sL https://install.python-poetry.org | python - -y --version 1.3.1
- name: Configure poetry
run: /Users/runner/.local/bin/poetry config virtualenvs.in-project true

- name: Install dependencies
run: /Users/runner/.local/bin/poetry install

- name: Install Old Protobuf
# Exercises the wire types generated against the old protobuf library
if: matrix.new-python-protobuf == 'false'
run: /Users/runner/.local/bin/poetry add "protobuf<3.20"

- name: Run mypy
# mypy has inconsistencies between 3.7 and the rest; default to lowest common denominator
if: matrix.python-version == '3.7'
run: /Users/runner/.local/bin/poetry run mypy src tests

- name: Run flake8
run: /Users/runner/.local/bin/poetry run flake8 src tests

- name: Run black
run: /Users/runner/.local/bin/poetry run black src tests --check --diff

- name: Run isort
run: /Users/runner/.local/bin/poetry run isort . --check --diff

- name: Run tests
run: /Users/runner/.local/bin/poetry run pytest tests/momento/vector_index_client -p no:sugar -q
4 changes: 3 additions & 1 deletion .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ jobs:
include:
- python-version: "3.7"
new-python-protobuf: "false"

env:
TEST_AUTH_TOKEN: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
TEST_CACHE_NAME: python-integration-test-${{ matrix.python-version }}-${{ matrix.new-python-protobuf }}-${{ github.sha }}
TEST_VECTOR_INDEX_NAME: python-integration-test-vector-${{ matrix.python-version }}-${{ matrix.new-python-protobuf }}-${{ github.sha }}

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -61,7 +63,7 @@ jobs:
run: poetry run isort . --check --diff

- name: Run tests
run: poetry run pytest -p no:sugar -q
run: poetry run pytest -p no:sugar -q --ignore=tests/momento/vector_index_client

test-examples:
runs-on: ubuntu-20.04
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/on-push-to-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ jobs:
env:
TEST_AUTH_TOKEN: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
TEST_CACHE_NAME: python-integration-test-${{ matrix.python-version }}-${{ matrix.new-python-protobuf }}-${{ github.sha }}
TEST_VECTOR_INDEX_NAME: python-integration-test-vector-${{ matrix.python-version }}-${{ matrix.new-python-protobuf }}-${{ github.sha }}


steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -79,7 +82,7 @@ jobs:
run: poetry run isort . --check --diff

- name: Run tests
run: poetry run pytest -p no:sugar -q
run: poetry run pytest -p no:sugar -q --ignore=tests/momento/vector_index_client

publish:
runs-on: ubuntu-20.04
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ dist/
momento-examples-env/

*.egg-info
build
build
certs
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ lint:
do-gen-sync:
@poetry run python src/momento/internal/codegen.py src/momento/internal/aio/_scs_control_client.py src/momento/internal/synchronous/_scs_control_client.py
@poetry run python src/momento/internal/codegen.py src/momento/internal/aio/_scs_data_client.py src/momento/internal/synchronous/_scs_data_client.py
@poetry run python src/momento/internal/codegen.py src/momento/internal/aio/_vector_index_control_client.py src/momento/internal/synchronous/_vector_index_control_client.py
@poetry run python src/momento/internal/codegen.py src/momento/internal/aio/_vector_index_data_client.py src/momento/internal/synchronous/_vector_index_data_client.py
@poetry run python src/momento/internal/codegen.py src/momento/cache_client_async.py src/momento/cache_client.py
@poetry run python src/momento/internal/codegen.py src/momento/vector_index_client_async.py src/momento/vector_index_client.py
@poetry run python src/momento/internal/codegen.py tests/momento/cache_client/shared_behaviors_async.py tests/momento/cache_client/shared_behaviors.py
@poetry run python src/momento/internal/codegen.py tests/momento/cache_client/test_init_async.py tests/momento/cache_client/test_init.py
@poetry run python src/momento/internal/codegen.py tests/momento/cache_client/test_control_async.py tests/momento/cache_client/test_control.py
Expand All @@ -38,6 +41,8 @@ do-gen-sync:
@poetry run python src/momento/internal/codegen.py tests/momento/cache_client/test_set_async.py tests/momento/cache_client/test_set.py
@poetry run python src/momento/internal/codegen.py tests/momento/cache_client/test_sorted_set_async.py tests/momento/cache_client/test_sorted_set.py
@poetry run python src/momento/internal/codegen.py tests/momento/cache_client/test_sorted_set_simple_async.py tests/momento/cache_client/test_sorted_set_simple.py
@poetry run python src/momento/internal/codegen.py tests/momento/vector_index_client/test_control_async.py tests/momento/vector_index_client/test_control.py
@poetry run python src/momento/internal/codegen.py tests/momento/vector_index_client/test_data_async.py tests/momento/vector_index_client/test_data.py

.PHONY: gen-sync
## Generate synchronous code and tests from asynchronous code.
Expand Down
2 changes: 1 addition & 1 deletion examples/lambda/docker/lambda/aws_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
momento==1.7.1
momento==1.8.0
4 changes: 2 additions & 2 deletions examples/lambda/docker/lambda/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

def handler(event, lambda_context):
cache_name = "default-cache"
with CacheClient(
configuration=Configurations.Laptop.v1(),
with CacheClient.create(
configuration=Configurations.Lambda.latest(),
credential_provider=CredentialProvider.from_environment_variable("MOMENTO_AUTH_TOKEN"),
default_ttl=timedelta(seconds=60),
) as cache_client:
Expand Down
Loading

0 comments on commit 7cf3515

Please sign in to comment.