ci(deps): Bump the github-actions group with 2 updates #258
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
| # Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy | |
| # More GitHub Actions for Azure: https://github.com/Azure/actions | |
| name: Build, Analyze and Deploy | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup-dotnet | |
| - name: Build solution (Debug) | |
| run: dotnet build --no-incremental | |
| - name: Test with the dotnet CLI (OpenCover) | |
| run: dotnet test PathfinderHonorManager.Tests/PathfinderHonorManager.Tests.csproj /p:CollectCoverage=true /p:CoverletOutput=TestResults/coverage.opencover.xml /p:CoverletOutputFormat=opencover /p:Exclude="[PathfinderHonorManager.Tests*]*" | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: coverage-report | |
| path: PathfinderHonorManager.Tests/TestResults/coverage.opencover.xml | |
| sonar: | |
| name: SonarQube Analysis | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: ./.github/actions/setup-dotnet | |
| - name: Download coverage report | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: coverage-report | |
| path: . | |
| - name: Cache SonarQube packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.sonar/cache | |
| key: ${{ runner.os }}-sonar | |
| restore-keys: ${{ runner.os }}-sonar | |
| - name: Cache SonarQube scanner | |
| id: cache-sonar-scanner | |
| uses: actions/cache@v5 | |
| with: | |
| path: ./.sonar/scanner | |
| key: ${{ runner.os }}-sonar-scanner | |
| restore-keys: ${{ runner.os }}-sonar-scanner | |
| - name: Install SonarQube scanner | |
| if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' | |
| run: | | |
| mkdir -p ./.sonar/scanner | |
| dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner | |
| - name: SonarQube begin analysis | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| run: | | |
| ./.sonar/scanner/dotnet-sonarscanner begin /k:"PathfinderHonorManager_PathfinderHonorManagerAPI" /o:"pathfinderhonormanager" /d:sonar.token="$SONAR_TOKEN" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="coverage.opencover.xml" /d:sonar.exclusions="**/Migrations/**" | |
| - name: Build solution (for SonarQube) | |
| run: dotnet build --no-incremental | |
| - name: SonarQube end analysis | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| run: ./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="$SONAR_TOKEN" | |
| build: | |
| needs: [sonar, test] | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup-dotnet | |
| - name: Build with dotnet (Release) | |
| run: dotnet build --configuration Release | |
| - name: Install EF Tools | |
| run: dotnet tool install --global dotnet-ef | |
| - name: Generate Migration Script for Review | |
| run: | | |
| dotnet ef migrations script --output migration.sql | |
| working-directory: ./PathfinderHonorManager | |
| - name: Upload Migration Script | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: migration-script | |
| path: PathfinderHonorManager/migration.sql | |
| - name: dotnet publish | |
| run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp | |
| - name: App Settings Variable Substitution | |
| uses: microsoft/variable-substitution@v1 | |
| with: | |
| files: '${{env.DOTNET_ROOT}}/myapp/appsettings.json' | |
| env: | |
| ConnectionStrings.PathfinderCS: ${{ secrets.PRODCONNECTIONSTRING }} | |
| ConnectionStrings.PathfinderMigrationCS: ${{ secrets.PROD_ADMIN_CONNECTIONSTRING }} | |
| App.ServerRootAddress: ${{ env.SERVER_ROOT_ADDRESS }} | |
| - name: Upload artifact for deployment job | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: .net-app | |
| path: ${{env.DOTNET_ROOT}}/myapp | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: 'Production' | |
| url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Download artifact from build job | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: .net-app | |
| - name: Deploy to Azure Web App | |
| id: deploy-to-webapp | |
| uses: azure/webapps-deploy@v3 | |
| with: | |
| app-name: 'pathfinderhonormanager' | |
| slot-name: 'Production' | |
| publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_46A3FB3D879943E7A591444B0C0E5833 }} | |
| package: . |