-
Notifications
You must be signed in to change notification settings - Fork 5k
237 lines (226 loc) · 7.66 KB
/
dotnet-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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: dotnet-ci
on:
workflow_dispatch:
pull_request:
branches: [ "main", "staging" ]
push:
branches: [ "main", "staging" ]
merge_group:
types: [checks_requested]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' || github.ref != 'refs/heads/dotnet' }}
permissions:
contents: read
packages: write
jobs:
paths-filter:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
repository-projects: write
outputs:
hasChanges: ${{ steps.filter.outputs.dotnet == 'true'}}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
dotnet:
- "dotnet/**"
workflows:
- ".github/workflows/**"
- name: dotnet has changes
run: echo "dotnet has changes"
if: steps.filter.outputs.dotnet == 'true'
- name: workflows has changes
run: echo "workflows has changes"
if: steps.filter.outputs.workflows == 'true'
build:
name: Dotnet Build
needs: paths-filter
if: needs.paths-filter.outputs.hasChanges == 'true'
defaults:
run:
working-directory: dotnet
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest ]
python-version: ["3.11"]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install jupyter and ipykernel
run: |
python -m pip install --upgrade pip
python -m pip install jupyter
python -m pip install ipykernel
- name: list available kernels
run: |
python -m jupyter kernelspec list
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Install .NET Aspire workload
run: dotnet workload install aspire
- name: Restore dependencies
run: |
# dotnet nuget add source --name dotnet-tool https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json --configfile NuGet.config
dotnet restore -bl
- name: Format check
run: |
echo "Format check"
echo "If you see any error in this step, please run 'dotnet format' locally to format the code."
dotnet format --verify-no-changes -v diag --no-restore
- name: Build
run: |
echo "Build AutoGen"
dotnet build --no-restore --configuration Release -bl /p:SignAssembly=true
- name: Unit Test
run: dotnet test --no-build -bl --configuration Release
aot-test: # this make sure the AutoGen.Core is aot compatible
strategy:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
os: [ ubuntu-latest ]
version: [ net8.0 ]
needs: build
defaults:
run:
working-directory: dotnet
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetching all
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: publish AOT testApp, assert static analysis warning count, and run the app
shell: pwsh
run: ./.tools/test-aot-compatibility.ps1 ${{ matrix.version }}
openai-test:
name: Run openai test
runs-on: ubuntu-latest
environment: dotnet
defaults:
run:
working-directory: dotnet
if: success() && (github.ref == 'refs/heads/main')
needs: aot-test
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install jupyter and ipykernel
run: |
python -m pip install --upgrade pip
python -m pip install jupyter
python -m pip install ipykernel
- name: list available kernels
run: |
python -m jupyter kernelspec list
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: dotnet/global.json
- name: Restore dependencies
run: |
dotnet restore -bl
- name: Build
run: |
echo "Build AutoGen"
dotnet build --no-restore --configuration Release -bl /p:SignAssembly=true
- name: OpenAI Test
run: dotnet test --no-build -bl --configuration Release
env:
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
AZURE_GPT_35_MODEL_ID: ${{ secrets.AZURE_GPT_35_MODEL_ID }}
OEPNAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
- name: Pack
run: |
echo "Create nightly build package"
dotnet pack --no-build --configuration Release --output './output/nightly' -p:VersionSuffix=nightly-${{github.run_id}} -bl
echo "Create release build package"
dotnet pack --no-build --configuration Release --output './output/release' -bl
echo "ls output directory"
ls -R ./output
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: nightly
path: ./dotnet/output/nightly
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: release
path: ./dotnet/output/release
publish:
environment: dotnet-internal-feed
name: Publish to nightly feeds
runs-on: ubuntu-latest
defaults:
run:
working-directory: dotnet
needs: openai-test
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
source-url: https://devdiv.pkgs.visualstudio.com/DevDiv/_packaging/AutoGen/nuget/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.AZURE_DEVOPS_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: nightly
path: ./dotnet/output/nightly
- uses: actions/download-artifact@v4
with:
name: release
path: ./dotnet/output/release
- name: Publish nightly package to Azure Devops
run: |
echo "Publish nightly package to Azure Devops"
echo "ls output directory"
ls -R ./output/nightly
dotnet nuget push --api-key AzureArtifacts ./output/nightly/*.nupkg --skip-duplicate
env:
AZURE_ARTIFACTS_FEED_URL: https://devdiv.pkgs.visualstudio.com/DevDiv/_packaging/AutoGen/nuget/v3/index.json
NUGET_AUTH_TOKEN: ${{ secrets.AZURE_DEVOPS_TOKEN }}
continue-on-error: true
- name: Publish nightly package to github package
run: |
echo "Publish nightly package to github package"
echo "ls output directory"
ls -R ./output/nightly
dotnet nuget push --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/microsoft/index.json" ./output/nightly/*.nupkg --skip-duplicate
continue-on-error: true
- name: Publish nightly package to agentchat myget feed
run: |
echo "Publish nightly package to agentchat myget feed"
echo "ls output directory"
ls -R ./output/nightly
dotnet nuget push --api-key ${{ secrets.MYGET_TOKEN }} --source "https://www.myget.org/F/agentchat/api/v3/index.json" ./output/nightly/*.nupkg --skip-duplicate
env:
MYGET_TOKEN: ${{ secrets.MYGET_TOKEN }}
continue-on-error: true