-
Notifications
You must be signed in to change notification settings - Fork 30
88 lines (70 loc) · 3.57 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Build
on:
push:
branches: [ "main" ]
paths-ignore: [ '**.md' ]
pull_request:
branches: [ "main" ]
paths-ignore: [ '**.md' ]
env:
config: Release
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Docker Build - Chat Bot Sample Out of proc
run: docker build -f samples/chat/csharp-ooproc/Dockerfile -t openai-func-sample-csharp-ooproc .
- name: Docker Run - Azurite
run: docker run -d -p 10000:10000 -p 10001:10001 -p 10002:10002 mcr.microsoft.com/azure-storage/azurite
- name: Docker Build - Chat Bot Sample Out of proc
run: docker build -f samples/chat/csharp-ooproc/Dockerfile -t openai-func-sample-csharp-ooproc .
- name: Docker Run - Chat Bot Sample Out of Proc
env:
AZURE_OPENAI_KEY: ${{ secrets.AZURE_OPENAI_KEY }}
AZURE_OPENAI_ENDPOINT: ${{ vars.AZURE_OPENAI_ENDPOINT }}
AZURE_DEPLOYMENT_NAME: ${{ vars.AZURE_DEPLOYMENT_NAME }}
run: |
docker run -d -p 7071:80 --name openai-func-sample-csharp-ooproc \
--add-host host.docker.internal:host-gateway \
--env AZURE_OPENAI_KEY=$AZURE_OPENAI_KEY \
--env AZURE_OPENAI_ENDPOINT=$AZURE_OPENAI_ENDPOINT \
--env AZURE_DEPLOYMENT_NAME=$AZURE_DEPLOYMENT_NAME \
--env 'AzureWebJobsStorage=UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://host.docker.internal' \
openai-func-sample-csharp-ooproc
- name: Sleep for 10 seconds
run: sleep 10s
- name: Create new directory
run: mkdir ~/NuGetPackagesLocal
- name: Get version
run: |
dotnet build /home/runner/work/azure-functions-openai-extension/azure-functions-openai-extension/src/WebJobs.Extensions.OpenAI/WebJobs.Extensions.OpenAI.csproj --configuration $config -p:FileVersionRevision=$GITHUB_RUN_NUMBER
version=$(sed -n "s/.*<WebJobsVersion Condition='\''\$(WebJobsVersion)' == '\'''\''>\(.*\)<\/WebJobsVersion>.*/\1/p" /home/runner/work/azure-functions-openai-extension/azure-functions-openai-extension/src/Functions.Worker.Extensions.OpenAI/Functions.Worker.Extensions.OpenAI.csproj)
echo "$version"
newVersion="${version}-test"
echo "$newVersion"
dotnet build /home/runner/work/azure-functions-openai-extension/azure-functions-openai-extension/src/WebJobs.Extensions.OpenAI/WebJobs.Extensions.OpenAI.csproj --configuration $config -p:FileVersionRevision=$GITHUB_RUN_NUMBER -p:Version=$newVersion
sudo cp "/home/runner/work/azure-functions-openai-extension/azure-functions-openai-extension/src/WebJobs.Extensions.OpenAI/bin/Release/Microsoft.Azure.WebJobs.Extensions.OpenAI.${newVersion}.nupkg" ~/NuGetPackagesLocal
ls ~/NuGetPackagesLocal
pwd
dotnet nuget locals all --clear
dotnet new nuget.config --force
dotnet nuget add source ~/NuGetPackagesLocal
dotnet nuget list source
dotnet restore -v n
dotnet restore
dotnet build --configuration $config --no-restore -p:FileVersionRevision=$GITHUB_RUN_NUMBER -p:WebJobsVersion=$newVersion
- name: E2E Test - Out of Proc Chat Bot Sample
run: dotnet test --configuration $config --no-build --verbosity normal
- name: Print Docker Logs - Out of Proc Chat Bot Sample
run: docker logs openai-func-sample-csharp-ooproc
if: always()
- name: Upload
uses: actions/upload-artifact@v3
with:
name: nuget-packages
path: artifacts/*.nupkg