Skip to content

SalesforceCommerceCloud/pwa-kit/performance-metrics #13

SalesforceCommerceCloud/pwa-kit/performance-metrics

SalesforceCommerceCloud/pwa-kit/performance-metrics #13

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 * * *'
jobs:
run-performance-metrics:
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: q4-pwa-perf-develop
TARGET: production
CLOUD_ORIGIN: ${{ vars.MRT_STG_CLOUD_ORIGIN }}
FLAGS: --wait
notify-slack:
needs: [run-performance-metrics]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Send GitHub Action data to Slack workflow (Performance Metrics Success)
id: slack-success
if: ${{ github.event_name == 'schedule' && needs.run-performance-metrics.result == 'success' }}
uses: slackapi/slack-github-action@v1.23.0
with:
payload: |
{
"message": "✅ Performance metrics workflow: successfully deployed bundle for performance testing."
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Send GitHub Action data to Slack workflow (Performance Metrics Failure)
id: slack-failure
if: ${{ github.event_name == 'schedule' && needs.run-performance-metrics.result != 'success' }}
uses: slackapi/slack-github-action@v1.23.0
with:
payload: |
{
"message": "❌ Performance metrics workflow: please check the logs for details. (${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}