diff --git a/.github/actions/nr-report-build-size/action.yml b/.github/actions/nr-report-build-size/action.yml deleted file mode 100644 index d5a70790a..000000000 --- a/.github/actions/nr-report-build-size/action.yml +++ /dev/null @@ -1,47 +0,0 @@ -# This composite action is used to report the local build size to New Relic -# You must build the agent before running this action - -name: 'Report Build Size to New Relic' - -inputs: - nr-api-key: - description: 'NR API Key for reporting events' - required: true - -runs: - using: "composite" - steps: - - name: Install dependencies - run: npm install --silent --no-progress --prefix $GITHUB_ACTION_PATH/.. - shell: bash - - name: Get local stats - id: get-stats - shell: bash - run: | - rum=$(cat ./build/nr-rum-standard.stats.json); echo "rum=$rum" >> $GITHUB_OUTPUT; - full=$(cat ./build/nr-full-standard.stats.json); echo "full=$full" >> $GITHUB_OUTPUT; - spa=$(cat ./build/nr-spa-standard.stats.json); echo "spa=$spa" >> $GITHUB_OUTPUT; - - name: Report rum size to NR - uses: metal-messiah/webpack-build-size-action@main - with: - nr-api-key: ${{ inputs.nr-api-key }} - nr-account-id: '550352' - nr-env: 'staging' - analysis-file-contents: ${{ steps.get-stats.outputs.rum }} - file-name-filter: '.min.js' - - name: Report full size to NR - uses: metal-messiah/webpack-build-size-action@main - with: - nr-api-key: ${{ inputs.nr-api-key }} - nr-account-id: '550352' - nr-env: 'staging' - analysis-file-contents: ${{ steps.get-stats.outputs.full }} - file-name-filter: '.min.js' - - name: Report spa size to NR - uses: metal-messiah/webpack-build-size-action@main - with: - nr-api-key: ${{ inputs.nr-api-key }} - nr-account-id: '550352' - nr-env: 'staging' - analysis-file-contents: ${{ steps.get-stats.outputs.spa }} - file-name-filter: '.min.js' diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index b16ccacb9..c8d2e171c 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -14,6 +14,46 @@ jobs: browser-target: chrome@latest secrets: inherit + track-size: + name: Track Build Size + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: main + - uses: actions/setup-node@v4 + with: + node-version: 22.11.0 # See package.json for the stable node version that works with our testing. Do not change this unless you know what you are doing as some node versions do not play nicely with our testing server. + - name: Install project dependencies + run: npm ci + - name: Report lite size to NR + uses: newrelic/capture-build-size@main + with: + nr-api-key: ${{ secrets.INTERNAL_STAGING_INGEST_LICENSE_KEY }} + nr-account-id: ${{ secrets.INTERNAL_STAGING_INGEST_ACCOUNT_ID }} + nr-env: 'staging' + analysis-file-url: 'https://js-agent.newrelic.com/dev/nr-rum-standard.stats.json' + file-name-filter: '.min.js' + trigger: 'nightly' + - name: Report pro size to NR + uses: newrelic/capture-build-size@main + with: + nr-api-key: ${{ secrets.INTERNAL_STAGING_INGEST_LICENSE_KEY }} + nr-account-id: ${{ secrets.INTERNAL_STAGING_INGEST_ACCOUNT_ID }} + nr-env: 'staging' + analysis-file-url: 'https://js-agent.newrelic.com/dev/nr-full-standard.stats.json' + file-name-filter: '.min.js' + trigger: 'nightly' + - name: Report spa size to NR + uses: newrelic/capture-build-size@main + with: + nr-api-key: ${{ secrets.INTERNAL_STAGING_INGEST_LICENSE_KEY }} + nr-account-id: ${{ secrets.INTERNAL_STAGING_INGEST_ACCOUNT_ID }} + nr-env: 'staging' + analysis-file-url: 'https://js-agent.newrelic.com/dev/nr-full-standard.stats.json' + file-name-filter: '.min.js' + trigger: 'nightly' + verify-ab-assets: name: Verify A/B Assets timeout-minutes: 60 diff --git a/.github/workflows/publish-dev.yml b/.github/workflows/publish-dev.yml index 7408eed32..f506e1868 100644 --- a/.github/workflows/publish-dev.yml +++ b/.github/workflows/publish-dev.yml @@ -95,15 +95,47 @@ jobs: uses: newrelic/deployment-marker-action@v2.3.0 with: apiKey: ${{ secrets.INTERNAL_STAGING_INGEST_LICENSE_KEY }} - guid: NTUwMzUyfEJST1dTRVJ8QVBQTElDQVRJT058ODkzODM5MjI + guid: ${{ secrets.INTERNAL_STAGING_INGEST_ENTITY_GUID }} commit: "${{ github.sha }}" version: "${{ github.ref_name }}" user: "${{ github.actor }}" - # track build size as custom event - - name: Report local stats as NR event - uses: './.github/actions/nr-report-build-size' + - name: Get local stats + id: get-stats + shell: bash + run: | + rum=$(cat ./build/nr-rum-standard.stats.json); echo "rum=$rum" >> $GITHUB_OUTPUT; + full=$(cat ./build/nr-full-standard.stats.json); echo "full=$full" >> $GITHUB_OUTPUT; + spa=$(cat ./build/nr-spa-standard.stats.json); echo "spa=$spa" >> $GITHUB_OUTPUT; + - name: Report lite size to NR + uses: newrelic/capture-build-size@main + with: + nr-api-key: ${{ secrets.INTERNAL_STAGING_INGEST_LICENSE_KEY }} + nr-account-id: ${{ secrets.INTERNAL_STAGING_INGEST_ACCOUNT_ID }} + nr-env: 'staging' + analysis-file-contents: ${{ steps.get-stats.outputs.rum }} + file-name-filter: '.min.js' + trigger: 'publish-dev' + traverse: true + - name: Report pro size to NR + uses: newrelic/capture-build-size@main + with: + nr-api-key: ${{ secrets.INTERNAL_STAGING_INGEST_LICENSE_KEY }} + nr-account-id: ${{ secrets.INTERNAL_STAGING_INGEST_ACCOUNT_ID }} + nr-env: 'staging' + analysis-file-contents: ${{ steps.get-stats.outputs.full }} + file-name-filter: '.min.js' + trigger: 'publish-dev' + traverse: true + - name: Report spa size to NR + uses: newrelic/capture-build-size@main with: nr-api-key: ${{ secrets.INTERNAL_STAGING_INGEST_LICENSE_KEY }} + nr-account-id: ${{ secrets.INTERNAL_STAGING_INGEST_ACCOUNT_ID }} + nr-env: 'staging' + analysis-file-contents: ${{ steps.get-stats.outputs.spa }} + file-name-filter: '.min.js' + trigger: 'publish-dev' + traverse: true # Publish dev to staging NRDB # publish-dev-nr: diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 90ccb7d6b..58421602b 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -290,3 +290,60 @@ jobs: repo_owner: newrelic repo_name: newrelic-browser-agent-release event_type: new_release + + track-build-size: + needs: [notify-release-repo] + runs-on: ubuntu-latest + timeout-minutes: 30 + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22.11.0 # See package.json for the stable node version that works with our testing. Do not change this unless you know what you are doing as some node versions do not play nicely with our testing server. + - name: Install project dependencies + run: npm ci + - name: Build prod + run: npm run cdn:build:prod + - name: Get version number + id: agent-loader-version + run: echo "results=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT + - name: Get local stats + id: get-stats + shell: bash + run: | + rum=$(cat ./build/nr-rum-standard-${{ steps.agent-loader-version.outputs.results }}.stats.json); echo "rum=$rum" >> $GITHUB_OUTPUT; + full=$(cat ./build/nr-full-standard-${{ steps.agent-loader-version.outputs.results }}.stats.json); echo "full=$full" >> $GITHUB_OUTPUT; + spa=$(cat ./build/nr-spa-standard-${{ steps.agent-loader-version.outputs.results }}.stats.json); echo "spa=$spa" >> $GITHUB_OUTPUT; + - name: Report lite size to NR + uses: newrelic/capture-build-size@main + with: + nr-api-key: ${{ secrets.INTERNAL_STAGING_INGEST_LICENSE_KEY }} + nr-account-id: ${{ secrets.INTERNAL_STAGING_INGEST_ACCOUNT_ID }} + nr-env: 'staging' + analysis-file-contents: ${{ steps.get-stats.outputs.rum }} + file-name-filter: '.min.js' + trigger: 'publish-release' + version: v${{ steps.agent-loader-version.outputs.results }} + - name: Report pro size to NR + uses: newrelic/capture-build-size@main + with: + nr-api-key: ${{ secrets.INTERNAL_STAGING_INGEST_LICENSE_KEY }} + nr-account-id: ${{ secrets.INTERNAL_STAGING_INGEST_ACCOUNT_ID }} + nr-env: 'staging' + analysis-file-contents: ${{ steps.get-stats.outputs.full }} + file-name-filter: '.min.js' + trigger: 'publish-release' + version: v${{ steps.agent-loader-version.outputs.results }} + - name: Report spa size to NR + uses: newrelic/capture-build-size@main + with: + nr-api-key: ${{ secrets.INTERNAL_STAGING_INGEST_LICENSE_KEY }} + nr-account-id: ${{ secrets.INTERNAL_STAGING_INGEST_ACCOUNT_ID }} + nr-env: 'staging' + analysis-file-contents: ${{ steps.get-stats.outputs.spa }} + file-name-filter: '.min.js' + trigger: 'publish-release' + version: v${{ steps.agent-loader-version.outputs.results }} diff --git a/.github/workflows/pull-request-checks.yml b/.github/workflows/pull-request-checks.yml index 2e70e552c..1265352db 100644 --- a/.github/workflows/pull-request-checks.yml +++ b/.github/workflows/pull-request-checks.yml @@ -97,10 +97,70 @@ jobs: pr_number: ${{ github.event.number }} comment: ${{ steps.asset-size-report.outputs.results }} comment_tag: - - name: Report local stats as NR event - uses: './.github/actions/nr-report-build-size' + - name: Get local stats + id: get-stats + shell: bash + run: | + rum=$(cat ./build/nr-rum-standard.stats.json); echo "rum=$rum" >> $GITHUB_OUTPUT; + full=$(cat ./build/nr-full-standard.stats.json); echo "full=$full" >> $GITHUB_OUTPUT; + spa=$(cat ./build/nr-spa-standard.stats.json); echo "spa=$spa" >> $GITHUB_OUTPUT; + - name: Report lite size to NR + uses: newrelic/capture-build-size@main + with: + nr-api-key: ${{ secrets.INTERNAL_STAGING_INGEST_LICENSE_KEY }} + nr-account-id: ${{ secrets.INTERNAL_STAGING_INGEST_ACCOUNT_ID }} + nr-env: 'staging' + analysis-file-contents: ${{ steps.get-stats.outputs.rum }} + file-name-filter: '.min.js' + trigger: 'pull-request-checks' + - name: Report pro size to NR + uses: newrelic/capture-build-size@main + with: + nr-api-key: ${{ secrets.INTERNAL_STAGING_INGEST_LICENSE_KEY }} + nr-account-id: ${{ secrets.INTERNAL_STAGING_INGEST_ACCOUNT_ID }} + nr-env: 'staging' + analysis-file-contents: ${{ steps.get-stats.outputs.full }} + file-name-filter: '.min.js' + trigger: 'pull-request-checks' + - name: Report spa size to NR + uses: newrelic/capture-build-size@main + with: + nr-api-key: ${{ secrets.INTERNAL_STAGING_INGEST_LICENSE_KEY }} + nr-account-id: ${{ secrets.INTERNAL_STAGING_INGEST_ACCOUNT_ID }} + nr-env: 'staging' + analysis-file-contents: ${{ steps.get-stats.outputs.spa }} + file-name-filter: '.min.js' + trigger: 'pull-request-checks' + - name: Report dev lite size to NR + uses: newrelic/capture-build-size@main + with: + nr-api-key: ${{ secrets.INTERNAL_STAGING_INGEST_LICENSE_KEY }} + nr-account-id: ${{ secrets.INTERNAL_STAGING_INGEST_ACCOUNT_ID }} + nr-env: 'staging' + analysis-file-url: 'https://js-agent.newrelic.com/dev/nr-rum-standard.stats.json' + file-name-filter: '.min.js' + trigger: 'pull-request-checks' + version: 'main' + - name: Report dev pro size to NR + uses: newrelic/capture-build-size@main + with: + nr-api-key: ${{ secrets.INTERNAL_STAGING_INGEST_LICENSE_KEY }} + nr-account-id: ${{ secrets.INTERNAL_STAGING_INGEST_ACCOUNT_ID }} + nr-env: 'staging' + analysis-file-url: 'https://js-agent.newrelic.com/dev/nr-full-standard.stats.json' + file-name-filter: '.min.js' + trigger: 'pull-request-checks' + version: 'main' + - name: Report dev spa size to NR + uses: newrelic/capture-build-size@main with: nr-api-key: ${{ secrets.INTERNAL_STAGING_INGEST_LICENSE_KEY }} + nr-account-id: ${{ secrets.INTERNAL_STAGING_INGEST_ACCOUNT_ID }} + nr-env: 'staging' + analysis-file-url: 'https://js-agent.newrelic.com/dev/nr-spa-standard.stats.json' + file-name-filter: '.min.js' + trigger: 'pull-request-checks' + version: 'main' # Jobs for workflow_dispatch events