Merge samples for 1.41.1 updates #101
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |