feat: Add WebSocket wrapper and supportability metrics #2171
Workflow file for this run
This file contains 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
# This workflow runs on creation and update of pull | |
# requests to execute jobs that do not require access | |
# to repository secrets. Jobs that do require repository | |
# secrets are executed when this workflow is manually | |
# executed to ensure protection of those secrets. | |
name: 'Pull Request Checks' | |
on: | |
workflow_dispatch: | |
inputs: | |
latest-only: | |
description: 'Run the latest version of browsers only instead of all versions' | |
default: true | |
type: boolean | |
pull_request: | |
jobs: | |
# Jobs for pull_request events | |
jest-tests: | |
name: Jest tests | |
if: github.event_name == 'pull_request' | |
uses: ./.github/workflows/jest.yml | |
with: | |
ref: ${{ github.ref }} | |
coverage: true | |
secrets: inherit | |
types-test: | |
runs-on: ubuntu-latest | |
name: Types Test | |
if: github.event_name == 'pull_request' | |
timeout-minutes: 30 | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Install dependencies | |
run: npm ci | |
- name: Running types build | |
run: | | |
npm run npm:build:types | |
- name: Running types tests | |
run: | | |
npm run test:types | |
eslint: | |
name: ESLint | |
if: github.event_name == 'pull_request' | |
uses: ./.github/workflows/eslint.yml | |
with: | |
ref: ${{ github.ref }} | |
size-check: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
timeout-minutes: 30 | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Install dependencies | |
run: npm ci | |
- name: Running cdn build | |
run: npm run cdn:build:dev | |
- name: Generating asset size report | |
uses: ./.github/actions/size-diff | |
with: | |
compare_from: dev | |
compare_to: local | |
- 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" | |
echo "## Asset Size Report <br><br>" >> "$GITHUB_OUTPUT" | |
echo "Merging this pull request will result in the following asset size changes: <br><br>" >> "$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: ${{ github.event.number }} | |
comment: ${{ steps.asset-size-report.outputs.results }} | |
comment_tag: <!-- browser_agent asset size report --> | |
# Jobs for workflow_dispatch events | |
find-pull-request: | |
name: Find pull request target | |
if: github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
outputs: | |
pull-request-target: ${{ steps.pull-request-target.outputs.results }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Find pull request target | |
id: pull-request-target | |
uses: ./.github/actions/find-pull-request | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
pr_required: true | |
pending-comment-pull-request: | |
name: Pending comment pull request | |
if: github.event_name == 'workflow_dispatch' | |
needs: find-pull-request | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Setup runner | |
run: sudo apt update && DEBIAN_FRONTEND=noninteractive sudo apt install -y git tzdata | |
- uses: actions/checkout@v4 | |
with: | |
ref: 'refs/pull/${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).pr_number }}/merge' | |
- uses: actions/setup-node@v4 | |
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 | |
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-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 }}) | |
comment_tag: <!-- browser_agent pull request checks --> | |
wdio-coverage: | |
name: WDIO coverage | |
if: github.event_name == 'workflow_dispatch' | |
needs: find-pull-request | |
uses: ./.github/workflows/wdio-single-browser.yml | |
with: | |
ref: 'refs/pull/${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).pr_number }}/merge' | |
browser-target: chrome@latest | |
coverage: true | |
secrets: inherit | |
wdio: | |
name: WDIO | |
if: github.event_name == 'workflow_dispatch' | |
needs: find-pull-request | |
uses: ./.github/workflows/wdio-all-browsers.yml | |
with: | |
ref: 'refs/pull/${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).pr_number }}/merge' | |
latest-only: ${{ inputs.latest-only }} | |
secrets: inherit | |
complete-status-comment-pull-request: | |
name: Comment pull request | |
if: always() && github.event_name == 'workflow_dispatch' && needs.find-pull-request.result == 'success' | |
needs: [find-pull-request,wdio-coverage,wdio] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Setup container | |
run: sudo apt update && DEBIAN_FRONTEND=noninteractive sudo apt install -y git tzdata | |
- uses: actions/checkout@v4 | |
with: | |
ref: 'refs/pull/${{ fromJSON(needs.find-pull-request.outputs.pull-request-target).pr_number }}/merge' | |
- uses: actions/setup-node@v4 | |
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 --> |