diff --git a/.github/workflows/ingestion_client.yaml b/.github/workflows/ingestion_client.yaml index 17fcd85fa..164a95f04 100644 --- a/.github/workflows/ingestion_client.yaml +++ b/.github/workflows/ingestion_client.yaml @@ -4,6 +4,9 @@ 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: @@ -18,8 +21,12 @@ jobs: - name: Install Bicep CLI run: | - az bicep install - az bicep upgrade + if ! command -v az bicep &> /dev/null; then + az bicep install + else + az bicep upgrade + fi + az bicep version - name: Convert Bicep to ARM Template run: | @@ -31,8 +38,55 @@ jobs: echo "Generated ARM template does not match the existing main.json. Please update main.json accordingly." >&2 exit 1 fi - build: + + 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/CodeCoverageSummary@v1.3.0 + 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 }} @@ -133,4 +187,4 @@ jobs: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./FetchTranscription.zip asset_name: FetchTranscription.zip - asset_content_type: application/zip + asset_content_type: application/zip \ No newline at end of file diff --git a/samples/ingestion/ingestion-client/Tests/EndToEndTests.cs b/samples/ingestion/ingestion-client/Tests/EndToEndTests.cs index e893bdf9a..0ea366690 100644 --- a/samples/ingestion/ingestion-client/Tests/EndToEndTests.cs +++ b/samples/ingestion/ingestion-client/Tests/EndToEndTests.cs @@ -22,7 +22,6 @@ namespace Tests using Moq; using Newtonsoft.Json; - // using StartTranscriptionByTimer; [TestClass] public class EndToEndTests { diff --git a/samples/ingestion/ingestion-client/Tests/Tests.csproj b/samples/ingestion/ingestion-client/Tests/Tests.csproj index c0c436124..6339e8a24 100644 --- a/samples/ingestion/ingestion-client/Tests/Tests.csproj +++ b/samples/ingestion/ingestion-client/Tests/Tests.csproj @@ -4,6 +4,15 @@ false + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + diff --git a/samples/ingestion/ingestion-client/infra/generate_arm_templates.sh b/samples/ingestion/ingestion-client/infra/generate_arm_templates.sh index 4741924ed..62290cc5f 100755 --- a/samples/ingestion/ingestion-client/infra/generate_arm_templates.sh +++ b/samples/ingestion/ingestion-client/infra/generate_arm_templates.sh @@ -2,7 +2,12 @@ set -e -az bicep version 2>/dev/null || az bicep install +# if az bicep is not installed, install it else upgrade it +if ! command -v az bicep &> /dev/null; then + az bicep install +else + az bicep upgrade +fi TEMPLATES=() FILES=() diff --git a/samples/ingestion/ingestion-client/infra/main.bicep b/samples/ingestion/ingestion-client/infra/main.bicep index 6d6c84804..d8c90c4cb 100644 --- a/samples/ingestion/ingestion-client/infra/main.bicep +++ b/samples/ingestion/ingestion-client/infra/main.bicep @@ -144,7 +144,7 @@ param DeploymentId string = utcNow() param CompletedServiceBusConnectionString string = '' // Don't change the format for Version variable -var Version = 'v2.1.7' +var Version = 'v2.1.8' var AudioInputContainer = 'audio-input' var AudioProcessedContainer = 'audio-processed' var ErrorFilesOutputContainer = 'audio-failed' @@ -171,9 +171,9 @@ var ServiceBusName = 'ServiceBus-${InstanceId}' var AppInsightsName = 'AppInsights-${InstanceId}' var KeyVaultName = 'KV-${InstanceId}' var EventGridSystemTopicName = '${StorageAccountName}-${InstanceId}' -var StartTranscriptionFunctionName = take('StartTranscriptionFunction-${InstanceId}', 60) +var StartTranscriptionFunctionName = take('StartTranscription-${InstanceId}', 60) var StartTranscriptionFunctionId = StartTranscriptionFunction.id -var FetchTranscriptionFunctionName = take('FetchTranscriptionFunction-${InstanceId}', 60) +var FetchTranscriptionFunctionName = take('FetchTranscription-${InstanceId}', 60) var FetchTranscriptionFunctionId = FetchTranscriptionFunction.id var AppServicePlanName = 'AppServicePlan-${InstanceId}' var AzureSpeechServicesKeySecretName = 'AzureSpeechServicesKey' diff --git a/samples/ingestion/ingestion-client/infra/main.json b/samples/ingestion/ingestion-client/infra/main.json index 75160242a..ca3505c8a 100644 --- a/samples/ingestion/ingestion-client/infra/main.json +++ b/samples/ingestion/ingestion-client/infra/main.json @@ -4,8 +4,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "7855477000736253469" + "version": "0.29.47.4906", + "templateHash": "9541547417566949871" } }, "parameters": { @@ -224,7 +224,7 @@ } }, "variables": { - "Version": "v2.1.7", + "Version": "v2.1.8", "AudioInputContainer": "audio-input", "AudioProcessedContainer": "audio-processed", "ErrorFilesOutputContainer": "audio-failed", @@ -251,9 +251,9 @@ "AppInsightsName": "[format('AppInsights-{0}', variables('InstanceId'))]", "KeyVaultName": "[format('KV-{0}', variables('InstanceId'))]", "EventGridSystemTopicName": "[format('{0}-{1}', variables('StorageAccountName'), variables('InstanceId'))]", - "StartTranscriptionFunctionName": "[take(format('StartTranscriptionFunction-{0}', variables('InstanceId')), 60)]", + "StartTranscriptionFunctionName": "[take(format('StartTranscription-{0}', variables('InstanceId')), 60)]", "StartTranscriptionFunctionId": "[resourceId('Microsoft.Web/sites', variables('StartTranscriptionFunctionName'))]", - "FetchTranscriptionFunctionName": "[take(format('FetchTranscriptionFunction-{0}', variables('InstanceId')), 60)]", + "FetchTranscriptionFunctionName": "[take(format('FetchTranscription-{0}', variables('InstanceId')), 60)]", "FetchTranscriptionFunctionId": "[resourceId('Microsoft.Web/sites', variables('FetchTranscriptionFunctionName'))]", "AppServicePlanName": "[format('AppServicePlan-{0}', variables('InstanceId'))]", "AzureSpeechServicesKeySecretName": "AzureSpeechServicesKey", diff --git a/samples/ingestion/ingestion-client/versions.nugets.props b/samples/ingestion/ingestion-client/versions.nugets.props index cceb9fab2..c6d025fe1 100644 --- a/samples/ingestion/ingestion-client/versions.nugets.props +++ b/samples/ingestion/ingestion-client/versions.nugets.props @@ -6,6 +6,8 @@ [3.4.3] [3.4.3] + [17.10.0] + [2.22.0] [1.22.0] @@ -24,5 +26,7 @@ [4.20.70] [13.0.3] [8.4.1] + [6.0.2] + [6.0.2]