Skip to content

Add bundle size limits and tracking to Github CLI #30

Add bundle size limits and tracking to Github CLI

Add bundle size limits and tracking to Github CLI #30

name: Bundle Size Tracker
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened]
jobs:
release:
if: github.repository == 'sourcegraph/cody'
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: write # for publishing the release
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version-file: .tool-versions
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # SECURITY: pin third-party action hashes
with:
run_install: true
- run: pnpm -C vscode run build
- name: Check bundle sizes
run: |
cd vscode
pnpm ts-node ./scripts/measure-bundle-size.ts
cd ..
echo "Extension Bundle Size: $EXTENSION_BUNDLE_SIZE_MB MB"
echo "Webview Bundle Size: $WEBVIEW_BUNDLE_SIZE_MB MB"
env:
GITHUB_ENV: $GITHUB_ENV
- name: Authenticate to Google Cloud
uses: 'google-github-actions/auth@v2'
with:
project_id: 'cody-core-dev'
workload_identity_provider: 'projects/39257127245/locations/global/workloadIdentityPools/github/providers/cody'
- id: create_release
run: echo "::set-output name=version_tag::v13.0.0"
- name: Insert data into BigQuery
run: |
# Compute the current date
current_date=$(date +'%Y-%m-%d')
# Now create the JSON and insert into BigQuery
echo "{\"release_version\": \"${{ steps.create_release.outputs.version_tag }}\", \"extension_bundle_size_mb\": $EXTENSION_BUNDLE_SIZE_MB, \"webview_bundle_size_mb\": $WEBVIEW_BUNDLE_SIZE_MB, \"date\": \"$current_date\"}" > data.json
bq load \
--project_id='cody-core-dev' \
--source_format=NEWLINE_DELIMITED_JSON \
cody_release.bundle_sizes \
data.json
env:
EXTENSION_BUNDLE_SIZE_MB: ${{ env.EXTENSION_BUNDLE_SIZE_MB }}
WEBVIEW_BUNDLE_SIZE_MB: ${{ env.WEBVIEW_BUNDLE_SIZE_MB }}