Skip to content

Commit 8628c0e

Browse files
authored
Update scripts for infra (#28)
1 parent 9d1d3ed commit 8628c0e

14 files changed

+427
-278
lines changed
+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Azure Dev - Build Only
2+
3+
on:
4+
push:
5+
branches:
6+
- 'feature/*'
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build-test:
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup .NET SDK
21+
uses: actions/setup-dotnet@v4
22+
with:
23+
dotnet-version: 8.x
24+
25+
- name: Install local certs
26+
shell: pwsh
27+
run: |
28+
dotnet dev-certs https --clean
29+
dotnet dev-certs https --trust
30+
31+
- name: Install Aspire workload
32+
shell: pwsh
33+
run: |
34+
dotnet workload update
35+
dotnet workload install aspire
36+
37+
- name: Restore NuGet packages
38+
shell: bash
39+
run: |
40+
dotnet restore
41+
42+
- name: Build solution
43+
shell: bash
44+
run: |
45+
dotnet build
46+
47+
- name: Test solution
48+
shell: bash
49+
run: |
50+
dotnet test

.github/workflows/azure-dev.yml

+35-88
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,42 @@
1+
name: Azure Dev
2+
13
on:
24
workflow_dispatch:
35
push:
46
branches:
57
- main
6-
- 'feature/*'
78

8-
# https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Clinux#set-up-azure-login-with-openid-connect-authentication
99
permissions:
1010
id-token: write
1111
contents: read
1212

1313
jobs:
14-
build:
14+
build-test-deploy:
15+
1516
runs-on: ubuntu-latest
1617

18+
env:
19+
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
20+
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
21+
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
22+
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
23+
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
24+
1725
steps:
1826
- name: Checkout
1927
uses: actions/checkout@v4
2028

21-
# - name: Login to Azure
22-
# if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
23-
# uses: azure/login@v1
24-
# with:
25-
# tenant-id: ${{ vars.AZURE_TENANT_ID }}
26-
# subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
27-
# client-id: ${{ vars.AZURE_CLIENT_ID }}
28-
29-
# # - name: Install Azure Developer CLI
30-
# # if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
31-
# # uses: Azure/[email protected]
32-
33-
# - name: Install Azure Developer CLI (nightly build)
34-
# if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
35-
# shell: pwsh
36-
# run: |
37-
# Invoke-RestMethod 'https://aka.ms/install-azd.ps1' -OutFile ./install-azd.ps1
38-
# ./install-azd.ps1 -Version daily
39-
40-
# - name: Login to Azure Developer CLI
41-
# if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
42-
# shell: pwsh
43-
# run: |
44-
# azd auth login `
45-
# --tenant-id "${{ vars.AZURE_TENANT_ID }}" `
46-
# --client-id "${{ vars.AZURE_CLIENT_ID }}" `
47-
# --federated-credential-provider "${{ vars.AZD_PIPELINE_PROVIDER }}"
48-
49-
# - name: Setup environment
50-
# if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
51-
# shell: pwsh
52-
# run: |
53-
# # Create config.json under .azure
54-
# New-Item -Type Directory .azure
55-
# $config = @{ version = 1; defaultEnvironment = "${{ vars.AZURE_ENV_NAME }}" }
56-
# $config | ConvertTo-Json -Depth 100 | Out-File -Path ./.azure/config.json -Force
57-
58-
# # Create config.json under .azure/${{ vars.AZURE_ENV_NAME }}
59-
# New-Item -Type Directory .azure/${{ vars.AZURE_ENV_NAME }}
60-
# $config = @{ services = @{ app = @{ config = @{ exposedServices = @( "playground" ) } } } }
61-
# $config | ConvertTo-Json -Depth 100 | Out-File -Path ./.azure/${{ vars.AZURE_ENV_NAME }}/config.json -Force
62-
63-
# # Create .env under .azure/${{ vars.AZURE_ENV_NAME }}
64-
# $dotenv = @()
65-
# $dotenv += "AZD_PIPELINE_PROVIDER=`"${{ vars.AZD_PIPELINE_PROVIDER }}`""
66-
# $dotenv += "AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN=`"${{ vars.AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN }}`""
67-
# $dotenv += "AZURE_CONTAINER_APPS_ENVIRONMENT_ID=`"${{ vars.AZURE_CONTAINER_APPS_ENVIRONMENT_ID }}`""
68-
# $dotenv += "AZURE_CONTAINER_REGISTRY_ENDPOINT=`"${{ vars.AZURE_CONTAINER_REGISTRY_ENDPOINT }}`""
69-
# $dotenv += "AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID=`"${{ vars.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID }}`""
70-
# $dotenv += "AZURE_ENV_NAME=`"${{ vars.AZURE_ENV_NAME }}`""
71-
# $dotenv += "AZURE_LOCATION=`"${{ vars.AZURE_LOCATION }}`""
72-
# $dotenv += "AZURE_PIPELINE_CLIENT_ID=`"${{ vars.AZURE_PIPELINE_CLIENT_ID }}`""
73-
# $dotenv += "AZURE_SUBSCRIPTION_ID=`"${{ vars.AZURE_SUBSCRIPTION_ID }}`""
74-
# $dotenv += "MANAGED_IDENTITY_CLIENT_ID=`"${{ vars.MANAGED_IDENTITY_CLIENT_ID }}`""
75-
# $dotenv += "SERVICE_BINDING_TABLE_ENDPOINT=`"${{ vars.SERVICE_BINDING_TABLE_ENDPOINT }}`""
76-
# $dotenv | Out-File -Path ./.azure/${{ vars.AZURE_ENV_NAME }}/.env -Force
77-
78-
# - name: Update appsettings.json
79-
# if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
80-
# shell: pwsh
81-
# run: |
82-
# $instances = @()
83-
# $aoais = az resource list -g rg-${{ vars.AZURE_ENV_NAME }} --query "[?type=='Microsoft.CognitiveServices/accounts'].name" | ConvertFrom-Json
84-
# $aoais | ForEach-Object {
85-
# $name = $_
86-
# $endpoint = az cognitiveservices account show -g rg-${{ vars.AZURE_ENV_NAME }} -n $name --query "properties.endpoint" -o tsv
87-
# $apiKey = az cognitiveservices account keys list -g rg-${{ vars.AZURE_ENV_NAME }} -n $name --query "key1" -o tsv
88-
# $deploymentName = az cognitiveservices account deployment list -g rg-${{ vars.AZURE_ENV_NAME }} -n $name --query "[].name" -o tsv
89-
90-
# $instance = @{ Endpoint = $endpoint; ApiKey = $apiKey; DeploymentName = $deploymentName }
91-
# $instances += $instance
92-
# }
93-
94-
# Copy-Item -Path ./src/AzureOpenAIProxy.AppHost/appsettings.Development.sample.json `
95-
# -Destination ./src/AzureOpenAIProxy.AppHost/appsettings.Development.json -Force
96-
97-
# $appsettings = Get-Content -Path ./src/AzureOpenAIProxy.AppHost/appsettings.Development.json | ConvertFrom-Json
98-
# $appsettings.AOAI.Instances = $instances
99-
# $appsettings | ConvertTo-Json -Depth 100 | Out-File -Path ./src/AzureOpenAIProxy.AppHost/appsettings.Development.json -Force
100-
10129
- name: Setup .NET SDK
10230
uses: actions/setup-dotnet@v4
10331
with:
10432
dotnet-version: 8.x
10533

34+
- name: Install local certs
35+
shell: pwsh
36+
run: |
37+
dotnet dev-certs https --clean
38+
dotnet dev-certs https --trust
39+
10640
- name: Install Aspire workload
10741
shell: pwsh
10842
run: |
@@ -123,9 +57,22 @@ jobs:
12357
shell: bash
12458
run: |
12559
dotnet test
60+
61+
- name: Install azd
62+
uses: Azure/[email protected]
63+
64+
- name: Log in with Azure (Federated Credentials)
65+
run: |
66+
azd auth login `
67+
--client-id "$Env:AZURE_CLIENT_ID" `
68+
--federated-credential-provider "github" `
69+
--tenant-id "$Env:AZURE_TENANT_ID"
70+
shell: pwsh
71+
72+
- name: Provision Infrastructure
73+
run: azd provision --no-prompt
74+
env:
75+
AZD_INITIAL_ENVIRONMENT_CONFIG: ${{ secrets.AZD_INITIAL_ENVIRONMENT_CONFIG }}
12676

127-
# - name: Deploy to Azure Container Apps
128-
# if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
129-
# shell: pwsh
130-
# run: |
131-
# azd deploy
77+
- name: Deploy Application
78+
run: azd deploy --no-prompt

biceps/openAI.bicep

-69
This file was deleted.

biceps/openAIModels.bicep

-78
This file was deleted.

biceps/openAIs.bicep

-36
This file was deleted.

biceps/resourceGroup.bicep

-1
This file was deleted.

0 commit comments

Comments
 (0)