Bump Microsoft.AspNetCore.Components.WebAssembly.Server from 10.0.0 to 10.0.3 #51
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: Build, Test, and Deploy Try .NET API | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| environment: "BuildAndUploadImage" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: 'src/**/package-lock.json' | |
| - name: Build and test microsoft-trydotnet | |
| working-directory: src/microsoft-trydotnet | |
| run: | | |
| npm ci | |
| npm run buildProd | |
| npm run ciTest | |
| - name: Build and test microsoft-trydotnet-editor | |
| working-directory: src/microsoft-trydotnet-editor | |
| run: | | |
| npm ci | |
| npm run buildProd | |
| npm run ciTest | |
| - name: Build microsoft-trydotnet-styles | |
| working-directory: src/microsoft-trydotnet-styles | |
| run: | | |
| npm ci | |
| npm run buildProd | |
| - name: Build microsoft-learn-mock | |
| working-directory: src/microsoft-learn-mock | |
| run: | | |
| npm ci | |
| npm run buildProd | |
| - name: Set up .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: global.json | |
| - name: Set up dependency caching for faster builds | |
| uses: actions/cache@v5 | |
| id: nuget-cache | |
| with: | |
| path: | | |
| ~/.nuget/packages | |
| ${{ github.workspace }}/**/obj/project.assets.json | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
| ${{ runner.os }}-nuget- | |
| - name: Restore with dotnet | |
| run: dotnet restore | |
| - name: Build with dotnet | |
| run: dotnet build -p:ContinuousIntegrationBuild=True -p:ReleaseDateAttribute=True --configuration Release --no-restore | |
| - name: Run .NET Tests | |
| id: run-dotnet-tests | |
| continue-on-error: true | |
| run: dotnet test --no-build --configuration Release --blame-hang-timeout 15m --blame-hang-dump-type full -l trx --results-directory ./TestResults | |
| env: | |
| POCKETLOGGER_LOG_PATH: ${{ github.workspace }}/artifacts/logs/pocketlogger.log | |
| - name: Convert TRX to Playlist | |
| if: ${{ steps.run-dotnet-tests.outcome == 'failure' }} | |
| uses: BenjaminMichaelis/trx-to-vsplaylist@v3 | |
| with: | |
| trx-file-path: './TestResults/*.trx' | |
| test-outcomes: 'Failed' | |
| artifact-name: 'linux-test-playlists' | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| # Build but no push with a PR | |
| - name: Docker build (no push) | |
| if: github.event_name == 'pull_request' || github.event_name == 'merge_group' | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: false | |
| tags: temp-pr-validation | |
| file: ./Dockerfile | |
| - name: Build Container Image | |
| if: github.event_name != 'pull_request_target' && github.event_name != 'pull_request' | |
| uses: docker/build-push-action@v6 | |
| with: | |
| tags: ${{ vars.DEVCONTAINER_REGISTRY }}/try:${{ github.sha }},${{ vars.DEVCONTAINER_REGISTRY }}/try:latest | |
| file: ./Dockerfile | |
| context: . | |
| outputs: type=docker,dest=${{ github.workspace }}/tryimage.tar | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Upload artifact | |
| if: github.event_name != 'pull_request_target' && github.event_name != 'pull_request' | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: tryimage | |
| path: ${{ github.workspace }}/tryimage.tar | |
| build-and-test-windows: | |
| # Ensures .NET build and unit tests pass on Windows, matching the original | |
| # Azure DevOps Windows_NT job. Integration tests are covered separately. | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: 'src/**/package-lock.json' | |
| - name: Build microsoft-trydotnet | |
| working-directory: src/microsoft-trydotnet | |
| run: | | |
| npm ci | |
| npm run buildProd | |
| - name: Build microsoft-trydotnet-editor | |
| working-directory: src/microsoft-trydotnet-editor | |
| run: | | |
| npm ci | |
| npm run buildProd | |
| - name: Build microsoft-trydotnet-styles | |
| working-directory: src/microsoft-trydotnet-styles | |
| run: | | |
| npm ci | |
| npm run buildProd | |
| - name: Build microsoft-learn-mock | |
| working-directory: src/microsoft-learn-mock | |
| run: | | |
| npm ci | |
| npm run buildProd | |
| - name: Set up .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: global.json | |
| - name: Set up dependency caching for faster builds | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Restore with dotnet | |
| run: dotnet restore | |
| - name: Build with dotnet | |
| run: dotnet build -p:ContinuousIntegrationBuild=True -p:ReleaseDateAttribute=True --configuration Release --no-restore | |
| - name: Run .NET Tests | |
| id: run-dotnet-tests | |
| continue-on-error: true | |
| run: dotnet test --no-build --configuration Release --blame-hang-timeout 15m --blame-hang-dump-type full -l trx --results-directory ./TestResults | |
| env: | |
| POCKETLOGGER_LOG_PATH: ${{ github.workspace }}/artifacts/logs/pocketlogger.log | |
| - name: Convert TRX to Playlist | |
| if: ${{ steps.run-dotnet-tests.outcome == 'failure' }} | |
| uses: BenjaminMichaelis/trx-to-vsplaylist@v3 | |
| with: | |
| trx-file-path: './TestResults/*.trx' | |
| test-outcomes: 'Failed' | |
| artifact-name: 'windows-test-playlists' | |
| integration-tests: | |
| # Integration tests use Playwright and are gated behind RunIntegrationTests=true. | |
| # IntegrationTestFactAttribute explicitly skips these tests on Linux, so a | |
| # Windows runner is required to actually execute them. | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: 'src/**/package-lock.json' | |
| - name: Build microsoft-trydotnet | |
| working-directory: src/microsoft-trydotnet | |
| run: | | |
| npm ci | |
| npm run buildProd | |
| - name: Build microsoft-trydotnet-editor | |
| working-directory: src/microsoft-trydotnet-editor | |
| run: | | |
| npm ci | |
| npm run buildProd | |
| - name: Build microsoft-trydotnet-styles | |
| working-directory: src/microsoft-trydotnet-styles | |
| run: | | |
| npm ci | |
| npm run buildProd | |
| - name: Build microsoft-learn-mock | |
| working-directory: src/microsoft-learn-mock | |
| run: | | |
| npm ci | |
| npm run buildProd | |
| - name: Set up .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: global.json | |
| - name: Set up dependency caching for faster builds | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Restore with dotnet | |
| run: dotnet restore | |
| - name: Build with dotnet | |
| run: dotnet build -p:ContinuousIntegrationBuild=True -p:ReleaseDateAttribute=True --configuration Release --no-restore | |
| - name: Run .NET Integration Tests | |
| id: run-dotnet-integration-tests | |
| continue-on-error: true | |
| run: dotnet test --no-build --configuration Release --blame-hang-timeout 15m --blame-hang-dump-type full -l trx --results-directory ./TestResults | |
| env: | |
| RunIntegrationTests: true | |
| POCKETLOGGER_LOG_PATH: ${{ github.workspace }}/artifacts/logs/pocketlogger.log | |
| TRYDOTNET_PREBUILDS_PATH: ${{ github.workspace }}/artifacts/trydotnet-prebuilds | |
| - name: Convert TRX to Playlist | |
| if: ${{ steps.run-dotnet-integration-tests.outcome == 'failure' }} | |
| uses: BenjaminMichaelis/trx-to-vsplaylist@v3 | |
| with: | |
| trx-file-path: './TestResults/*.trx' | |
| test-outcomes: 'Failed' | |
| artifact-name: 'integration-test-playlists' | |
| deploy-development: | |
| if: github.event_name != 'pull_request_target' && github.event_name != 'pull_request' | |
| runs-on: ubuntu-latest | |
| needs: [build-and-test, build-and-test-windows, integration-tests] | |
| environment: | |
| name: "Development" | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Azure Login | |
| uses: azure/login@v2 | |
| with: | |
| client-id: ${{ secrets.ESSENTIALCSHARPDEV_CLIENT_ID }} | |
| tenant-id: ${{ secrets.ESSENTIALCSHARP_TENANT_ID }} | |
| subscription-id: ${{ secrets.ESSENTIALCSHARP_SUBSCRIPTION_ID }} | |
| - name: Download artifact | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: tryimage | |
| path: ${{ github.workspace }} | |
| - name: Load image | |
| run: | | |
| docker load --input ${{ github.workspace }}/tryimage.tar | |
| docker image ls -a | |
| - name: Log in to container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ vars.DEVCONTAINER_REGISTRY }} | |
| username: ${{ secrets.ESSENTIALCSHARP_ACR_USERNAME }} | |
| password: ${{ secrets.ESSENTIALCSHARP_ACR_PASSWORD }} | |
| - name: Push Image to Container Registry | |
| env: | |
| REGISTRY_URL: ${{ vars.DEVCONTAINER_REGISTRY }} | |
| run: docker push --all-tags $REGISTRY_URL/try | |
| - name: Create and Deploy to Container App | |
| uses: azure/CLI@v2 | |
| env: | |
| CONTAINER_APP_NAME: ${{ vars.CONTAINER_APP_NAME }} | |
| RESOURCEGROUP: ${{ vars.RESOURCEGROUP }} | |
| CONTAINER_APP_ENVIRONMENT: ${{ vars.CONTAINER_APP_ENVIRONMENT }} | |
| REGISTRY_URL: ${{ vars.DEVCONTAINER_REGISTRY }} | |
| ACR_USERNAME: ${{ secrets.ESSENTIALCSHARP_ACR_USERNAME }} | |
| ACR_PASSWORD: ${{ secrets.ESSENTIALCSHARP_ACR_PASSWORD }} | |
| with: | |
| inlineScript: | | |
| az config set extension.use_dynamic_install=yes_without_prompt | |
| az containerapp up -n $CONTAINER_APP_NAME -g $RESOURCEGROUP --image $REGISTRY_URL/try:${{ github.sha }} --environment $CONTAINER_APP_ENVIRONMENT --registry-server $REGISTRY_URL --ingress external --registry-username $ACR_USERNAME --registry-password $ACR_PASSWORD --target-port 80 --debug | |
| - name: Logout of Azure CLI | |
| if: always() | |
| uses: azure/CLI@v2 | |
| with: | |
| inlineScript: | | |
| az logout | |
| az cache purge | |
| az account clear |