Skip to content

Commit

Permalink
Refactor CI: remove public environment (#484)
Browse files Browse the repository at this point in the history
* wip

* wip

* wip

* wip

* wip

* wip

---------

Co-authored-by: Kumaran Rajendhiran <[email protected]>
  • Loading branch information
davorrunje and kumaranvpl authored Jul 2, 2024
1 parent 8100999 commit 560620f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
uses: ./.github/workflows/test.yaml
with:
python-version: ${{ matrix.python-version }}
environment: public
environment: null
use-llms: false
secrets: inherit # pragma: allowlist secret

Expand All @@ -73,6 +73,8 @@ jobs:
environment: testing
use-llms: true
secrets: inherit # pragma: allowlist secret
needs:
- test-without-llms

test-macos-latest:
if: github.event.pull_request.draft == false
Expand Down
35 changes: 27 additions & 8 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ on:
inputs:
environment:
description: 'Environment to run the tests in'
required: true
required: false
default: null
type: string
python-version:
description: 'Python version to run the tests in'
Expand Down Expand Up @@ -47,15 +48,33 @@ jobs:
DATABASE_URL: postgresql://admin:password@localhost:5432/fastagency
PY_DATABASE_URL: postgresql://admin:password@localhost:5433/pyfastagency
NATS_URL: nats://localhost:4222
AZURE_API_VERSION: ${{ vars.AZURE_API_VERSION }}
AZURE_API_ENDPOINT: ${{ vars.AZURE_API_ENDPOINT }}
AZURE_GPT35_MODEL: ${{ vars.AZURE_GPT35_MODEL }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
TOGETHER_API_KEY: ${{ secrets.TOGETHER_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}

steps:
- name: Set up environment variables
run: |
# check if an environment var or secret is defined and set env var to its value
if [ -n "${{ vars.AZURE_API_VERSION }}" ]; then
echo "AZURE_API_VERSION=${{ vars.AZURE_API_VERSION }}" >> $GITHUB_ENV
fi
if [ -n "${{ vars.AZURE_API_ENDPOINT }}" ]; then
echo "AZURE_API_ENDPOINT=${{ vars.AZURE_API_ENDPOINT }}" >> $GITHUB_ENV
fi
if [ -n "${{ vars.AZURE_GPT35_MODEL }}" ]; then
echo "AZURE_GPT35_MODEL=${{ vars.AZURE_GPT35_MODEL }}" >> $GITHUB_ENV
fi
if [ -n "${{ secrets.AZURE_OPENAI_API_KEY }}" ]; then
echo "AZURE_OPENAI_API_KEY=${{ secrets.AZURE_OPENAI_API_KEY }}" >> $GITHUB_ENV
fi
if [ -n "${{ secrets.TOGETHER_API_KEY }}" ]; then
echo "TOGETHER_API_KEY=${{ secrets.TOGETHER_API_KEY }}" >> $GITHUB_ENV
fi
if [ -n "${{ secrets.OPENAI_API_KEY }}" ]; then
echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> $GITHUB_ENV
fi
if [ -n "${{ secrets.ANTHROPIC_API_KEY }}" ]; then
echo "ANTHROPIC_API_KEY=${{ secrets.ANTHROPIC_API_KEY }}" >> $GITHUB_ENV
fi
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
Expand Down
6 changes: 3 additions & 3 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@
"filename": ".github/workflows/test.yaml",
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
"is_verified": false,
"line_number": 32,
"line_number": 33,
"is_secret": false
},
{
"type": "Basic Auth Credentials",
"filename": ".github/workflows/test.yaml",
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
"is_verified": false,
"line_number": 47,
"line_number": 48,
"is_secret": false
}
],
Expand All @@ -141,5 +141,5 @@
}
]
},
"generated_at": "2024-07-01T12:57:48Z"
"generated_at": "2024-07-02T05:22:08Z"
}
2 changes: 1 addition & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# coverage run -m pytest -x --ff "$@" || \
# coverage run -m pytest -x --ff "$@" || \
coverage run -m pytest -x --ff "$@"
coverage run -m pytest --ff "$@"

0 comments on commit 560620f

Please sign in to comment.