[E2E] Prepare native preload ready-flow validation #3404
This file contains hidden or 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
| name: Package Size | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| concurrency: | |
| group: package-size-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| changes: | |
| name: Detect Changed Packages | |
| if: github.event_name == 'pull_request' && github.event.pull_request.draft == false | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| outputs: | |
| android: ${{ steps.package.outputs.android == 'true' || steps.package.outputs.protocolKotlin == 'true' || steps.package.outputs.protocolShared == 'true' || steps.infra.outputs.android == 'true' }} | |
| reactNative: ${{ steps.package.outputs.reactNative == 'true' || steps.package.outputs.protocolTypescript == 'true' || steps.package.outputs.protocolShared == 'true' || steps.infra.outputs.reactNative == 'true' }} | |
| web: ${{ steps.package.outputs.web == 'true' || steps.package.outputs.protocolTypescript == 'true' || steps.package.outputs.protocolShared == 'true' || steps.infra.outputs.web == 'true' }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2 | |
| id: package | |
| with: | |
| predicate-quantifier: every | |
| filters: .ci/changed-file-filters.yml | |
| - uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2 | |
| id: infra | |
| with: | |
| filters: | | |
| android: | |
| - '.github/scripts/measure-package-size' | |
| - '.ci/changed-file-filters.yml' | |
| - '.github/workflows/package-size.yml' | |
| reactNative: | |
| - '.github/actions/setup/**' | |
| - '.github/scripts/measure-package-size' | |
| - '.ci/changed-file-filters.yml' | |
| - '.github/workflows/package-size.yml' | |
| web: | |
| - '.github/actions/setup/**' | |
| - '.github/scripts/measure-package-size' | |
| - '.ci/changed-file-filters.yml' | |
| - '.github/workflows/package-size.yml' | |
| measure: | |
| name: Measure Package Size | |
| needs: changes | |
| if: | | |
| needs.changes.outputs.android == 'true' || | |
| needs.changes.outputs.reactNative == 'true' || | |
| needs.changes.outputs.web == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| submodules: true | |
| - name: Checkout PR base | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| ref: ${{ github.event.pull_request.base.sha }} | |
| path: .package-size-base | |
| submodules: true | |
| - name: Setup base Web dependencies | |
| if: needs.changes.outputs.web == 'true' | |
| uses: ./.github/actions/setup | |
| with: | |
| node-version-file: .package-size-base/platforms/web/package.json | |
| cache-dependency-path: .package-size-base/platforms/web/pnpm-lock.yaml | |
| package-json-file: .package-size-base/platforms/web/package.json | |
| working-directory: .package-size-base/platforms/web | |
| - name: Setup head Web dependencies | |
| if: needs.changes.outputs.web == 'true' | |
| uses: ./.github/actions/setup | |
| with: | |
| node-version-file: platforms/web/package.json | |
| cache-dependency-path: platforms/web/pnpm-lock.yaml | |
| package-json-file: platforms/web/package.json | |
| working-directory: platforms/web | |
| - name: Setup base React Native dependencies | |
| if: needs.changes.outputs.reactNative == 'true' | |
| uses: ./.github/actions/setup | |
| with: | |
| node-version-file: .package-size-base/platforms/react-native/package.json | |
| cache-dependency-path: .package-size-base/platforms/react-native/pnpm-lock.yaml | |
| package-json-file: .package-size-base/platforms/react-native/package.json | |
| working-directory: .package-size-base/platforms/react-native | |
| - name: Setup head React Native dependencies | |
| if: needs.changes.outputs.reactNative == 'true' | |
| uses: ./.github/actions/setup | |
| with: | |
| node-version-file: platforms/react-native/package.json | |
| cache-dependency-path: platforms/react-native/pnpm-lock.yaml | |
| package-json-file: platforms/react-native/package.json | |
| working-directory: platforms/react-native | |
| - name: Install JDK | |
| if: needs.changes.outputs.android == 'true' | |
| uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5.6.0 | |
| with: | |
| distribution: zulu | |
| java-version: 17 | |
| cache: gradle | |
| - name: Measure base package sizes | |
| continue-on-error: true | |
| env: | |
| MEASURE_ANDROID: ${{ needs.changes.outputs.android }} | |
| MEASURE_REACT_NATIVE: ${{ needs.changes.outputs.reactNative }} | |
| MEASURE_WEB: ${{ needs.changes.outputs.web }} | |
| PACKAGE_SIZE_REPO_ROOT: ${{ github.workspace }}/.package-size-base | |
| run: .github/scripts/measure-package-size collect /tmp/package-size-base.tsv | |
| - name: Measure head package sizes | |
| env: | |
| MEASURE_ANDROID: ${{ needs.changes.outputs.android }} | |
| MEASURE_REACT_NATIVE: ${{ needs.changes.outputs.reactNative }} | |
| MEASURE_WEB: ${{ needs.changes.outputs.web }} | |
| run: .github/scripts/measure-package-size collect /tmp/package-size-head.tsv | |
| - name: Render package size comment | |
| run: | | |
| touch /tmp/package-size-base.tsv | |
| .github/scripts/measure-package-size render /tmp/package-size-base.tsv /tmp/package-size-head.tsv /tmp/package-size-comment.md | |
| - name: Comment on PR | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| env: | |
| COMMENT_FILE: /tmp/package-size-comment.md | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const marker = '<!-- checkout-kit-package-size -->'; | |
| const body = fs.readFileSync(process.env.COMMENT_FILE, 'utf8'); | |
| const issue_number = Number(process.env.PR_NUMBER); | |
| const {owner, repo} = context.repo; | |
| const comments = await github.paginate(github.rest.issues.listComments, { | |
| owner, | |
| repo, | |
| issue_number, | |
| per_page: 100, | |
| }); | |
| const existing = comments.find((comment) => comment.body?.includes(marker)); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner, | |
| repo, | |
| comment_id: existing.id, | |
| body, | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner, | |
| repo, | |
| issue_number, | |
| body, | |
| }); | |
| } |