Skip to content

Commit 7173829

Browse files
authored
Merge branch 'develop' into metrics-adjustments
2 parents 791dfac + e280204 commit 7173829

File tree

63 files changed

+1010
-667
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1010
-667
lines changed

.circleci/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,9 @@ jobs:
627627
- run:
628628
name: Run page load benchmark
629629
command: yarn mv3:stats:chrome --out test-artifacts/chrome/mv3
630+
- run:
631+
name: Record bundle size at commit
632+
command: ./.circleci/scripts/bundle-stats-commit.sh
630633
- store_artifacts:
631634
path: test-artifacts
632635
destination: test-artifacts
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -u
5+
set -o pipefail
6+
7+
if [[ "${CI:-}" != 'true' ]]
8+
then
9+
printf '%s\n' 'CI environment variable must be set to true'
10+
exit 1
11+
fi
12+
13+
if [[ "${CIRCLECI:-}" != 'true' ]]
14+
then
15+
printf '%s\n' 'CIRCLECI environment variable must be set to true'
16+
exit 1
17+
fi
18+
19+
if [[ -z "${GITHUB_TOKEN:-}" ]]
20+
then
21+
printf '%s\n' 'GITHUB_TOKEN environment variable must be set'
22+
exit 1
23+
elif [[ -z "${GITHUB_TOKEN_USER:-}" ]]
24+
then
25+
printf '%s\n' 'GITHUB_TOKEN_USER environment variable must be set'
26+
exit 1
27+
fi
28+
29+
printf '%s\n' 'Commit the manifest version and changelog if the manifest has changed'
30+
31+
if [[ "${CIRCLE_BRANCH}" != "develop" ]]
32+
then
33+
printf 'This is not develop branch'
34+
exit 0
35+
fi
36+
37+
mkdir temp
38+
39+
git config --global user.email "metamaskbot@users.noreply.github.com"
40+
41+
git config --global user.name "MetaMask Bot"
42+
43+
git clone git@github.com:MetaMask/extension_bundlesize_stats.git temp
44+
45+
if [[ -f "temp/stats/bundle_size_stats-${CIRCLE_SHA1}.json" ]]
46+
then
47+
printf 'Bundle size of the commit is already recorded'
48+
cd ..
49+
rm -rf temp
50+
exit 0
51+
fi
52+
53+
cp -R test-artifacts/chrome/mv3/bundle_size_stats.json temp/stats
54+
55+
echo " bundle_size_stats-${CIRCLE_SHA1}.json" >> temp/stats/fileList.txt
56+
57+
mv temp/stats/bundle_size_stats.json "temp/stats/bundle_size_stats-${CIRCLE_SHA1}.json"
58+
59+
cd temp
60+
61+
git add .
62+
63+
git commit --message "Bundle size at commit: ${CIRCLE_SHA1}"
64+
65+
repo_slug="$CIRCLE_PROJECT_USERNAME/extension_bundlesize_stats"
66+
git push "https://$GITHUB_TOKEN_USER:$GITHUB_TOKEN@github.com/$repo_slug" main
67+
68+
cd ..
69+
70+
rm -rf temp

0 commit comments

Comments
 (0)