Improved Telemetry to make it testable #66
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release/** | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| branches: | |
| - main | |
| - release/** | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: windows-2022 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: dotnet/nbgv@f088059084cb5d872e9d1a994433ca6440c2bf72 # v0.4.2 | |
| with: | |
| toolVersion: 3.6.139 | |
| setAllVars: true | |
| - name: Build | |
| run: | | |
| cd src | |
| dotnet build -c Release -p:PackageVersion=$env:NBGV_SemVer2 -p:Version=$env:NBGV_SemVer2 "-p:InformationalVersion=$env:NBGV_SemVer2+$env:NBGV_BuildingRef" "/p:PackageOutputPath=$env:GITHUB_WORKSPACE\artifacts" | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: NuGet | |
| path: .\artifacts | |
| - name: Create Test Results Directory | |
| shell: pwsh | |
| run: New-Item -ItemType Directory -Force -Path artifacts/test-results | |
| - name: Test | |
| shell: pwsh | |
| run: | | |
| cd src | |
| dotnet run --project Uno.DevTools.Telemetry.Tests/Uno.DevTools.Telemetry.Tests.csproj --configuration Release -- --report-trx --results-directory ../artifacts/test-results | |
| - name: Upload Test Results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: artifacts/test-results/*.trx | |
| - name: Publish Test Results | |
| uses: dorny/test-reporter@v2 | |
| if: always() | |
| with: | |
| name: Unit Tests | |
| path: artifacts/test-results/*.trx | |
| reporter: dotnet-trx | |
| sign: | |
| name: Sign Package | |
| if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) }} | |
| runs-on: windows-latest | |
| environment: PackageSign | |
| permissions: | |
| id-token: write # Required for requesting the JWT | |
| needs: | |
| - build | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: NuGet | |
| path: artifacts\NuGet | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '9.0.x' | |
| - name: Setup SignClient | |
| run: dotnet tool install --tool-path . sign --version 0.9.1-beta.25278.1 | |
| # Login to Azure using a ServicePrincipal configured to authenticate against a GitHub Action | |
| - name: 'Az CLI login' | |
| uses: azure/login@v1 | |
| with: | |
| allow-no-subscriptions: true | |
| client-id: ${{ secrets.SIGN_AZURE_CLIENT_ID }} | |
| tenant-id: ${{ secrets.SIGN_AZURE_TENANT_ID }} | |
| subscription-id: ${{ secrets.SIGN_AZURE_SUBSCRIPTION_ID }} | |
| # Run the signing command | |
| - name: Sign artifacts | |
| shell: pwsh | |
| run: > | |
| ./sign code azure-key-vault | |
| artifacts\NuGet\*.nupkg | |
| --publisher-name "Uno.Devtools.Telemetry" | |
| --description-url "https://github.com/${{ env.GITHUB_REPOSITORY }}" | |
| --description "Uno.Devtools.Telemetry" | |
| --azure-key-vault-managed-identity true | |
| --azure-key-vault-url "${{ secrets.SIGN_KEY_VAULT_URL }}" | |
| --azure-key-vault-certificate "${{ secrets.SIGN_KEY_VAULT_CERTIFICATE_ID }}" | |
| --verbosity information | |
| - name: Upload Signed Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: NuGet-Signed | |
| path: .\artifacts\NuGet | |
| publish_dev: | |
| name: Publish Dev | |
| if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
| runs-on: windows-latest | |
| environment: Development | |
| needs: | |
| - sign | |
| steps: | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: NuGet-Signed | |
| path: artifacts | |
| - name: NuGet Push | |
| shell: pwsh | |
| run: | | |
| dotnet nuget push artifacts\*.nupkg -s https://api.nuget.org/v3/index.json -k "${{ secrets.NUGET_ORG_API_KEY }}" | |
| publish_prod: | |
| name: Publish Production | |
| if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/') }} | |
| runs-on: windows-latest | |
| environment: Production | |
| needs: | |
| - sign | |
| steps: | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: NuGet-Signed | |
| path: artifacts | |
| - name: NuGet Push | |
| shell: pwsh | |
| run: | | |
| dotnet nuget push artifacts\*.nupkg -s https://api.nuget.org/v3/index.json -k "${{ secrets.NUGET_ORG_API_KEY }}" |