samples_getstarted_flowasfunction #873
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 code is autogenerated. | |
# Code is generated by running custom script: python3 readme.py | |
# Any manual changes to this file may cause incorrect behavior. | |
# Any manual changes will be overwritten if the code is regenerated. | |
name: samples_getstarted_flowasfunction | |
on: | |
schedule: | |
- cron: "17 21 * * *" # Every day starting at 5:17 BJT | |
pull_request: | |
branches: [ main ] | |
paths: [ examples/tutorials/get-started/**, examples/*requirements.txt, .github/workflows/samples_getstarted_flowasfunction.yml ] | |
workflow_dispatch: | |
env: | |
IS_IN_CI_PIPELINE: "true" | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
samples_getstarted_flowasfunction: | |
runs-on: ubuntu-latest | |
environment: | |
internal | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python 3.9 environment | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Prepare requirements | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r ${{ github.workspace }}/examples/requirements.txt | |
pip install -r ${{ github.workspace }}/examples/dev_requirements.txt | |
- name: Create Aoai Connection | |
run: pf connection create -f ${{ github.workspace }}/examples/connections/azure_openai.yml --set api_key="${{ secrets.AOAI_API_KEY_TEST }}" api_base="${{ secrets.AOAI_API_ENDPOINT_TEST }}" | |
- name: Create new Aoai Connection | |
run: pf connection create -f ${{ github.workspace }}/examples/connections/azure_openai.yml --set api_key="${{ secrets.AOAI_API_KEY_TEST }}" api_base="${{ secrets.AOAI_API_ENDPOINT_TEST }}" name=new_ai_connection | |
- name: Random Wait | |
uses: AliSajid/random-wait-action@main | |
with: | |
minimum: 1 | |
maximum: 300 | |
- name: Azure Login | |
uses: azure/login@v2 | |
with: | |
subscription-id: ${{secrets.AZURE_SUBSCRIPTION_ID}} | |
tenant-id: ${{secrets.AZURE_TENANT_ID}} | |
client-id: ${{secrets.AZURE_CLIENT_ID}} | |
- name: Fetch OID token every 4 mins | |
shell: bash | |
run: | | |
while true; do | |
token_request=$ACTIONS_ID_TOKEN_REQUEST_TOKEN | |
token_uri=$ACTIONS_ID_TOKEN_REQUEST_URL | |
token=$(curl -H "Authorization: bearer $token_request" "${token_uri}&audience=api://AzureADTokenExchange" | jq .value -r) | |
az login --service-principal -u ${{secrets.AZURE_CLIENT_ID}} -t ${{secrets.AZURE_TENANT_ID}} --federated-token $token --output none | |
# Sleep for 4 minutes | |
sleep 240 | |
done & | |
- name: Test Notebook | |
working-directory: examples/tutorials/get-started | |
run: | | |
papermill -k python flow-as-function.ipynb flow-as-function.output.ipynb -p api_key ${{ secrets.AOAI_API_KEY_TEST }} -p api_base ${{ secrets.AOAI_API_ENDPOINT_TEST }} -p api_version 2023-07-01-preview | |
- name: Upload artifact | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifact | |
path: examples/tutorials/get-started |