Skip to content

chore: bump gradle-wrapper in / #104

chore: bump gradle-wrapper in /

chore: bump gradle-wrapper in / #104

name: "Rokt SDK+ Size Report"
# Advisory. Measures what the Rokt SDK+ umbrella (Core SDK + Rokt kit + Rokt SDK + payment
# extension) adds to a minified release APK, alongside the Core SDK on its own.
#
# Not part of "Build and Test": the umbrella can only be measured against published artifacts,
# so this runs three sequential mavenLocal publishes and then a standalone Gradle build with its
# own wrapper and AGP. That number moves when Rokt cuts a release or the kit changes -- not on
# day-to-day android-core PRs -- so the trigger is path-scoped rather than every PR.
on:
workflow_dispatch:
pull_request:
paths:
- "kits/rokt/**"
- "rokt-sdk-plus/**"
- "size-report-rokt/**"
- "gradle.properties" # pins roktSdkVersion / roktPaymentExtensionVersion
- ".github/workflows/rokt-size-report.yml"
- "scripts/rokt-size-report.sh"
- ".github/scripts/render_size_report.py" # renders this report
# Published into the chain the umbrella resolves, so they can move the number.
- "android-kit-base/**"
- "kit-plugin/**"
- "build-logic/**"
# android-core is deliberately absent: it is in the chain, but it changes on most pull
# requests and its cost is already reported by the per-pull-request check. Running three
# publishes and a second build system on every core change is not worth the signal.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
size-report:
name: "Rokt SDK+ Size Impact"
timeout-minutes: 60
runs-on: ubuntu-latest
# Advisory: a failed measurement must never fail the PR.
continue-on-error: true
permissions:
contents: read
pull-requests: write
env:
COMMENT_IDENTIFIER: "<!-- rokt-sdk-plus-size-report -->"
steps:
- name: "Checkout PR head"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# The merge ref, not head.sha. `base.sha` is the base branch's current tip, so
# measuring a stale head against it attributes everything merged into the base since
# the branch diverged to this pull request -- an unrelated increase on the base branch
# would render as this pull request shrinking the SDK. Measuring the merge result
# against the base compares like with like.
# A pull request with conflicts has no merge ref, so this step fails and the job
# stops here. The job is advisory so nothing is blocked, but note that an existing
# comment is then left untouched rather than rewritten to "not measured" -- the
# footnote naming the measured commit is what marks it stale. A conflicted pull
# request cannot merge anyway, so resolving the conflict is the fix.
ref: ${{ github.event.pull_request.number && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.sha }}
path: head
# Only pull_request has a base SHA that is guaranteed fetched. On workflow_dispatch the
# report shows the head numbers and "not measured" for the target branch.
- name: "Checkout target branch"
if: github.event_name == 'pull_request'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
ref: ${{ github.event.pull_request.base.sha }}
path: base
- name: "Pin the head fixture into the target checkout"
if: github.event_name == 'pull_request'
# Both sides must be measured with the same fixture: the base may predate it entirely,
# and otherwise a change to the fixture would show up as an SDK size change.
run: |
set -euo pipefail
rm -rf base/size-report-rokt
cp -R head/size-report-rokt base/size-report-rokt
- name: "Install JDK 17"
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6
with:
distribution: "zulu"
java-version: "17"
- name: "Setup Gradle"
uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0
- name: "Measure target branch"
if: github.event_name == 'pull_request'
continue-on-error: true
run: head/scripts/rokt-size-report.sh base > "${RUNNER_TEMP}/base.json"
- name: "Measure PR head"
continue-on-error: true
run: head/scripts/rokt-size-report.sh head > "${RUNNER_TEMP}/head.json"
- name: "Render report"
env:
# Names what was measured. A comment left behind by a later push then reads as stale
# rather than passing as the current result.
FOOTNOTE: >-
Measured ${{ github.event_name == 'pull_request'
&& format('{0} merged into {1}', github.event.pull_request.head.sha, github.event.pull_request.base.sha)
|| github.sha }}
run: |
set -euo pipefail
touch "${RUNNER_TEMP}/base.json" "${RUNNER_TEMP}/head.json"
head/.github/scripts/render_size_report.py \
--marker "${COMMENT_IDENTIFIER}" \
--footnote "${FOOTNOTE}" \
--baseline-note "Measured against a Compose + Material3 reference app, so these are the costs on top of an app that already ships Compose. The reference app's dependencies are a documented convention, not a measured average: see \`size-report-rokt/README.md\`." \
--stack 'kit:mParticle Core + Rokt kit' \
--stack 'sdkplus:Rokt SDK+ umbrella (adds the payment extension):kit' \
"${RUNNER_TEMP}/base.json" "${RUNNER_TEMP}/head.json" > "${RUNNER_TEMP}/size-report.md"
cat "${RUNNER_TEMP}/size-report.md" >> "${GITHUB_STEP_SUMMARY}"
- name: "Upload size report"
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: rokt-sdk-plus-size-report
path: |
${{ runner.temp }}/size-report.md
${{ runner.temp }}/base.json
${{ runner.temp }}/head.json
retention-days: 14
# A pull_request from a fork gets a read-only token regardless of the permissions above,
# so commenting would 403. The job summary and the artifact still carry the result.
- name: "Find existing comment"
id: existing
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: ${{ env.COMMENT_IDENTIFIER }}
- name: "Create or update PR comment"
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5
with:
comment-id: ${{ steps.existing.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace
body-path: ${{ runner.temp }}/size-report.md