Introduce Integration Tests #15
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: R2R Docker Build and Integration Test | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build-and-test: | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Upgrade pip and install R2R | |
run: | | |
pip3 install --upgrade pip | |
pip3 install --upgrade r2r | |
- name: Build R2R Docker image | |
run: | | |
docker build -t emrgntcmplxty/r2r:${{ github.sha }} . | |
- name: Build R2R Docker image | |
run: | | |
docker build \ | |
--build-arg GITHUB_SHA=${{ github.sha }} \ | |
--build-arg GITHUB_REF=${{ github.ref }} \ | |
-t emrgntcmplxty/r2r:${{ github.sha }} . | |
- name: Pull pgvector image | |
run: docker pull pgvector/pgvector:pg16 | |
- name: Create Docker network | |
run: docker network create r2r-network | |
- name: Start Postgres | |
run: | | |
docker run -d --name postgres --network r2r-network \ | |
-e POSTGRES_USER=postgres \ | |
-e POSTGRES_PASSWORD=postgres \ | |
-e POSTGRES_DB=postgres \ | |
pgvector/pgvector:pg16 | |
- name: Start R2R and capture logs | |
run: | | |
docker run -d --name r2r --network r2r-network \ | |
-e PYTHONUNBUFFERED=1 \ | |
-e OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} \ | |
-e POSTGRES_USER=postgres \ | |
-e POSTGRES_PASSWORD=postgres \ | |
-e POSTGRES_HOST=postgres \ | |
-e POSTGRES_PORT=5432 \ | |
-e POSTGRES_DBNAME=postgres \ | |
-e POSTGRES_VECS_COLLECTION=vecs \ | |
-p 8000:8000 \ | |
emrgntcmplxty/r2r:${{ github.sha }} | |
- name: Run integration tests | |
run: | | |
echo "R2R Version" | |
r2r version | |
echo "Ingest Files" | |
r2r ingest-sample-files | |
- name: Clean up | |
if: always() | |
run: | | |
docker stop r2r postgres | |
docker rm r2r postgres | |
docker network rm r2r-network | |
docker system prune -af --volumes |