Skip to content

[PRMP-915] download report feature to support review report #3874

[PRMP-915] download report feature to support review report

[PRMP-915] download report feature to support review report #3874

name: "CI UI - Development CI Feature Branch to Main"
on:
push:
branches:
- main
paths:
- ".github/**"
- "app/**"
- "Makefile"
pull_request:
branches:
- main
paths:
- ".github/**"
- "app/**"
- "Makefile"
workflow_call:
secrets:
AWS_ASSUME_ROLE:
required: true
permissions:
actions: read # Required for anchore/sbom-action
contents: write # Required for anchore/sbom-action
pull-requests: write
id-token: write # This is required for requesting the JWT
jobs:
react_testing_job:
name: Run UI Unit Tests
uses: ./.github/workflows/base-vitest-test.yml
with:
build_branch: ${{ github.event.pull_request.head.ref }}
cypress_build_job:
name: Build UI version for E2E Tests
uses: ./.github/workflows/base-cypress-build.yml
with:
build_branch: ${{ github.event.pull_request.head.ref }}
cypress_test_job:
name: Run Cypress E2E Tests
needs: [cypress_build_job]
uses: ./.github/workflows/base-cypress-test-all-env.yml
with:
cypress_base_url: ${{ vars.CYPRESS_BASE_URL }}
build_branch: ${{ github.event.pull_request.head.ref }}
deploy_ui:
name: Deploy UI
if: github.ref == 'refs/heads/main'
needs: ["react_testing_job", "cypress_test_job"]
uses: ./.github/workflows/base-deploy-ui.yml
with:
build_branch: ${{ github.event.pull_request.head.ref }}
environment: development
sandbox: ndr-dev
secrets:
AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }}
notify-slack:
name: Notify Slack on Failure
runs-on: ubuntu-latest
environment: development
needs: [react_testing_job, cypress_build_job, cypress_test_job, deploy_ui]
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v5
with:
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
role-skip-session-tagging: true
aws-region: ${{ vars.AWS_REGION }}
mask-aws-account-id: true
- name: Get slack bot token from SSM parameter store
run: |
slack_bot_token=$(aws ssm get-parameter --name "/ndr/alerting/slack/bot_token" --with-decryption --query "Parameter.Value" --output text)
echo "::add-mask::$slack_bot_token"
echo "SLACK_BOT_TOKEN=$slack_bot_token" >> $GITHUB_ENV
- name: Send Slack Notification
uses: slackapi/slack-github-action@v2.1.1
with:
method: chat.postMessage
token: ${{ env.SLACK_BOT_TOKEN }}
payload: |
{
"channel": "${{ vars.ALERTS_SLACK_CHANNEL_ID }}",
"attachments": [
{
"color": "#ff0000",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "❌ Workflow `${{ github.workflow }}` failed"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Triggered by:* `${{ github.actor }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>"
}
},
{
"type": "divider"
},
{
"type": "section",
"fields": [
{ "type": "mrkdwn", "text": "*react_testing_job:* ${{ needs.react_testing_job.result == 'success' && ':white_check_mark:' || ':x:' }}" },
{ "type": "mrkdwn", "text": "*cypress_build_job:* ${{ needs.cypress_build_job.result == 'success' && ':white_check_mark:' || ':x:' }}" },
{ "type": "mrkdwn", "text": "*cypress_test_job:* ${{ needs.cypress_test_job.result == 'success' && ':white_check_mark:' || ':x:' }}" },
{ "type": "mrkdwn", "text": "*deploy_ui:* ${{ needs.deploy_ui.result == 'success' && ':white_check_mark:' || ':x:' }}" }
]
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Environment: `development` | Sandbox: `ndr-dev`"
}
]
}
]
}
]
}