Skip to content

Commit

Permalink
Merge pull request #19 from flepied/tests
Browse files Browse the repository at this point in the history
add integration tests to the run-tests Github action
  • Loading branch information
flepied authored Aug 23, 2023
2 parents 6040680 + a35543b commit 9068272
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 9 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
types: [opened, synchronize, reopened]
jobs:

validate-tests:
run-tests:
runs-on: ubuntu-latest
steps:

Expand All @@ -23,8 +23,14 @@ jobs:
set -ex
curl -sSL https://install.python-poetry.org | python3 -
poetry install --with test
poetry run pip3 install torch
poetry run pre-commit run -a --show-diff-on-failure
- name: Run integration tests
run: |
set -ex
./integration-test.sh
check-all-dependencies-are-merged:
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ repos:
- id: pytest-check
name: Pytest checks
entry: poetry run pytest
language: system
language: python
pass_filenames: false
always_run: true
files: ".*\\.py$"

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
Expand Down
16 changes: 11 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ SHELL := /bin/bash
all: compose.yaml

compose.yaml: poetry.lock
VER=$$(poetry run pip freeze|grep chromadb==|sed "s/.*==//") \
&& poetry run pip freeze|grep chromadb \
&& test -n "$$VER" \
&& echo $$VER _
&& sed -i -e "[email protected]/chroma-core/chroma:.*@ghcr.io/chroma-core/chroma:$$VER@" compose.yaml
set -x && \
. .venv/bin/activate && \
VER=$$(pip3 freeze|grep chromadb==|sed "s/.*==//") && \
pip3 freeze && \
test -n "$$VER" && \
echo "$$VER" && \
sed -i -e "[email protected]/chroma-core/chroma:.*@ghcr.io/chroma-core/chroma:$$VER@" compose.yaml

poetry.lock: pyproject.toml
poetry lock --no-update
touch poetry.lock
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The second brain agent is using the vector database to answer questions about yo

## Installation

You need a Python interpreter. All this has been tested with Python 3.11 under Fedora Linux 38. Let me know if it work for you on your system.
You need a Python 3 interpreter and the `inotify-tools` installed. All this has been tested with Python 3.11 under Fedora Linux 38. Let me know if it work for you on your system.

Get the source code:

Expand Down
45 changes: 45 additions & 0 deletions integration-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

set -ex

sudo apt-get install inotify-tools

mkdir $HOME/.second-brain $HOME/Notes

cat > .env <<EOF
SRCDIR=$HOME/Notes
DSTDIR=$HOME/.second-brain
EOF

bash -x ./install-systemd-services.sh

cat > $HOME/Notes/langchain.md <<EOF
## References
- https://docs.langchain.com/docs/
- https://github.com/kyrolabs/awesome-langchain
Plan-and-Solve Prompting: Improving Zero-Shot
Chain-of-Thought Reasoning by Large Language Models
https://arxiv.org/pdf/2305.04091.pdf
EOF

TRY=0
docker-compose ps
while [ $TRY -lt 24 ]; do
TRY=$(( TRY + 1 ))
if docker-compose logs | grep -q "Application startup complete"; then
break
fi
docker-compose logs
sleep 5
done

sudo journalctl -u sba-md
sudo journalctl -u sba-txt

RES=$(poetry run ./similarity.py "What is langchain?")
echo "$RES"
test -n "$RES"

# integration-test.sh ends here
21 changes: 20 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ unstructured = "*"
youtube-transcript-api = "*"
yt-dlp = "*"
pydub = "*"
markdown = "*"
# workarounds for streamlit dependencies
altair = "<5"
protobuf = "~=3.19.0"
Expand Down

0 comments on commit 9068272

Please sign in to comment.