Deploy to by @renovate[bot] #697
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: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| merge_group: | |
| run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }} | |
| # Set up permissions | |
| # https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Clinux#set-up-azure-login-with-openid-connect-authentication | |
| permissions: | |
| id-token: write | |
| contents: read | |
| pull-requests: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| backend: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: global.json | |
| - name: Build .NET solution | |
| run: dotnet build --configuration Release | |
| - name: Run .NET tests | |
| run: dotnet test --no-build --configuration Release -- --coverage --coverage-output coverage.xml --coverage-output-format cobertura --coverage-settings "${{ github.workspace }}/coverage.config" | |
| - name: ReportGenerator | |
| uses: danielpalme/ReportGenerator-GitHub-Action@v5.5.1 | |
| with: | |
| reports: '**/coverage.xml' | |
| targetdir: 'coveragereport' | |
| reporttypes: 'HtmlInline;Cobertura;MarkdownSummaryGithub' | |
| tag: '${{ github.run_number }}_${{ github.run_id }}' | |
| customSettings: 'minimumCoverageThresholds:lineCoverage=70' | |
| - name: Upload .NET coverage report artifact | |
| uses: actions/upload-artifact@v6 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: CoverageReport | |
| path: coveragereport | |
| - name: Report .NET Coverage | |
| if: github.event_name == 'pull_request' | |
| run: gh pr comment $PR_NUMBER --body-file coveragereport/SummaryGithub.md | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ github.event.number }} | |
| - name: Publish coverage in build summary | |
| run: cat coveragereport/SummaryGithub.md >> $GITHUB_STEP_SUMMARY | |
| shell: bash | |
| - uses: stoplightio/spectral-action@latest | |
| with: | |
| file_glob: '**/documentation/*.json' | |
| frontend: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup-pnpm | |
| - name: Install Playwright Browsers | |
| run: pnpm --filter='sandbox.e2e' exec playwright install --with-deps | |
| - name: Build Angular workspace | |
| run: pnpm --filter="sandbox.angular-workspace" build | |
| - name: Lint all frontend projects | |
| run: pnpm run -r lint | |
| - name: Unit test all frontend projects | |
| run: pnpm --filter="!sandbox.e2e" test --coverage | |
| - name: Upload Vitest coverage report artifact | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: coverage-frontend | |
| path: Sandbox.AngularWorkspace/coverage/sandbox-app | |
| - name: Report Vitest Coverage | |
| if: github.event_name == 'pull_request' | |
| uses: davelosert/vitest-coverage-report-action@v2 | |
| with: | |
| threshold-icons: "{0: '🔴', 50: '🟠', 70: '🟢'}" | |
| json-summary-path: Sandbox.AngularWorkspace/coverage/sandbox-app/coverage-summary.json | |
| json-final-path: Sandbox.AngularWorkspace/coverage/sandbox-app/coverage-final.json | |
| file-coverage-mode: 'all' | |
| name: 'Frontend Vitest Coverage' | |
| e2e: | |
| runs-on: ubuntu-latest | |
| needs: [backend, frontend] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: global.json | |
| - uses: ./.github/actions/setup-pnpm | |
| - name: Install Playwright Browsers | |
| run: pnpm --filter='sandbox.e2e' exec playwright install --with-deps | |
| - name: Install SOPS | |
| run: | | |
| curl -Lo sops "https://github.com/getsops/sops/releases/download/v3.9.1/sops-v3.9.1.linux.amd64" | |
| chmod +x sops | |
| sudo mv sops /usr/local/bin/ | |
| - name: Decrypt appsettings | |
| run: sops --decrypt "config/appsettings.encrypted.json" > "Sandbox.AppHost/appsettings.json" | |
| env: | |
| SOPS_AGE_KEY: ${{ secrets.SOPS_AGE_KEY }} | |
| - name: E2E test frontend projects | |
| run: pnpm --filter="sandbox.e2e" test | |
| env: | |
| PLAYWRIGHT_USERNAME: ${{ secrets.PLAYWRIGHT_USERNAME }} | |
| PLAYWRIGHT_PASSWORD: ${{ secrets.PLAYWRIGHT_PASSWORD }} | |
| APPLICATION_URL: ${{ vars.APPLICATION_URL }} | |
| DATABASE_URL: ${{ vars.DATABASE_URL }} | |
| - name: Upload E2E Results Artifact | |
| uses: actions/upload-artifact@v6 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: playwright-report | |
| path: ./Sandbox.EndToEndTests/playwright-report/ | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: [backend, frontend, e2e] | |
| if: github.ref == 'refs/heads/main' | |
| env: | |
| AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} | |
| AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} | |
| AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} | |
| AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }} | |
| AZURE_LOCATION: ${{ vars.AZURE_LOCATION }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup-pnpm | |
| - name: Install azd | |
| uses: Azure/setup-azd@v2 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: global.json | |
| - name: Log in with Azure (Federated Credentials) | |
| run: | | |
| azd auth login ` | |
| --client-id "$Env:AZURE_CLIENT_ID" ` | |
| --federated-credential-provider "github" ` | |
| --tenant-id "$Env:AZURE_TENANT_ID" | |
| shell: pwsh | |
| - name: Install SOPS | |
| run: | | |
| curl -Lo sops "https://github.com/getsops/sops/releases/download/v3.9.1/sops-v3.9.1.linux.amd64" | |
| chmod +x sops | |
| sudo mv sops /usr/local/bin/ | |
| - name: Decrypt appsettings | |
| run: sops --decrypt "config/appsettings.encrypted.json" > "Sandbox.AppHost/appsettings.json" | |
| env: | |
| SOPS_AGE_KEY: ${{ secrets.SOPS_AGE_KEY }} | |
| # - name: Provision Infrastructure | |
| # run: azd provision --no-prompt | |
| # env: | |
| # AZD_INITIAL_ENVIRONMENT_CONFIG: ${{ secrets.AZD_INITIAL_ENVIRONMENT_CONFIG }} | |
| # - name: Deploy Application | |
| # run: azd deploy --no-prompt |