Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
ci: Run tests using postgres docker container (#715)
Sarah Wooders545fc6cf79ce
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex 01967b269..80e5c674e 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -16,13 +16,17 @@ jobs:runs-on: ubuntu-latestenv:- PGVECTOR_TEST_DB_URL: ${{ secrets.PGVECTOR_TEST_DB_URL }}+ PGVECTOR_TEST_DB_URL: postgresql+pg8000://memgpt:memgpt@localhost:8888/memgptOPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}timeout-minutes: 5steps:- - uses: actions/checkout@v1+ - name: Checkout+ uses: actions/checkout@v2++ - name: Build and run container+ run: bash db/run_postgres.sh- name: Set up Pythonuses: actions/setup-python@v4@@ -39,14 +43,15 @@ jobs:- name: Install dependencies using Poetryenv:- PGVECTOR_TEST_DB_URL: ${{ secrets.PGVECTOR_TEST_DB_URL }}+ PGVECTOR_TEST_DB_URL: postgresql+pg8000://memgpt:memgpt@localhost:8888/memgpt+OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}run: |poetry install -E dev -E postgres -E local -E server- name: Set Poetry configenv:- PGVECTOR_TEST_DB_URL: ${{ secrets.PGVECTOR_TEST_DB_URL }}+ PGVECTOR_TEST_DB_URL: postgresql+pg8000://memgpt:memgpt@localhost:8888/memgptOPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}run: |poetry config virtualenvs.in-project false@@ -54,7 +59,7 @@ jobs:- name: Run tests with pytestenv:- PGVECTOR_TEST_DB_URL: ${{ secrets.PGVECTOR_TEST_DB_URL }}+ PGVECTOR_TEST_DB_URL: postgresql+pg8000://memgpt:memgpt@localhost:8888/memgptOPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}run: |- PGVECTOR_TEST_DB_URL=${{ secrets.PGVECTOR_TEST_DB_URL }} OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} poetry run pytest -s -vv tests+ PGVECTOR_TEST_DB_URL=postgresql+pg8000://memgpt:memgpt@localhost:8888/memgpt OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} poetry run pytest -s -vv testsdiff --git a/db/run_postgres.sh b/db/run_postgres.shnew file mode 100644index 000000000..650219381--- /dev/null+++ b/db/run_postgres.sh@@ -0,0 +1,10 @@+# build container+docker build -f db/Dockerfile.simple -t pg-test .++# run container+docker run -d --rm \+ --name memgpt-db-test \+ -p 8888:5432 \+ -e POSTGRES_PASSWORD=password \+ -v memgpt_db_test:/var/lib/postgresql/data \+ pg-test:latest