Bump the angular group across 1 directory with 14 updates #1019
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
types: [opened, synchronize, reopened, closed] | |
branches: [ "master" ] | |
workflow_dispatch: | |
jobs: | |
build: | |
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.action != 'closed') | |
runs-on: ubuntu-latest | |
permissions: | |
security-events: write | |
packages: read | |
actions: read | |
contents: write | |
pull-requests: write | |
checks: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 20.14.0 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.14.0 | |
- run: npm ci | |
working-directory: src | |
- run: npm run lint | |
working-directory: src | |
- run: npm run build | |
working-directory: src | |
- name: Run unit tests | |
run: npm run ci-test | |
working-directory: src | |
- name: Publish Unit Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
check_name: Unit Test Results | |
files: | | |
src/test-results/unit-tests/*.xml | |
- name: Code Coverage Summary Report (Unit Tests) | |
uses: irongut/CodeCoverageSummary@v1.3.0 | |
if: always() | |
with: | |
filename: src/test-results/unit-tests/code-coverage/cobertura/cobertura-coverage.xml | |
badge: true | |
format: 'markdown' | |
output: 'both' | |
hide_complexity: true | |
- name: Add title to coverage report | |
run: | | |
"# Unit Tests Code Coverage" | Set-Content -Path unit-tests-code-coverage-results.md | |
Get-Content -Path code-coverage-results.md | Add-Content -Path unit-tests-code-coverage-results.md | |
shell: pwsh | |
- name: Add Coverage PR Comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
if: always() | |
with: | |
recreate: true | |
header: Unit Tests Code Coverage | |
path: unit-tests-code-coverage-results.md | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: javascript-typescript | |
build-mode: none | |
config-file: ./.github/codeql/codeql-config.yml | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v3 | |
with: | |
category: "/language:javascript-typescript" | |
- name: Copy staticwebapp.config.json | |
run: cp src/staticwebapp.config.json src/dist/dive-intelligence/browser/staticwebapp.config.json | |
# deploy PR to preview site | |
- name: Find PR comment to update | |
if: github.event_name == 'pull_request' | |
uses: peter-evans/find-comment@v3 | |
id: find-comment | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: This PR has been deployed to a [preview site](https://kind-beach-03c93dc0f-pr${{ github.event.pull_request.number }}.eastus2.3.azurestaticapps.net/) for testing. | |
- name: Create/update PR comment with in progress message | |
if: github.event_name == 'pull_request' | |
uses: peter-evans/create-or-update-comment@v4 | |
id: wip-comment | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-id: ${{ steps.find-comment.outputs.comment-id }} | |
edit-mode: replace | |
body: | | |
:construction: :construction: The application is being deployed to a preview site. Please wait for the deployment to complete. :construction: :construction: | |
- name: Deploy to preview site | |
if: github.event_name == 'pull_request' | |
run: npm run deploy -- --env "pr${{ github.event.pull_request.number }}" --deployment-token ${{ secrets.SWA_DEPLOYMENT_TOKEN }} | |
working-directory: src | |
- name: Get current date | |
if: github.event_name == 'pull_request' | |
id: date | |
run: echo "date=$(date --utc +'%FT%TZ')" >> $GITHUB_OUTPUT | |
- name: Update PR comment with link to preview site | |
if: github.event_name == 'pull_request' | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-id: ${{ steps.wip-comment.outputs.comment-id }} | |
edit-mode: replace | |
body: | | |
This PR has been deployed to a [preview site](https://kind-beach-03c93dc0f-pr${{ github.event.pull_request.number }}.eastus2.3.azurestaticapps.net/) for testing. | |
This site will automatically be deleted when the PR is merged. | |
Last deployed: ${{ steps.date.outputs.date }} (UTC) | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
working-directory: src | |
- name: Run UI automation tests on preview site | |
if: github.event_name == 'pull_request' | |
run: npm run playwright | |
working-directory: src | |
env: | |
PLAYWRIGHT_BASE_URL: 'https://kind-beach-03c93dc0f-pr${{ github.event.pull_request.number }}.eastus2.3.azurestaticapps.net' | |
- name: Run UI automation tests locally | |
if: github.event_name != 'pull_request' | |
run: npm run playwright | |
working-directory: src | |
- name: Publish UI Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
check_name: UI Test Results | |
files: | | |
src/test-results/playwright/*.xml | |
- name: Upload Playwright report | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: src/test-results/playwright/ | |
# deploy to production | |
- name: Set Instrumentation Key | |
if: github.ref == 'refs/heads/master' | |
uses: jossef/action-set-json-field@v2.2 | |
with: | |
file: src/dist/dive-intelligence/browser/assets/config.json | |
field: instrumentationKey | |
value: ${{ vars.INSTRUMENTATION_KEY }} | |
- name: Upload Source Maps | |
if: github.ref == 'refs/heads/master' | |
run: az storage blob upload-batch --connection-string "${{ secrets.SOURCE_MAPS_CONNECTION_STRING}}" --source src/dist/dive-intelligence/browser --destination sourcemaps --overwrite true | |
- name: Deploy to Azure Static Web Apps | |
if: github.ref == 'refs/heads/master' | |
run: npm run deploy -- --env production --deployment-token ${{ secrets.SWA_DEPLOYMENT_TOKEN }} | |
working-directory: src | |
delete-preview-site: | |
if: github.event_name == 'pull_request' && github.event.action == 'closed' | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
id-token: write | |
steps: | |
- name: Azure Login | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Find PR comment to update | |
uses: peter-evans/find-comment@v3 | |
id: find-comment | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: This PR has been deployed to a [preview site](https://kind-beach-03c93dc0f-pr${{ github.event.pull_request.number }}.eastus2.3.azurestaticapps.net/) for testing. | |
- name: Update PR comment with being deleted message | |
if: github.event_name == 'pull_request' | |
uses: peter-evans/create-or-update-comment@v4 | |
id: deleting-comment | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-id: ${{ steps.find-comment.outputs.comment-id }} | |
edit-mode: replace | |
body: | | |
:construction: :construction: The preview site for this PR is being deleted. :construction: :construction: | |
- name: Delete preview site | |
uses: azure/cli@v2 | |
with: | |
azcliversion: latest | |
inlineScript: az staticwebapp environment delete --name DiveIntelligence --environment-name "pr${{ github.event.pull_request.number }}" --resource-group DiveIntelligence --yes | |
- name: Update PR comment to indicate site has been deleted | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-id: ${{ steps.deleting-comment.outputs.comment-id }} | |
edit-mode: replace | |
body: | | |
:no_entry_sign: :no_entry_sign: The preview site for this PR has been deleted. :no_entry_sign: :no_entry_sign: |