Merge changes for v0.2 release #31
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: CI | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
tags: | |
- "v*" | |
jobs: | |
python_tests: | |
name: Python unit tests | |
runs-on: ubuntu-latest-l | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Inspect git version | |
run: | | |
git --version | |
- name: Remove cloud-only modules and install Python client | |
run: | | |
set -e | |
bash scripts/remove_cloud_modules.sh | |
cd clients/python | |
python -m pip install .[all] | |
- name: Check Docker Version | |
run: docker version | |
- name: Check Docker Compose Version | |
run: docker compose version | |
- name: Authenticating to the Container registry | |
run: echo $JH_PAT | docker login ghcr.io -u tanjiahuei@gmail.com --password-stdin | |
env: | |
JH_PAT: ${{ secrets.JH_PAT }} | |
- name: Launch services | |
timeout-minutes: 15 | |
run: | | |
set -e | |
export API_DEVICE=cpu | |
export EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2 | |
export RERANKER_MODEL=cross-encoder/ms-marco-TinyBERT-L-2 | |
# Edit .env file | |
ORGS=$(printenv | grep API_KEY | xargs -I {} echo {} | cut -d '=' -f 1) | |
KEYS=$(printenv | grep API_KEY | xargs -I {} echo {} | cut -d '=' -f 2-) | |
# Convert them into arrays | |
ORG_ARRAY=($ORGS) | |
KEY_ARRAY=($KEYS) | |
# Loop through the ORG_ARRAY | |
for i in "${!ORG_ARRAY[@]}"; do | |
# Get the org and key | |
org="${ORG_ARRAY[$i]}" | |
key="${KEY_ARRAY[$i]}" | |
# Replace the org with the key in the .env file | |
sed -i "s/$org=.*/$org=$key/g" .env | |
done | |
docker compose -f docker/compose.cpu.yml up --quiet-pull -d | |
# Wait for the service to finish starting up | |
set +e | |
while true; do | |
docker ps | |
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:${OWL_PORT:-6969}/api/health) | |
echo $response | |
if [ $response -eq 200 ]; then | |
break | |
fi | |
printf "> Waiting for API service ...\n" | |
sleep 10 | |
done | |
printf "> DONE\n" | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} | |
TOGETHER_API_KEY: ${{ secrets.TOGETHER_API_KEY }} | |
COMPOSE_DOCKER_CLI_BUILD: 1 | |
DOCKER_BUILDKIT: 1 | |
- name: Inspect owl environment | |
run: docker exec jamai_owl pip list | |
# - name: Pytest (owl) | |
# run: | | |
# set -e | |
# python -m pytest -vv --doctest-modules --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov-report=xml services/api/tests | |
- name: Pytest (Python client) | |
run: | | |
set -e | |
export JAMAI_API_BASE=http://localhost:6969/api | |
python -m pytest -vv --doctest-modules --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov-report=xml clients/python/tests | |
- name: Upload Pytest Test Results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-results-${{ matrix.python-version }} | |
path: junit/test-results-${{ matrix.python-version }}.xml | |
# Use always() to always run this step to publish test results when there are test failures | |
if: ${{ always() }} | |
#- name: Generate OpenAPI Json Schema | |
# run: mkdir -p artifacts && curl http://127.0.0.1:7770/api/openapi.json >> ./artifacts/openapi.json | |
#- name: Upload OpenAPI Json Schema | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: openapi-json | |
# path: artifacts/openapi.json | |
# readmeio_update: | |
# needs: python_tests | |
# name: Push OpenAPI to ReadMe.io | |
# runs-on: ubuntu-latest-l | |
# strategy: | |
# matrix: | |
# python-version: ["3.10"] | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v4 | |
# - name: Download OpenAPI Json Schema | |
# uses: actions/download-artifact@v4 | |
# with: | |
# name: openapi-json | |
# path: artifacts | |
# # - name: Display structure of downloaded files | |
# # run: ls -R artifacts | |
# # Run GitHub Action to sync OpenAPI file at ./path-to-file.json | |
# - name: Update ReadMe API Reference Documentation | |
# # We recommend specifying a fixed version, i.e. @v8 | |
# # Docs: https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions#example-using-versioned-actions | |
# uses: readmeio/rdme@v8 | |
# with: | |
# rdme: openapi artifacts/openapi.json --key=${{ secrets.README_API_KEY }} --id=${{ secrets.API_DEFINITION_ID }} | |
# # - name: Generate Stainless SDK | |
# # uses: stainless-api/upload-openapi-spec-action@main | |
# # with: | |
# # stainless_api_key: ${{ secrets.STAINLESS_API_KEY }} | |
# # input_path: "artifacts/openapi.json" | |
# # config_path: "ellm.stainless.yaml" | |
# # project_name: "jamai" |