Skip to content

Commit

Permalink
ragstack files (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzming authored Jun 26, 2024
1 parent 4faf84e commit f06ac5d
Show file tree
Hide file tree
Showing 31 changed files with 11,309 additions and 167 deletions.
61 changes: 61 additions & 0 deletions .github/actions/ragstack-docker-release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: RAGStack docker release

inputs:
version:
description: Docker tag version
required: true

gh-token:
description: Token
required: true
runs:
using: composite
steps:
- name: "Login to GitHub Container Registry"
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ inputs.gh-token }}

- name: Wait for PIP package to be available
shell: bash
run: |
v="${{ inputs.version }}"
while true; do
if pip install ragstack-ai-langflow==${v}; then
break
else
echo "Package not available yet, retrying in 30 seconds"
sleep 30
fi
done
- name: Build docker images
shell: bash
run: |
./ragstack/docker/build-backend.sh
./ragstack/docker/build-frontend.sh "${{ inputs.version }}"
- name: Deploy docker images
shell: bash
run: |
backend_full_name=ghcr.io/datastax/ragstack-ai-langflow-backend
backend_ep_full_name=ghcr.io/datastax/ragstack-ai-langflow-backend-ep
frontend_full_name=ghcr.io/datastax/ragstack-ai-langflow-frontend
v="${{ inputs.version }}"
docker tag ragstack-ai-langflow-backend:latest $backend_full_name:$v
docker tag ragstack-ai-langflow-backend:latest $backend_full_name:latest
docker push $backend_full_name:$v
docker push $backend_full_name:latest
docker tag ragstack-ai-langflow-backend-ep:latest $backend_ep_full_name:$v
docker tag ragstack-ai-langflow-backend-ep:latest $backend_ep_full_name:latest
docker push $backend_ep_full_name:$v
docker push $backend_ep_full_name:latest
docker tag ragstack-ai-langflow-frontend:latest $frontend_full_name:$v
docker tag ragstack-ai-langflow-frontend:latest $frontend_full_name:latest
docker push $frontend_full_name:$v
docker push $frontend_full_name:latest
18 changes: 18 additions & 0 deletions .github/workflows/ragstack-clean-astra-env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Clean Astra env

on:
workflow_dispatch: {}
schedule:
- cron: "*/4 * * * *"

jobs:
clean:
name: Clean Astra env
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Clean AstraDB databases older than 1 day
uses: nicoloboschi/cleanup-astradb-env@v1
with:
token: ${{ secrets.TESTS_ASTRA_DEV_DB_TOKEN }}
wait: false
37 changes: 37 additions & 0 deletions .github/workflows/ragstack-release-langflow-base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release RAGStack Langflow base

on:
push:
tags:
- "ragstack-ai-langflow-base-*"

env:
POETRY_VERSION: "1.8.2"

jobs:
if_release:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry==$POETRY_VERSION
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "poetry"
- name: Build project for distribution
run: |
make build base=true
- name: Check Version
id: check-version
run: |
cd src/backend/base
echo version=$(poetry version --short) >> $GITHUB_OUTPUT
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
cd src/backend/base
poetry publish
53 changes: 53 additions & 0 deletions .github/workflows/ragstack-release-langflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release RAGStack Langflow

on:
push:
tags:
- "ragstack-ai-langflow-[0-9]*"
workflow_dispatch:
inputs:
version:
description: "Version to release"
required: true

env:
POETRY_VERSION: "1.8.2"

jobs:
if_release:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry==$POETRY_VERSION
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "poetry"
- name: Build project for distribution
run: |
poetry lock
poetry build
- name: Check Version
id: check-version
run: |
echo version=$(poetry version --short) >> $GITHUB_OUTPUT
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry publish
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*"
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true

- name: "Login to GitHub Container Registry"
uses: ./.github/actions/ragstack-docker-release
with:
gh-token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ steps.check-version.outputs.version }}
67 changes: 67 additions & 0 deletions .github/workflows/ragstack-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: RAGStack tests

on:
pull_request:
branches:
- ragstack-dev

env:
POETRY_VERSION: "1.8.2"

jobs:
build:
name: RAGStack tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11 + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_caching"
with:
python-version: 3.11
poetry-version: ${{ env.POETRY_VERSION }}
cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('ragstack/poetry.lock') }}
- name: Install Python dependencies
run: |
poetry env use 3.11
poetry install
working-directory: ragstack/libs/core
- name: Lint check
run: |
make lint
working-directory: ragstack/libs/core
- uses: nicoloboschi/setup-astradb@v1
timeout-minutes: 10
id: astra
with:
token: ${{ secrets.TESTS_ASTRA_DEV_DB_TOKEN }}
region: us-east-2
cloud: aws
- name: Run all tests
env:
ASTRA_DB_API_ENDPOINT: ${{ steps.astra.outputs.api-endpoint }}
ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.TESTS_ASTRA_DEV_DB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
make test
working-directory: ragstack/libs/core
- uses: nicoloboschi/cleanup-astradb@v1
if: ${{ always() && steps.astra.outputs.name != '' }}
with:
token: ${{ secrets.TESTS_ASTRA_DEV_DB_TOKEN }}
name: ${{ steps.astra.outputs.name }}
wait: false

docker:
name: RAGStack docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Docker
run: ./ragstack/docker/build-backend.sh
- name: Scan Docker image
uses: snyk/actions/docker@master
with:
image: ragstack-ai-langflow-backend:latest
args: --severity-threshold=high
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
Loading

0 comments on commit f06ac5d

Please sign in to comment.