diff options
Diffstat (limited to 'R2R/.github/workflows')
-rwxr-xr-x | R2R/.github/workflows/build-main.yml | 83 | ||||
-rwxr-xr-x | R2R/.github/workflows/build-release.yml | 43 | ||||
-rwxr-xr-x | R2R/.github/workflows/ci.yml | 85 | ||||
-rwxr-xr-x | R2R/.github/workflows/links.yml | 39 | ||||
-rwxr-xr-x | R2R/.github/workflows/publish-to-pypi.yml | 27 |
5 files changed, 277 insertions, 0 deletions
diff --git a/R2R/.github/workflows/build-main.yml b/R2R/.github/workflows/build-main.yml new file mode 100755 index 00000000..b91de2c3 --- /dev/null +++ b/R2R/.github/workflows/build-main.yml @@ -0,0 +1,83 @@ +name: Build and Publish Docker Image + +on: + workflow_dispatch: + inputs: + version: + description: 'Version to publish (leave empty to use default versioning)' + required: false + type: string + +jobs: + build-and-publish: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + id-token: write + actions: write + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Google Auth + uses: 'google-github-actions/auth@v2' + with: + credentials_json: '${{ secrets.GCP_SA_KEY }}' + + - name: Set up Cloud SDK + uses: 'google-github-actions/setup-gcloud@v2' + + - name: Configure SDK + run: 'gcloud auth configure-docker us-east1-docker.pkg.dev' + + - name: Docker Auth + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Determine version to use + id: version + run: | + if [ -n "${{ github.event.inputs.version }}" ]; then + echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT + else + echo "RELEASE_VERSION=main" >> $GITHUB_OUTPUT + fi + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: | + emrgntcmplxty/r2r + us-east1-docker.pkg.dev/alert-rush-397022/sciphi-r2r/r2r + tags: | + type=raw,value=${{ steps.version.outputs.RELEASE_VERSION }} + type=raw,value=latest + + - name: Build and Push Docker Image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 + + - name: Trigger Dependent Repositories + if: success() + run: | + curl -X POST \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \ + https://api.github.com/repos/SciPhi-AI/R2R-basic-rag-template/dispatches \ + -d '{"event_type": "rebuild", "client_payload": {"r2r_tag": "${{ steps.version.outputs.RELEASE_VERSION }}"}}' diff --git a/R2R/.github/workflows/build-release.yml b/R2R/.github/workflows/build-release.yml new file mode 100755 index 00000000..996f7334 --- /dev/null +++ b/R2R/.github/workflows/build-release.yml @@ -0,0 +1,43 @@ +name: Links + +on: + push: + branches: + - main + pull_request: + branches: + - main + schedule: + - cron: "00 18 * * *" + +jobs: + linkChecker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v1 + continue-on-error: true + with: + args: "--output ./docs/lychee/out.md --config ./docs/.lycheerc" + + - name: Get Lychee Exit Code + id: get-exit-code + run: echo "lychee_exit_code=$?" >> $GITHUB_ENV + + - name: Create Custom Report + if: failure() + run: | + echo "Lychee doesn't play nice with relative imports for .mdx files. Add a link to the .lycheeignore if needed!" > ./docs/lychee/custom_report.md + echo "" >> ./docs/lychee/custom_report.md + cat ./docs/lychee/out.md >> ./docs/lychee/custom_report.md + + - name: Create Issue From File + if: failure() + uses: peter-evans/create-issue-from-file@v4 + with: + title: Link Checker Report + content-filepath: ./docs/lychee/custom_report.md + labels: report, automated issue 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 }} diff --git a/R2R/.github/workflows/links.yml b/R2R/.github/workflows/links.yml new file mode 100755 index 00000000..75ec1758 --- /dev/null +++ b/R2R/.github/workflows/links.yml @@ -0,0 +1,39 @@ +name: Links + +on: + repository_dispatch: + workflow_dispatch: + schedule: + - cron: "00 18 * * *" + +jobs: + linkChecker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v1 + continue-on-error: true + with: + args: "--output ./docs/lychee/out.md --config ./docs/.lycheerc" + + - name: Get Lychee Exit Code + id: get-exit-code + run: echo "lychee_exit_code=$?" >> $GITHUB_ENV + + - name: Create Custom Report + if: failure() + run: | + echo "Lychee doesn't play nice with relative imports for .mdx files. Add a link to the .lycheeignore if needed!" > ./docs/lychee/custom_report.md + echo "" >> ./docs/lychee/custom_report.md + cat ./docs/lychee/out.md >> ./docs/lychee/custom_report.md + + - name: Create Issue From File + if: failure() + uses: peter-evans/create-issue-from-file@v4 + with: + title: Link Checker Report + content-filepath: ./docs/lychee/custom_report.md + labels: report, automated issue diff --git a/R2R/.github/workflows/publish-to-pypi.yml b/R2R/.github/workflows/publish-to-pypi.yml new file mode 100755 index 00000000..79ac0c83 --- /dev/null +++ b/R2R/.github/workflows/publish-to-pypi.yml @@ -0,0 +1,27 @@ +name: Publish to PyPI + +on: + push: + tags: + - "*" + workflow_dispatch: # This line adds manual trigger support + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: Install poetry + run: pip install poetry + + - name: Build and publish + run: | + poetry build + poetry publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }} |