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

feat: Remove img, jsonp, and xhrGet methods #576

Merged
merged 39 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8135a38
chore: removing img, jsonp, and xhrGet methods
patrickhousley Jun 8, 2023
e8b57b0
centralizing runtime constants
patrickhousley Jun 8, 2023
f2afd8f
Merge branch 'main' into remove-img-network
patrickhousley Jun 8, 2023
295e13c
unifying runtime constants
patrickhousley Jun 9, 2023
6a9c6e3
add asset size report to pull request checks workflow
patrickhousley Jun 9, 2023
c0352a2
fixing size report
patrickhousley Jun 9, 2023
7bcd60d
broke all the things
patrickhousley Jun 9, 2023
4a23404
mocks and tests, oh my
patrickhousley Jun 13, 2023
08d3db4
Merge branch 'main' into remove-img-network
patrickhousley Jun 13, 2023
962d543
fix merge and workflow
patrickhousley Jun 13, 2023
7f93150
fixing size check
patrickhousley Jun 13, 2023
7042580
finished harvest jest tests
patrickhousley Jun 13, 2023
d950bb1
stealing jordans code
patrickhousley Jun 13, 2023
6cbdc72
revert threading test server in wdio
patrickhousley Jun 14, 2023
6c33b9b
fix sauce extended debugging
patrickhousley Jun 14, 2023
22f4558
fix debug shim
patrickhousley Jun 14, 2023
3e619fe
add request count and health endpoints
patrickhousley Jun 14, 2023
287865c
add ability to make a reply permanent
patrickhousley Jun 14, 2023
33ab3d3
fix bug with testing override not applying
patrickhousley Jun 14, 2023
90b4834
default 429 retry delay
patrickhousley Jun 14, 2023
afa3ef8
improve test server logging
patrickhousley Jun 15, 2023
5a66c05
adding harvest wdio tests
patrickhousley Jun 15, 2023
3f000a0
Merge branch 'main' into remove-img-network
patrickhousley Jun 15, 2023
14cbdbb
fix 429 retry logic
patrickhousley Jun 15, 2023
59b09d5
fix bug with harvesting
patrickhousley Jun 15, 2023
7386fa9
fix session replay harvesting
patrickhousley Jun 15, 2023
8abefce
unflaking
patrickhousley Jun 16, 2023
6ae6eb8
moving withBrowsersMatching global
patrickhousley Jun 16, 2023
11070b0
flake flake
patrickhousley Jun 16, 2023
057d621
stn retry changes
patrickhousley Jun 16, 2023
769658c
oops
patrickhousley Jun 16, 2023
c0b0f37
Merge branch 'main' into remove-img-network
patrickhousley Jun 16, 2023
8494758
addressing pr comments
patrickhousley Jun 17, 2023
6db1b6b
fix pvt retry
patrickhousley Jun 17, 2023
93ca6e0
increase grace on error timestamps
patrickhousley Jun 17, 2023
8169bff
improve test performance
patrickhousley Jun 17, 2023
01dfb7e
fixing error payload tests
patrickhousley Jun 17, 2023
f963a49
Merge branch 'main' into remove-img-network
patrickhousley Jun 20, 2023
a5d54c6
fix xhr tests
patrickhousley Jun 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 0 additions & 59 deletions .github/workflows/ci.yml

This file was deleted.

20 changes: 17 additions & 3 deletions .github/workflows/jest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ on:
description: 'The collection of jest tests to run'
required: true
type: choice
options:
options:
- unit
- component
default: 'unit'
coverage:
description: 'Enable code coverage'
required: false
type: boolean
default: false
workflow_call:
inputs:
ref:
Expand All @@ -25,6 +30,11 @@ on:
required: false
type: string
default: 'unit'
coverage:
description: 'Enable code coverage'
required: false
type: boolean
default: false

jobs:
run:
Expand All @@ -36,6 +46,8 @@ jobs:
defaults:
run:
shell: bash
env:
COVERAGE: ${{ inputs.coverage }}
steps:
- name: Setup container
run: apt update && apt install -y git
Expand All @@ -51,11 +63,12 @@ jobs:
run: npm run test:${{ inputs.collection }} -- --coverage
- name: Find pull request
id: pull-request-target
if: ${{ inputs.coverage }}
uses: ./.github/actions/find-pull-request
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload pr code coverage
if: ${{ steps.pull-request-target.outputs.results }}
if: ${{ inputs.coverage && steps.pull-request-target.outputs.results }}
uses: codecov/codecov-action@v3
env:
GITHUB_HEAD_REF: ${{ inputs.ref }}
Expand All @@ -65,13 +78,14 @@ jobs:
flags: jest-${{ inputs.collection }}
verbose: true
- name: Upload branch code coverage
if: ${{ !steps.pull-request-target.outputs.results }}
if: ${{ inputs.coverage && steps.pull-request-target.outputs.results }}
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: jest-${{ inputs.collection }}
verbose: true
- name: Archive code coverage results
if: ${{ inputs.coverage }}
uses: actions/upload-artifact@v3
with:
name: jest-${{ inputs.collection }}-code-coverage-report
Expand Down
118 changes: 115 additions & 3 deletions .github/workflows/pull-request-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
pr_required: true

comment-pull-request:
name: Comment pull request
pending-comment-pull-request:
name: Pending comment pull request
needs: [find-pull-request]
runs-on: ubuntu-latest
container:
Expand All @@ -53,7 +53,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
pr_number: ${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).pr_number }}
comment: |
[![Pull Request Checks](https://github.com/newrelic/newrelic-browser-agent/actions/workflows/pull-request-checks.yml/badge.svg?branch=${{ github.ref_name }})](https://github.com/newrelic/newrelic-browser-agent/actions/runs/${{ github.run_id }})
[![Static Badge](https://img.shields.io/badge/Pull_Request_Checks-Pending-yellow)](https://github.com/newrelic/newrelic-browser-agent/actions/runs/${{ github.run_id }})

Last ran on `${{ steps.workflow-time.outputs.results }}`
Checking merge of (${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).head_sha }}) into [${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).base_ref }}](https://github.com/newrelic/newrelic-browser-agent/compare/${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).head_sha }}..${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).base_sha }}) (${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).base_sha }})
Expand All @@ -66,6 +66,7 @@ jobs:
with:
ref: 'refs/pull/${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).pr_number }}/merge'
collection: 'unit'
coverage: true
secrets: inherit

jest-component:
Expand All @@ -75,6 +76,7 @@ jobs:
with:
ref: 'refs/pull/${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).pr_number }}/merge'
collection: 'component'
coverage: true
secrets: inherit

eslint:
Expand All @@ -94,3 +96,113 @@ jobs:
build-number: PR${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).pr_number}}-job-${{ github.run_number }}-attempt-${{ github.run_attempt }}
coverage: true
secrets: inherit

size-check:
runs-on: ubuntu-latest
needs: find-pull-request
timeout-minutes: 30
container:
image: ubuntu:latest
defaults:
run:
shell: bash
steps:
- name: Setup container
run: apt update && apt install -y git
- uses: actions/checkout@v3
with:
ref: 'refs/pull/${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).pr_number }}/merge'
- uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Running cdn build
run: npm run cdn:build:dev
- name: Running npm build
run: |
npm run build:npm
npm run tools:test-builds
- name: Generating npm build stats
run: node ./tools/scripts/npm-build-stats.js
- name: Generating asset size report
run: node ./tools/scripts/diff-sizes.mjs -o build
- name: Reading asset size report
id: asset-size-report
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "results<<$EOF" >> "$GITHUB_OUTPUT"
cat ./build/size_report.md >> "$GITHUB_OUTPUT"
echo "$EOF" >> "$GITHUB_OUTPUT"
- name: Comment pull request
uses: ./.github/actions/comment-pull-request
with:
token: ${{ secrets.GITHUB_TOKEN }}
pr_number: ${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).pr_number }}
comment: ${{ steps.asset-size-report.outputs.results }}
comment_tag: <!-- browser_agent asset size report -->
- name: Archive asset size report results
uses: actions/upload-artifact@v3
with:
name: asset-size-report
path: |
build/size_report.*
build/*.stats.html
build/*.stats.json

status-comment-pull-request:
name: Comment pull request
needs: [find-pull-request,jest-unit,jest-component,eslint,wdio-coverage]
if: ${{ always() && needs.find-pull-request.result == 'success' }}
runs-on: ubuntu-latest
container:
image: ubuntu:latest
defaults:
run:
shell: bash
steps:
- name: Setup container
run: apt update && DEBIAN_FRONTEND=noninteractive apt install -y git tzdata
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Get workflow time
id: workflow-time
run: echo "results=$(TZ=America/Chicago date +'%B %d, %Y %H:%M:%S %Z')" >> $GITHUB_OUTPUT
- name: Comment pull request success
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
uses: ./.github/actions/comment-pull-request
with:
token: ${{ secrets.GITHUB_TOKEN }}
pr_number: ${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).pr_number }}
comment: |
[![Static Badge](https://img.shields.io/badge/Pull_Request_Checks-Success-green)](https://github.com/newrelic/newrelic-browser-agent/actions/runs/${{ github.run_id }})

Last ran on `${{ steps.workflow-time.outputs.results }}`
Checking merge of (${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).head_sha }}) into [${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).base_ref }}](https://github.com/newrelic/newrelic-browser-agent/compare/${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).head_sha }}..${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).base_sha }}) (${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).base_sha }})
comment_tag: <!-- browser_agent pull request checks -->
- name: Comment pull request failed
if: ${{ contains(needs.*.result, 'failure') }}
uses: ./.github/actions/comment-pull-request
with:
token: ${{ secrets.GITHUB_TOKEN }}
pr_number: ${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).pr_number }}
comment: |
[![Static Badge](https://img.shields.io/badge/Pull_Request_Checks-Failure-red)](https://github.com/newrelic/newrelic-browser-agent/actions/runs/${{ github.run_id }})

Last ran on `${{ steps.workflow-time.outputs.results }}`
Checking merge of (${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).head_sha }}) into [${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).base_ref }}](https://github.com/newrelic/newrelic-browser-agent/compare/${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).head_sha }}..${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).base_sha }}) (${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).base_sha }})
comment_tag: <!-- browser_agent pull request checks -->
- name: Comment pull request cancelled
if: ${{ contains(needs.*.result, 'cancelled') }}
uses: ./.github/actions/comment-pull-request
with:
token: ${{ secrets.GITHUB_TOKEN }}
pr_number: ${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).pr_number }}
comment: |
[![Static Badge](https://img.shields.io/badge/Pull_Request_Checks-Cancelled-orange)](https://github.com/newrelic/newrelic-browser-agent/actions/runs/${{ github.run_id }})

Last ran on `${{ steps.workflow-time.outputs.results }}`
Checking merge of (${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).head_sha }}) into [${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).base_ref }}](https://github.com/newrelic/newrelic-browser-agent/compare/${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).head_sha }}..${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).base_sha }}) (${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).base_sha }})
comment_tag: <!-- browser_agent pull request checks -->
8 changes: 8 additions & 0 deletions .github/workflows/wdio-all-browsers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,11 @@ jobs:
browser-target: android@*
build-number: $BUILD_NUMBER
secrets: inherit

ie:
uses: ./.github/workflows/wdio-single-browser.yml
with:
browser-target: ie@11
build-number: $BUILD_NUMBER
additional-flags: -P
secrets: inherit
6 changes: 4 additions & 2 deletions .github/workflows/wdio-single-browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
required: false
type: string
coverage:
description: 'Flag indicating if code coverage should be collected and reported to codecov'
description: 'Enable code coverage'
required: false
type: boolean
default: false
Expand All @@ -35,7 +35,7 @@ on:
required: false
type: string
coverage:
description: 'Flag indicating if code coverage should be collected and reported to codecov'
description: 'Enable code coverage'
required: false
type: boolean
default: false
Expand All @@ -56,6 +56,7 @@ jobs:
shell: bash
env:
BUILD_NUMBER: ${{ inputs.build-number }}
COVERAGE: ${{ inputs.coverage }}
NEWRELIC_ENVIRONMENT: ci
JIL_SAUCE_LABS_USERNAME: ${{ secrets.JIL_SAUCE_LABS_USERNAME }}
JIL_SAUCE_LABS_ACCESS_KEY: ${{ secrets.JIL_SAUCE_LABS_ACCESS_KEY }}
Expand Down Expand Up @@ -84,6 +85,7 @@ jobs:
${{ inputs.additional-flags || '' }}
- name: Find pull request
id: pull-request-target
if: ${{ inputs.coverage }}
uses: ./.github/actions/find-pull-request
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
14 changes: 13 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
const process = require('process')

module.exports = function (api) {
module.exports = function (api, ...args) {
api.cache(true)

if (!process.env.BUILD_VERSION) {
process.env.BUILD_VERSION = process.env.VERSION_OVERRIDE || require('./package.json').version
}
if (!process.env.BUILD_ENV) {
process.env.BUILD_ENV = 'CDN'
}

const ignore = [
'**/*.test.js',
patrickhousley marked this conversation as resolved.
Show resolved Hide resolved
'**/*.component-test.js',
'**/__mocks__/*.js'
]
const presets = [
'@babel/preset-env'
]
Expand Down Expand Up @@ -34,6 +42,7 @@ module.exports = function (api) {
]
},
webpack: {
ignore,
plugins: [
[
'./tools/scripts/babel-plugin-transform-import',
Expand All @@ -44,6 +53,7 @@ module.exports = function (api) {
]
},
'webpack-ie11': {
ignore,
assumptions: {
iterableIsArray: false
},
Expand Down Expand Up @@ -72,6 +82,7 @@ module.exports = function (api) {
]
},
'npm-cjs': {
ignore,
presets: [
[
'@babel/preset-env', {
Expand All @@ -89,6 +100,7 @@ module.exports = function (api) {
]
},
'npm-esm': {
ignore,
presets: [
[
'@babel/preset-env', {
Expand Down
3 changes: 3 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
flag_management:
default_rules:
carryforward: true
2 changes: 1 addition & 1 deletion jest.component-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module.exports = {
coverageDirectory: 'coverage',
collectCoverageFrom: [
'src/**/*.js',
'!src/**/*.component-test.js',
'!src/**/*.test.js',
'!src/**/*.component-test.js',
'!src/index.js',
'!src/cdn/**/*.js',
'!src/features/*/index.js',
Expand Down
Loading