-
Notifications
You must be signed in to change notification settings - Fork 1.9k
191 lines (161 loc) · 7.21 KB
/
ingestion_client.yaml
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
name: Build Ingestion Client Binaries
on:
push:
branches: ['main', 'master', '*']
paths: ['samples/ingestion/ingestion-client/**', '.github/workflows/ingestion_client.yaml']
pull_request:
branches: ['main', 'master','*']
paths: ['samples/ingestion/ingestion-client/**', '.github/workflows/ingestion_client.yaml']
jobs:
convert_bicep:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Azure CLI
run: |
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
az --version
- name: Install Bicep CLI
run: |
BICEP_VERSION="v0.29.47"
if ! command -v az bicep &> /dev/null || [ "$(az bicep version --query 'bicepVersion' -o tsv)" != "$BICEP_VERSION" ]; then
az bicep install --version "$BICEP_VERSION"
fi
az bicep version
- name: Convert Bicep to ARM Template
run: |
az bicep build --file ./samples/ingestion/ingestion-client/infra/main.bicep --outfile ./samples/ingestion/ingestion-client/infra/generated_main.json
- name: Validate ARM Template
run: |
if ! cmp -s ./samples/ingestion/ingestion-client/infra/main.json ./samples/ingestion/ingestion-client/infra/generated_main.json; then
echo "Generated ARM template does not match the existing main.json. Please update main.json accordingly." >&2
exit 1
fi
test:
runs-on: ubuntu-latest
needs: convert_bicep
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Install coverlet
run: dotnet tool install --global coverlet.console
- name: Install reportgenerator
run: dotnet tool install --global dotnet-reportgenerator-globaltool
- name: Run Unit Tests and Collect Coverage
run: |
dotnet test ./samples/ingestion/ingestion-client/Tests --configuration Release --filter "TestCategory=UnitTest" /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura
reportgenerator -reports:./samples/ingestion/ingestion-client/Tests/**/coverage.cobertura.xml -targetdir:coveragereport -reporttypes:MarkdownSummaryGithub
env:
PATH: $PATH:/home/runner/.dotnet/tools
- name: Code Coverage Summary Report
uses: irongut/[email protected]
with:
filename: ./samples/ingestion/ingestion-client/Tests/**/coverage.cobertura.xml
badge: true
format: 'markdown'
output: 'both'
# - name: Add Coverage PR Comment
# uses: marocchino/sticky-pull-request-comment@v2
# if: github.event_name == 'pull_request'
# with:
# recreate: true
# path: code-coverage-results.md
- name: Write to Job Summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
- name: Upload Coverage Report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coveragereport
build:
needs: [convert_bicep, test]
runs-on: ubuntu-latest
outputs:
releaseversionoutput: ${{ steps.get_release_versions.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Get Release Versions
id: get_release_versions
run: |
set -u -e -o pipefail
version=$(cat ./samples/ingestion/ingestion-client/infra/main.json | jq -r .variables.Version)
echo version=$version >> "$GITHUB_OUTPUT"
echo "Batch template: ${version}"
- name: Verify Release Versions
if: steps.get_release_versions.outputs.version == ''
uses: actions/github-script@v3
with:
script: |
core.setFailed('Invalid version specified.')
- name: Clean Solution
run: dotnet clean ./samples/ingestion/ingestion-client/BatchIngestionClient.sln --configuration Release && dotnet nuget locals all --clear
- name: Build BatchIngestionClient
run: dotnet build samples/ingestion/ingestion-client --configuration Release
publish:
runs-on: ubuntu-latest
permissions:
contents: write
needs: build
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Publish StartTranscriptionByTimer function
run: dotnet publish -c Release -f net8.0 --no-self-contained --output ./StartTranscriptionByTimer samples/ingestion/ingestion-client/StartTranscriptionByTimer/StartTranscriptionByTimer.csproj
- name: Zip StartTranscriptionByTimer
run: cd StartTranscriptionByTimer && zip -r ../StartTranscriptionByTimer.zip .
- name: Publish StartTranscriptionByServiceBus function
run: dotnet publish -c Release -f net8.0 --no-self-contained --output ./StartTranscriptionByServiceBus samples/ingestion/ingestion-client/StartTranscriptionByServiceBus/StartTranscriptionByServiceBus.csproj
- name: Zip StartTranscriptionByServiceBus
run: cd StartTranscriptionByServiceBus && zip -r ../StartTranscriptionByServiceBus.zip .
- name: Publish FetchTranscription function
run: dotnet publish -c Release -f net8.0 --no-self-contained --output ./FetchTranscription samples/ingestion/ingestion-client/FetchTranscription/FetchTranscription.csproj
- name: Zip FetchTranscription
run: cd FetchTranscription && zip -r ../FetchTranscription.zip .
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: 'ingestion-${{ needs.build.outputs.releaseversionoutput }}'
release_name: 'Ingestion Client ${{ needs.build.outputs.releaseversionoutput }}'
draft: false
prerelease: false
- name: Upload StartTranscriptionByTimer
id: upload-release-asset-0
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./StartTranscriptionByTimer.zip
asset_name: StartTranscriptionByTimer.zip
asset_content_type: application/zip
- name: Upload StartTranscriptionByServiceBus
id: upload-release-asset-1
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./StartTranscriptionByServiceBus.zip
asset_name: StartTranscriptionByServiceBus.zip
asset_content_type: application/zip
- name: Upload FetchTranscription
id: upload-release-asset-2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./FetchTranscription.zip
asset_name: FetchTranscription.zip
asset_content_type: application/zip