Starwars #10344
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
name: AssetSize | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- labeled | |
- synchronize | |
- ready_for_review | |
env: | |
TURBO_API: http://127.0.0.1:9080 | |
TURBO_TOKEN: this-is-not-a-secret | |
TURBO_TEAM: myself | |
concurrency: | |
group: asset-size-${{ github.head_ref || github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
asset-size-check: | |
if: contains(github.event.pull_request.labels.*.name, 'ci-assetsize') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 | |
with: | |
fetch-depth: 3 | |
- run: git fetch origin main --depth=1 | |
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 19.x | |
cache: 'pnpm' | |
- name: Check SHA | |
run: | | |
sha=$(git rev-parse --short=8 HEAD) | |
echo "HEAD sha=$sha" | |
echo "GITHUB_SHA sha=$GITHUB_SHA" | |
mkdir -p tmp | |
echo $sha > tmp/sha-for-check.txt | |
originSha=$(git rev-parse HEAD^2) | |
echo $originSha > tmp/sha-for-commit.txt | |
git show --format=short --no-patch $originSha | |
- name: Checkout main | |
run: git checkout main | |
- name: Install dependencies for main | |
run: pnpm install | |
- name: Build Production main | |
run: pnpm --filter "full-data-asset-size-app" exec ember build -e production --output-path dists/control --suppress-sizes | |
- name: Checkout ${{github.ref}} | |
run: | | |
sha=$(cat tmp/sha-for-check.txt) | |
git checkout --progress --force $sha | |
- name: Install dependencies for ${{github.ref}} | |
run: rm -rf node_modules **/node_modules && pnpm install --force | |
- name: Build Production ${{github.ref}} | |
run: pnpm --filter "full-data-asset-size-app" exec ember build -e production --output-path dists/experiment --suppress-sizes | |
- name: Analyze Master Assets | |
run: | | |
mkdir -p tmp | |
mkdir -p tmp/asset-sizes | |
node ./scripts/asset-size-tracking/generate-analysis.js tests/full-data-asset-size-app/dists/control ./control-data.json | |
node ./scripts/asset-size-tracking/print-analysis.js ./control-data.json -show > tmp/asset-sizes/main-analysis.txt | |
- name: Analyze ${{github.ref}} Assets | |
run: | | |
node ./scripts/asset-size-tracking/generate-analysis.js tests/full-data-asset-size-app/dists/experiment ./experiment-data.json | |
node ./scripts/asset-size-tracking/print-analysis.js ./experiment-data.json -show > tmp/asset-sizes/experiment-analysis-full.txt | |
node ./scripts/asset-size-tracking/print-analysis.js ./experiment-data.json > tmp/asset-sizes/experiment-analysis.txt | |
- name: Test Asset Sizes | |
if: failure() || success() | |
run: | | |
set -o pipefail | |
node ./scripts/asset-size-tracking/generate-diff.js ./control-data.json ./experiment-data.json | tee tmp/asset-sizes/diff.txt | |
- name: Upload Dist Artifacts | |
if: failure() || success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dists | |
path: tests/full-data-asset-size-app/dists | |
- name: Upload Report Artifacts | |
if: failure() || success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: reports | |
path: tmp/asset-sizes | |
- name: Report Asset Sizes | |
if: failure() || success() | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
COMMENT_MARKER="Asset Size Report for " | |
sha=$(cat tmp/sha-for-commit.txt) | |
node ./scripts/asset-size-tracking/src/create-comment-text.js $sha > tmp/asset-sizes/comment.txt | |
COMMENT_TEXT="@./tmp/asset-sizes/comment.txt" | |
source scripts/asset-size-tracking/src/post-comment.sh |