Unverified Commit 6ba6762d authored by OJ Kwon's avatar OJ Kwon Committed by GitHub

ci(workflow): consolidate bytesize upload workflow (#51110)



### What?

context: https://github.com/vercel/next.js/actions/runs/5231928600/jobs/9446394605#step:16:33

For some reason, installing datadog cli on some action runner (Windows) is unexpectedly slow: while other platform takes ~30s, windows only takes more than > 7m.

PR updates workflow logic to consolidate artifacts, and then send metrics at once on a separate ubuntu workflow.
parent cfd64aab
......@@ -166,7 +166,6 @@ jobs:
TURBO_TEAM: 'vercel'
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: 'true'
DATADOG_API_KEY: ${{ secrets.DATA_DOG_API_KEY }}
steps:
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
......@@ -253,12 +252,13 @@ jobs:
run: if [[ ! -z $(ls .turbo/runs) ]]; then echo "DID_BUILD=yup" >> $GITHUB_OUTPUT; fi
# Trying to upload metrics for the Turbopack to datadog's CI pipeline execution
- name: 'Upload turbopack build metrics'
- name: 'Collect turbopack build metrics'
id: check-turbopack-bytesize
shell: bash
if: ${{ steps.check-did-build.outputs.DID_BUILD == 'yup' }}
continue-on-error: true
run: |
npm install -g @datadog/datadog-ci
mkdir -p ./turbopack-bin-size
shopt -s nullglob
for filename in packages/next-swc/native/next-swc.*.node; do
# Strip out filename to extract target triple
......@@ -267,9 +267,16 @@ jobs:
export FILENAME=${FILENAME%.node}
export BYTESIZE=$(wc -c < $filename | xargs)
echo "Reporting $FILENAME:$BYTESIZE for Turbopack bytesize"
datadog-ci metric --no-fail --level pipeline --metrics "turbopack.bytesize.$FILENAME:$BYTESIZE"
echo "turbopack.bytesize.$FILENAME:$BYTESIZE" > ./turbopack-bin-size/${{ matrix.settings.target }}
done
- name: Upload turbopack bytesize artifact
if: ${{ steps.check-did-build.outputs.DID_BUILD == 'yup' }}
uses: actions/upload-artifact@v3
with:
name: turbopack-bytesize
path: turbopack-bin-size/*
- name: Upload swc artifact
if: ${{ needs.build.outputs.isRelease == 'true' }}
uses: actions/upload-artifact@v3
......@@ -469,3 +476,25 @@ jobs:
- uses: ./.github/actions/next-stats-action
env:
PR_STATS_COMMENT_TOKEN: ${{ secrets.PR_STATS_COMMENT_TOKEN }}
upload_turbopack_bytesize:
name: Upload Turbopack Bytesize trace to Datadog
runs-on: ubuntu-latest
needs: [build-native]
env:
DATADOG_API_KEY: ${{ secrets.DATA_DOG_API_KEY }}
steps:
- name: Collect bytesize traces
uses: actions/download-artifact@v3
with:
name: turbopack-bytesize
path: turbopack-bin-size
- name: Upload to Datadog
run: |
ls -al turbopack-bin-size
npm install -g @datadog/datadog-ci
for filename in turbopack-bin-size/*; do
export BYTESIZE+=" --metrics $(cat $filename)"
done
echo "Reporting $BYTESIZE"
datadog-ci metric --no-fail --level pipeline $BYTESIZE
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment