Umshini: update environments to use OpenAI 1.0.0 API, add CI testing #36
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
--- | |
name: Environments Test (OpenAI) | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
permissions: | |
contents: read | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
OPENAI_API_TYPE: openai | |
jobs: | |
environment-test-openai: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ '3.11' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get install python3-opengl xvfb | |
pip install -e '.[all]' | |
- name: Check environment variables are set | |
run: | | |
if [ -z "$OPENAI_API_KEY" ]; then | |
echo "OPENAI_API_KEY environment variable has been set" | |
exit 0 | |
else | |
echo "OPENAI_API_KEY environment variable is not set" | |
exit 1 | |
fi | |
- name: Set environment variables to be visible by python | |
run: | | |
python -c 'import os; print("BEFORE: OPENAI_API_KEY visible in os.environ:", os.getenv("OPENAI_API_KEY") is not None)' | |
echo "OPENAI_API_KEY=$OPENAI_API_KEY" >> "$GITHUB_ENV" | |
echo "OPENAI_API_TYPE=$OPENAI_API_TYPE" >> "$GITHUB_ENV" | |
python -c 'import os; print("AFTER: OPENAI_API_KEY visible in os.environ:", os.getenv("OPENAI_API_KEY") is not None)' | |
python -c 'import os; print("AFTER: OPENAI_API_TYPE visible in os.environ:", os.getenv("OPENAI_API_TYPE") is not None)' | |
- name: Regular Environments Test | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
OPENAI_API_TYPE: openai | |
run: | | |
python -c 'import os; print("AFTER: OPENAI_API_KEY visible in os.environ:", os.getenv("OPENAI_API_KEY") is not None)' | |
python -c 'import os; print("AFTER: OPENAI_API_TYPE visible in os.environ:", os.getenv("OPENAI_API_TYPE") is not None)' | |
pytest -v tests | |
- name: Umshini Environments Test | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
OPENAI_API_TYPE: openai | |
run: | | |
env | grep OPENAI_API_KEY | |
python -c 'import os; print("AFTER: OPENAI_API_KEY visible in os.environ:", os.getenv("OPENAI_API_KEY") is not None)' | |
python -c 'import os; print(os.getenv("OPENAI_API_KEY"))' | |
pytest -v tests/unit/test_umshini_environments.py | |
echo "After pytest:" | |
env | grep OPENAI_API_KEY |