SalesforceCommerceCloud/pwa-kit/performance-metrics #130
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: SalesforceCommerceCloud/pwa-kit/performance-metrics | |
| on: | |
| workflow_dispatch: # Allows you to manually run the workflow on any branch. | |
| schedule: | |
| # Run every day at 7pm (PST) - cron uses UTC times. | |
| # We want to run it before the performance tests are scheduled to run. | |
| # Runs on the default branch. | |
| - cron: '0 3 * * *' | |
| env: | |
| MRT_PROJECT_ID: q4-pwa-perf-develop | |
| MRT_ENVIRONMENT_ID: production | |
| jobs: | |
| deploy-latest-changes: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - name: Install Monorepo Dependencies | |
| run: |- | |
| npm ci | |
| - name: Generate App | |
| id: generate_app | |
| uses: ./.github/actions/e2e_generate_app | |
| with: | |
| PROJECT_KEY: "retail-react-app-performance-tests" | |
| - name: Create MRT credentials file | |
| uses: './.github/actions/create_mrt' | |
| with: | |
| mobify_user: ${{ secrets.MRT_STG_Q4_PWA_PERF_API_USER }} | |
| mobify_api_key: ${{ secrets.MRT_STG_Q4_PWA_PERF_API_KEY }} | |
| - name: Push Bundle to MRT | |
| uses: './.github/actions/push_to_mrt' | |
| with: | |
| CWD: '${{ steps.generate_app.outputs.project_path }}' | |
| PROJECT: ${{ env.MRT_PROJECT_ID }} | |
| TARGET: ${{ env.MRT_ENVIRONMENT_ID }} | |
| CLOUD_ORIGIN: ${{ vars.MRT_STG_CLOUD_ORIGIN }} | |
| FLAGS: --wait | |
| notify-slack: | |
| needs: [deploy-latest-changes] | |
| if: ${{ always() }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Send GitHub Action data to Slack workflow (Success) | |
| id: slack-success | |
| if: ${{ github.event_name == 'schedule' && needs.deploy-latest-changes.result == 'success' }} | |
| uses: slackapi/slack-github-action@v1.23.0 | |
| with: | |
| payload: | | |
| { | |
| "message": "✅ Deployed the latest changes from `develop` branch to MRT project `${{ env.MRT_PROJECT_ID }}`: https://runtime-admin-staging.mobify-storefront.com/salesforce-internal/${{ env.MRT_PROJECT_ID }}/${{ env.MRT_ENVIRONMENT_ID }}" | |
| } | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.PERF_WORKFLOW_SLACK_WEBHOOK_URL }} | |
| - name: Send GitHub Action data to Slack workflow (Failure) | |
| id: slack-failure | |
| if: ${{ github.event_name == 'schedule' && needs.deploy-latest-changes.result != 'success' }} | |
| uses: slackapi/slack-github-action@v1.23.0 | |
| with: | |
| payload: | | |
| { | |
| "message": "❌ Please check the logs for details. (${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" | |
| } | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.PERF_WORKFLOW_SLACK_WEBHOOK_URL }} |