From f0d25990c74c8316a48e55b8656f175a5b5906e5 Mon Sep 17 00:00:00 2001 From: Eoghan Murray Date: Fri, 13 Feb 2026 10:37:08 +0000 Subject: [PATCH] Update filesize badges (might need further evolution before 2.0.0) (#1787) * Update filesize badges (might need further evolution before 2.0.0) * Don't run full CI/CD when only .md docs have changed in the PR - move eslint checks into their own file so they can also ignore .md changes - prettier checks don't need the same perms as eslint, so we can demote pull_request_target -> pull_request * Add empty changeset * Implement the bundle size change originally originally added in #1784 - adding here also to show how the conflicts would resolve * Update .github/workflows/eslint-check.yml --------- Co-authored-by: Justin Halsall --- .changeset/empty-devonly-template.md | 2 + .github/workflows/ci-cd.yml | 18 +++--- .github/workflows/eslint-check.yml | 86 ++++++++++++++++++++++++++++ .github/workflows/style-check.yml | 56 +----------------- README.md | 4 +- 5 files changed, 99 insertions(+), 67 deletions(-) create mode 100644 .changeset/empty-devonly-template.md create mode 100644 .github/workflows/eslint-check.yml diff --git a/.changeset/empty-devonly-template.md b/.changeset/empty-devonly-template.md new file mode 100644 index 00000000..a845151c --- /dev/null +++ b/.changeset/empty-devonly-template.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 7addf410..0e6b84cd 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -1,6 +1,12 @@ name: Tests -on: [push, pull_request] +on: + push: + paths-ignore: + - '**/*.md' + pull_request: + paths-ignore: + - '**/*.md' concurrency: ${{ github.workflow }}-${{ github.ref }} @@ -41,16 +47,6 @@ jobs: # run: PUPPETEER_EXECUTABLE_PATH=${{ steps.setup-chrome.outputs.chrome-path }} PUPPETEER_HEADLESS=true xvfb-run --server-args="-screen 0 1920x1080x24" yarn test run: PUPPETEER_HEADLESS=true xvfb-run --server-args="-screen 0 1920x1080x24" yarn test - - name: Check bundle sizes - uses: preactjs/compressed-size-action@v2 - with: - install-script: 'yarn install --frozen-lockfile' - build-script: 'build:all' - compression: 'none' - pattern: '**/dist/*.{js,cjs,mjs,css}' - env: - PUPPETEER_SKIP_DOWNLOAD: true - - name: Upload diff images to GitHub uses: actions/upload-artifact@v4 if: failure() diff --git a/.github/workflows/eslint-check.yml b/.github/workflows/eslint-check.yml new file mode 100644 index 00000000..40e522a8 --- /dev/null +++ b/.github/workflows/eslint-check.yml @@ -0,0 +1,86 @@ +name: ESLint Check + +on: + push: + pull_request_target: + +jobs: + eslint_check_upload: + runs-on: ubuntu-latest + permissions: + contents: read + name: ESLint Check and Report Upload + + steps: + - uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.head_ref }} + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: lts/* + cache: 'yarn' + - name: Install Dependencies + run: yarn install --frozen-lockfile + env: + PUPPETEER_SKIP_DOWNLOAD: true + - name: Build Packages + run: NODE_OPTIONS='--max-old-space-size=4096' yarn build:all + - name: Eslint Check + run: yarn turbo run lint + - name: Save Code Linting Report JSON + run: yarn lint:report + # Continue to the next step even if this fails + continue-on-error: true + - name: Upload ESLint Report + uses: actions/upload-artifact@v4 + with: + name: eslint_report.json + path: eslint_report.json + + annotation: + # Skip the annotation action in push events + if: github.event_name == 'pull_request_target' + permissions: + checks: write + needs: eslint_check_upload + runs-on: ubuntu-latest + name: ESLint Annotation + steps: + - uses: actions/download-artifact@v4 + with: + name: eslint_report.json + - name: Annotate Code Linting Results + uses: ataylorme/eslint-annotate-action@v2 + with: + repo-token: '${{ secrets.GITHUB_TOKEN }}' + report-json: 'eslint_report.json' + + bundle_size: + # Only runs on PRs (needs a base branch to compare against) + if: github.event_name == 'pull_request_target' + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + name: Check Bundle Sizes + steps: + - uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.head_ref }} + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: lts/* + cache: 'yarn' + - name: Check bundle sizes + uses: preactjs/compressed-size-action@v2 + with: + install-script: 'yarn install --frozen-lockfile' + build-script: 'build:all' + compression: 'none' + pattern: '**/dist/*.{js,cjs,mjs,css}' + env: + PUPPETEER_SKIP_DOWNLOAD: true diff --git a/.github/workflows/style-check.yml b/.github/workflows/style-check.yml index a37b1a45..e28d9f04 100644 --- a/.github/workflows/style-check.yml +++ b/.github/workflows/style-check.yml @@ -1,60 +1,8 @@ -name: Code Style Check +name: Prettier Check -on: [push, pull_request_target] +on: [push, pull_request] jobs: - eslint_check_upload: - runs-on: ubuntu-latest - permissions: - contents: read - name: ESLint Check and Report Upload - - steps: - - uses: actions/checkout@v4 - with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.head_ref }} - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: lts/* - cache: 'yarn' - - name: Install Dependencies - run: yarn install --frozen-lockfile - env: - PUPPETEER_SKIP_DOWNLOAD: true - - name: Build Packages - run: NODE_OPTIONS='--max-old-space-size=4096' yarn build:all - - name: Eslint Check - run: yarn turbo run lint - - name: Save Code Linting Report JSON - run: yarn lint:report - # Continue to the next step even if this fails - continue-on-error: true - - name: Upload ESLint Report - uses: actions/upload-artifact@v4 - with: - name: eslint_report.json - path: eslint_report.json - - annotation: - # Skip the annotation action in push events - if: github.event_name == 'pull_request_target' - permissions: - checks: write - needs: eslint_check_upload - runs-on: ubuntu-latest - name: ESLint Annotation - steps: - - uses: actions/download-artifact@v4 - with: - name: eslint_report.json - - name: Annotate Code Linting Results - uses: ataylorme/eslint-annotate-action@v2 - with: - repo-token: '${{ secrets.GITHUB_TOKEN }}' - report-json: 'eslint_report.json' - prettier_check: # In the forked PR, it's hard to format code and push to the branch directly, so the action only check the format correctness. if: github.event_name != 'push' && github.event.pull_request.head.repo.full_name != 'rrweb-io/rrweb' diff --git a/README.md b/README.md index 34af5383..856d8b90 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ [![Join the chat at slack](https://img.shields.io/badge/slack-@rrweb-teal.svg?logo=slack)](https://join.slack.com/t/rrweb/shared_invite/zt-siwoc6hx-uWay3s2wyG8t5GpZVb8rWg) [![Twitter Follow](https://img.shields.io/badge/twitter-@rrweb__io-teal.svg?logo=twitter)](https://twitter.com/rrweb_io) [![Reddit](https://img.shields.io/badge/reddit-r/rrweb-teal.svg?logo=reddit)](https://www.reddit.com/r/rrweb) -![total gzip size](https://img.badgesize.io/https://cdn.jsdelivr.net/npm/rrweb@latest/dist/rrweb.min.cjs?compression=gzip&label=total%20gzip%20size) -![recorder gzip size](https://img.badgesize.io/https://cdn.jsdelivr.net/npm/rrweb@latest/dist/record/rrweb-record.min.cjs?compression=gzip&label=recorder%20gzip%20size) +![recorder gzip size](https://img.badgesize.io/https://cdn.jsdelivr.net/npm/@rrweb/record@latest/dist/record.min.js?compression=gzip&label=recorder%20gzip%20size&max=200000&softmax=100000) +![replayer gzip size](https://img.badgesize.io/https://cdn.jsdelivr.net/npm/@rrweb/replay@latest/dist/replay.min.js?compression=gzip&label=replayer%20gzip%20size&max=200000&softmax=100000) [![](https://data.jsdelivr.com/v1/package/npm/rrweb/badge)](https://www.jsdelivr.com/package/npm/rrweb) [中文文档](./README.zh_CN.md)