OpenaAI API Key secret is added to Github Actions #65
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: Development | ||
on: | ||
push: | ||
branches: | ||
- "main" | ||
pull_request: | ||
branches: | ||
- "**" | ||
jobs: | ||
unit-tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python: | ||
- "3.12" | ||
- "3.8" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install tox | ||
- name: Run unit tests | ||
run: | | ||
python -m tox -e test-unit -- -m "smoke or sanity" | ||
integration-tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python: ["3.12", "3.8"] | ||
env: | ||
GUIDELLM__OPENAI__API_KEY: ${{secrets.openai-automation-token}} | ||
steps: | ||
- name: Authenticate to GCP | ||
uses: google-github-actions/[email protected] | ||
with: | ||
project_id: ${{ secrets.GCP_PROJECT }} | ||
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | ||
service_account: ${{ secrets.NM_PYPI_SA }} | ||
- name: Access OpenAI API Key from Secret Manager | ||
run: | | ||
echo "GUIDELLM__OPENAI__API_KEY=$(gcloud secrets versions access latest --secret=openai-automation-token)" >> $GITHUB_ENV | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
- name: Install dependencies | ||
run: python -m pip install tox | ||
- name: Run integration tests | ||
run: python -m tox -e test-integration -- -m smoke | ||
publish: | ||
if: github.event_name == 'pull_request' || github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
name: Build & Publish the distribution | ||
needs: [unit-tests, integration-tests, e2e-tests] | ||
runs-on: ubuntu-latest | ||
env: | ||
GUIDELLM_BUILD_TYPE: dev | ||
GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number || github.run_number }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.8" | ||
- name: Build and Publish Candidate Release | ||
uses: neuralmagic/nm-actions/actions/publish_pypi@main | ||
with: | ||
publish_pypi: false | ||
publish_pypi_internal: true |