Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit fc225d2

Browse files
authored
fix: Update coverage files typo (#687)
1 parent 38a4c81 commit fc225d2

File tree

3 files changed

+26
-35
lines changed

3 files changed

+26
-35
lines changed

.github/workflows/cortex-js-openai-coverage.yml

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Test - OpenAI API Coverage - Nightly / Manual
22
on:
33
schedule:
4-
- 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
4+
- cron: '0 20 * * 1,2,3,4,5,6'
55
workflow_dispatch:
66
inputs:
77
endpoints:
@@ -15,9 +15,13 @@ on:
1515
required: false
1616
default: dev
1717
type: string
18+
19+
push:
20+
branches:
21+
- fix/openai_coverage_misc
1822

1923
env:
20-
OPENAI_API_PYTHON_TAG: v1.23.2
24+
OPENAI_API_PYTHON_TAG: v1.33.0
2125
TARGET_BRANCH: ${{ github.event.inputs.branch }}
2226

2327
jobs:
@@ -28,37 +32,26 @@ jobs:
2832
uses: actions/checkout@v4
2933
with:
3034
fetch-depth: 0
31-
ref: ${{ env.TARGET_BRANCH }}
35+
# ref: ${{ env.TARGET_BRANCH }}
3236

3337
- name: Installing node
3438
uses: actions/setup-node@v4
3539
with:
3640
node-version: 20
3741

38-
- name: "Cleanup cache"
39-
continue-on-error: true
40-
run: |
41-
npm cache clean --force
42-
43-
- name: Install dependencies
44-
run: |
45-
npm install -g @stoplight/prism-cli
42+
- uses: actions/setup-python@v4
43+
with:
44+
python-version: "3.10"
4645

4746
- run: yarn install && yarn build
4847
working-directory: ./cortex-js
4948

50-
- name: Run and extract openapi.json
51-
run:
52-
|
53-
node cortex-js/dist/src/command.js serve --host 127.0.0.1 --port 4010 > cortex.log & cortex_pid=$!
54-
sleep 3
55-
wget --no-verbose -O api.json http://127.0.0.1:4010/api-json
56-
kill $cortex_pid
57-
58-
- name: Create python virtual environment and run test
49+
- name: Run test
5950
run: |
60-
python3 -m venv /tmp/jan
61-
source /tmp/jan/bin/activate
51+
node cortex-js/dist/src/command.js serve --host 127.0.0.1 --port 4010 > cortex.log & cortex_pid=$!
52+
sleep 3
53+
wget --no-verbose -O api.json http://127.0.0.1:4010/api-json
54+
cat api.json
6255
6356
# Clone openai-api-python repo
6457
git clone https://github.com/openai/openai-python.git -b $OPENAI_API_PYTHON_TAG
@@ -67,18 +60,14 @@ jobs:
6760
pip install -r requirements-dev.lock
6861
pip install pytest-reportportal pytest-html
6962
70-
# Create pytest.ini file with content
71-
mv ../coverage/pytest.ini pytest.ini
72-
echo "rp_api_key=${{ secrets.RP_API_KEY }}" >> pytest.ini
73-
echo "rp_endpoint=${{ secrets.RP_ENDPOINT }}" >> pytest.ini
74-
75-
# Append to conftest.py
7663
mv ../coverage/conftest.py tests/conftest.py
7764
mv ../coverage/endpoint_mapping.json tests/endpoints_mapping.json
78-
79-
prism mock ../api.json > prism.log & prism_pid=$!
80-
pytest --endpoint "$ENDPOINTS" --reportportal --html=report.html && kill $prism_pid
81-
deactivate
65+
mv ../coverage/pytest.ini pytest.ini
66+
echo "rp_api_key = ${{ secrets.RP_API_KEY }}" >> pytest.ini
67+
echo "rp_endpoint = ${{ secrets.RP_ENDPOINT }}" >> pytest.ini
68+
69+
pytest --continue-on-collection-errors --endpoint "$ENDPOINTS" --reportportal --html=report.html -v || true
70+
kill $cortex_pid
8271
env:
8372
ENDPOINTS: ${{ github.event.inputs.endpoints }}
8473

@@ -87,9 +76,12 @@ jobs:
8776
run: |
8877
wget --no-verbose -O total-coverage.json "${{ secrets.RP_ENDPOINT }}/api/v1/openai-api-test/widget/27" --header 'authorization: bearer ${{ secrets.RP_API_KEY }}'
8978
wget --no-verbose -O today-endpoint.json "${{ secrets.RP_ENDPOINT }}/api/v1/openai-api-test/widget/multilevel/32" --header 'authorization: bearer ${{ secrets.RP_API_KEY }}'
79+
80+
echo "Overall coverage"
9081
cat total-coverage.json
9182
current_date=$(date +"%m-%d-%Y")
9283
cp today-endpoint.json $current_date.json
84+
echo "Endpoint today"
9385
cat $current_date.json
9486
9587
- name: Upload report json files to S3
@@ -109,7 +101,6 @@ jobs:
109101
name: report
110102
path: |
111103
openai-python/report.html
112-
openai-python/prism.log
113104
openai-python/cortex.log
114105
openai-python/total-coverage.json
115106
openai-python/today-endpoint.json

coverage/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import json
2-
2+
import pytest
33

44
def pytest_addoption(parser):
55
parser.addoption(

coverage/pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ rp_launch_description = Full collection to ensure compatibility with OpenAI API
55
rp_launch_attributes = 'CI'
66
filterwarnings = ignore::pytest.PytestUnknownMarkWarning
77
log_format = %(asctime)s %(levelname)s %(message)s
8-
log_date_format = %Y-%m-%d %H:%M:%S
8+
log_date_format = %Y-%m-%d %H:%M:%S

0 commit comments

Comments
 (0)