Skip to content

Commit

Permalink
ci(workflow): consolidate bytesize upload workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Jun 11, 2023
1 parent db10dd6 commit 78168fb
Showing 1 changed file with 33 additions and 4 deletions.
37 changes: 33 additions & 4 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 78168fb

Please sign in to comment.