Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 28 additions & 2 deletions .github/workflows/build-unitycloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,8 @@ jobs:
id: size_check
env:
# Per-target absolute caps (MB)
MAX_MACOS_MB: 370
MAX_WINDOWS64_MB: 280
MAX_MACOS_MB: 410
MAX_WINDOWS64_MB: 320

# Per-platform delta thresholds (MB); 0 = disabled
DELTA_MACOS_MB: ${{ github.event.inputs.delta_threshold_macos_mb || inputs.delta_threshold_macos_mb || '0' }}
Expand Down Expand Up @@ -528,10 +528,36 @@ jobs:
fi
} >> "$GITHUB_STEP_SUMMARY"

# Export key values so the PR comment workflow can include them
echo "size_mb=$MB_DEC" >> "$GITHUB_OUTPUT"
echo "size_mib=$MIB_BIN" >> "$GITHUB_OUTPUT"
echo "cap_mb=${MAX:-0}" >> "$GITHUB_OUTPUT"
echo "delta_mb=$DELTA_MB" >> "$GITHUB_OUTPUT"
echo "delta_pct=$DELTA_PCT" >> "$GITHUB_OUTPUT"
echo "release_tag=${RELEASE_TAG:-}" >> "$GITHUB_OUTPUT"
echo "result=$RESULT" >> "$GITHUB_OUTPUT"

# Enforce (fail the job) only if toggles are true
if [ "$CAP_EXCEEDED" = true ] && [ "${ENFORCE_CAP}" = "true" ]; then exit 1; fi
if [ "$DELTA_EXCEEDED" = true ] && [ "${ENFORCE_DELTA}" = "true" ]; then exit 1; fi

- name: Save size report
if: always() && steps.size_check.outputs.result != ''
run: |
mkdir -p size_report
{
echo "release_tag=${{ steps.size_check.outputs.release_tag }}"
echo "| ${{ matrix.target }} | ${{ steps.size_check.outputs.size_mb }} / ${{ steps.size_check.outputs.size_mib }} | ${{ steps.size_check.outputs.cap_mb }} | ${{ steps.size_check.outputs.delta_mb }} | ${{ steps.size_check.outputs.delta_pct }} | ${{ steps.size_check.outputs.result }} |"
} > size_report/size_report_${{ matrix.target }}.md

- name: Upload size report
if: always() && steps.size_check.outputs.result != ''
uses: actions/upload-artifact@v4
with:
name: size_report_${{ matrix.target }}
path: size_report/
if-no-files-found: warn

- name: Set SHA, branch, and build prefix
run: |
echo "SHA_SHORT=$(echo ${{ needs.prebuild.outputs.commit_sha }} | cut -c1-7)" >> $GITHUB_ENV
Expand Down
45 changes: 41 additions & 4 deletions .github/workflows/pr-comment-artifact-url.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- "Unity Cloud Build"
branches-ignore:
- "main"

workflow_dispatch:
permissions:
contents: read
pull-requests: write
Expand Down Expand Up @@ -109,6 +109,41 @@ jobs:
echo "Build done on: $BUILD_DATE"
echo "BUILD_DATE=$BUILD_DATE" >> "$GITHUB_ENV"

- name: Download size reports
env:
GITHUB_TOKEN: ${{ github.token }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
run: |
gh run download "$PREVIOUS_JOB_ID" \
--repo "$OWNER/$REPO" \
--name size_report_windows64 \
--dir size_reports 2>/dev/null || true
gh run download "$PREVIOUS_JOB_ID" \
--repo "$OWNER/$REPO" \
--name size_report_macos \
--dir size_reports 2>/dev/null || true

WINDOWS_ROW=$(grep "^|" size_reports/size_report_windows64.md 2>/dev/null || true)
MACOS_ROW=$(grep "^|" size_reports/size_report_macos.md 2>/dev/null || true)
RELEASE_TAG=$(grep "^release_tag=" size_reports/size_report_windows64.md size_reports/size_report_macos.md 2>/dev/null | head -1 | cut -d= -f2 || true)

if [ -n "$WINDOWS_ROW" ] || [ -n "$MACOS_ROW" ]; then
{
echo "SIZE_REPORT<<EOF"
echo "### Artifact size check"
echo ""
echo "| Target | Size (MB / MiB) | Cap (MB) | Δ MB vs release | Δ % vs release | Result |"
echo "|--------|----------------:|--------:|----------------:|---------------:|--------|"
[ -n "$WINDOWS_ROW" ] && echo "$WINDOWS_ROW"
[ -n "$MACOS_ROW" ] && echo "$MACOS_ROW"
[ -n "$RELEASE_TAG" ] && echo "" && echo "_Comparing against: **${RELEASE_TAG}**_"
echo "EOF"
} >> "$GITHUB_ENV"
else
echo "SIZE_REPORT=" >> "$GITHUB_ENV"
fi

- name: Find Comment
uses: peter-evans/find-comment@v2
id: find-comment
Expand All @@ -130,10 +165,10 @@ jobs:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
edit-mode: replace
body: |-
![badge] <img src="https://ui.decentraland.org/decentraland_256x256.png" width="30">
![badge] <img src="https://ui.decentraland.org/decentraland_256x256.png" width="30">

Windows and Mac build successful in Unity Cloud! You can find a link to the downloadable artifact below.

| Name | Link |
| -------- | ----------------------- |
| Commit | ${{ env.HEAD_SHA }} |
Expand All @@ -144,6 +179,8 @@ jobs:
| Download Mac S3 | ${{ env.MAC_ARTIFACT_S3_URL }} |
| Built on | ${{ env.BUILD_DATE }} |

${{ env.SIZE_REPORT }}

[badge]: https://img.shields.io/badge/Build-Success!-3fb950?logo=github&style=for-the-badge

comment-failed:
Expand Down