aboutsummaryrefslogtreecommitdiff
path: root/R2R/.github/workflows/ci.yml
diff options
context:
space:
mode:
Diffstat (limited to 'R2R/.github/workflows/ci.yml')
-rwxr-xr-xR2R/.github/workflows/ci.yml85
1 files changed, 85 insertions, 0 deletions
diff --git a/R2R/.github/workflows/ci.yml b/R2R/.github/workflows/ci.yml
new file mode 100755
index 00000000..d24bf06e
--- /dev/null
+++ b/R2R/.github/workflows/ci.yml
@@ -0,0 +1,85 @@
+name: CI
+
+on:
+ push:
+ branches:
+ - main
+ - '**/feature/*'
+ pull_request:
+ branches:
+ - main
+
+jobs:
+ pre-commit:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v3
+
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.12.4' # Specify your Python version here
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install poetry
+ poetry install
+
+ - name: Install pre-commit
+ run: poetry run pre-commit install
+
+ - name: Run pre-commit
+ run: poetry run pre-commit run --all-files
+
+ pytest:
+ runs-on: ubuntu-latest
+ timeout-minutes: 15 # Increased timeout to accommodate Ollama setup
+
+ env:
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
+ POSTGRES_DBNAME: ${{ secrets.POSTGRES_DBNAME }}
+ POSTGRES_HOST: ${{ secrets.POSTGRES_HOST }}
+ POSTGRES_PORT: ${{ secrets.POSTGRES_PORT }}
+ POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
+ POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
+ POSTGRES_VECS_COLLECTION: ${{ secrets.POSTGRES_VECS_COLLECTION }}
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v3
+
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.12.4'
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install poetry
+ poetry install
+
+ - name: Install Ollama
+ run: |
+ curl -fsSL https://ollama.com/install.sh | sudo -E sh
+
+ - name: Start Ollama server
+ run: |
+ ollama serve &
+ sleep 5
+ curl -i http://localhost:11434
+
+ - name: Pull Ollama model
+ run: |
+ ollama pull llama2
+
+ - name: Run tests
+ run: poetry run pytest tests/ -k "not redis and not sentence_transformer"
+
+ - name: Upload coverage reports to Codecov
+ uses: codecov/codecov-action@v4.0.1
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}