Skip to content

fix: Update mv cmd

fix: Update mv cmd #3

name: Test - OpenAI API Coverage - Nightly / Manual
on:
schedule:
- cron: '0 20 * * 1,2,3' # At 8 PM UTC on Monday, Tuesday, and Wednesday which is 3 AM UTC+7 Tuesday, Wednesday, and Thursday
workflow_dispatch:
inputs:
endpoints:
description: 'comma-separated list (see available at coverage/endpoint_mapping.json e.g. GET /users,POST /transform)'
required: false
default: all
type: string
push:
branches:
- feat/cortex_openai_coverage
env:
OPENAI_API_PYTHON_TAG: v1.23.2
jobs:
openai-python-tests:
runs-on: [self-hosted, Linux, ubuntu-desktop]
steps:
- name: Getting the repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Installing node
uses: actions/setup-node@v3
with:
node-version: 20
- name: "Cleanup cache"
continue-on-error: true
run: |
npm cache clean --force
- name: Install dependencies
run: |
npm install -g @stoplight/prism-cli
- run: yarn install && yarn build
working-directory: ./cortex-js
- run:
|
node cortex-js/dist/src/command.js serve --host 127.0.0.1 --port 4010 > cortex.log & cortex_pid=$!
sleep 3
wget -O api.json http://127.0.0.1:4010/api-json
kill $cortex_pid
- name: Create python virtual environment and run test
run: |
python3 -m venv /tmp/jan
source /tmp/jan/bin/activate
# Clone openai-api-python repo
git clone https://github.com/openai/openai-python.git -b $OPENAI_API_PYTHON_TAG
cd openai-python
python3 -m venv /tmp/jan
source /tmp/jan/bin/activate
pip install -r requirements-dev.lock
pip install pytest-reportportal pytest-html
# Create pytest.ini file with content
mv ../cortex-js/coverage/pytest.ini pytest.ini
# echo "rp_api_key = ${{ secrets.RP_API_KEY }}" >> pytest.ini
# echo "rp_endpoint = ${{ secrets.RP_ENDPOINT }}" >> pytest.ini
# Append to conftest.py
mv ../cortex-js/coverage/conftest.py tests/conftest.py
mv ../cortex-js/coverage/endpoint_mapping.json tests/endpoints_mapping.json
prism mock api.json > prism.log & prism_pid=$! &&
# pytest --endpoint "$ENDPOINTS" --reportportal --html=report.html && kill $prism_pid
pytest --endpoint all --reportportal --html=report.html && kill $prism_pid
deactivate
# env:
# ENDPOINTS: ${{ github.event.inputs.endpoints }}
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: report
path: |
openai-python/report.html
openai-python/assets
openai-python/prism.log
openai-python/cortex.log
- name: Clean up
if: always()
run: |
rm -rf /tmp/jan
rm -rf openai-python
rm -rf report.html
rm -rf report.zip