Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Finalize changes to build size action #1300

Merged
merged 13 commits into from
Jan 23, 2025
Merged
47 changes: 0 additions & 47 deletions .github/actions/nr-report-build-size/action.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/nightly.yml
metal-messiah marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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'
metal-messiah marked this conversation as resolved.
Show resolved Hide resolved
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
Expand Down
40 changes: 36 additions & 4 deletions .github/workflows/publish-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,47 @@ jobs:
uses: newrelic/[email protected]
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:
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
64 changes: 62 additions & 2 deletions .github/workflows/pull-request-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,70 @@ jobs:
pr_number: ${{ github.event.number }}
comment: ${{ steps.asset-size-report.outputs.results }}
comment_tag: <!-- browser_agent asset size report -->
- 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

Expand Down
Loading