File tree 4 files changed +63
-2
lines changed
4 files changed +63
-2
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,27 @@ jobs:
107
107
uses : codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0
108
108
with :
109
109
files : lcov.info
110
+ # Check if the bundle size was committed and is up-to-date
111
+ bundle-size :
112
+ runs-on : ubuntu-latest
113
+ steps :
114
+ - name : Checking out
115
+ uses : actions/checkout@v2
116
+ - name : Install Rust toolchain
117
+ uses : ./.github/actions/rust-cargo-run
118
+ with :
119
+ command : version
120
+ github_token : ${{ secrets.GITHUB_TOKEN }}
121
+ - name : Update bundle size
122
+ run : |
123
+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
124
+ git config --local user.name "github-actions[bot]"
125
+ make bundle-size
126
+ git commit -a -m "update bundle-size"
127
+ - name : Push changes
128
+ uses : ad-m/github-push-action@master
129
+ with :
130
+ branch : ${{ github.head_ref }}
110
131
# Lint shell scripts
111
132
shellcheck :
112
133
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change @@ -42,7 +42,11 @@ publish:
42
42
43
43
# Create a bundle in a deterministic location
44
44
bundle : deps-build
45
- cargo run -- -o output/builtin-actors.car
45
+ cargo run --locked -- -o output/builtin-actors.car
46
+
47
+ # Update the bundle size file
48
+ bundle-size : bundle
49
+ @bash scripts/update-bundle-size.sh $@ output/builtin-actors.car
46
50
47
51
# Create all canonical network bundles
48
52
all-bundles : bundle-mainnet bundle-caterpillarnet bundle-butterflynet bundle-calibrationnet bundle-devnet bundle-testing bundle-testing
@@ -66,7 +70,8 @@ bundle-testing: deps-build
66
70
BUILD_FIL_NETWORK=testing cargo run -- -o output/builtin-actors-testing.car
67
71
BUILD_FIL_NETWORK=testing-fake-proofs cargo run -- -o output/builtin-actors-testing-fake-proofs.car
68
72
69
- .PHONY : all-bundles bundle-mainnet bundle-caterpillarnet bundle-butterflynet bundle-calibrationnet bundle-devnet bundle-testing
73
+
74
+ .PHONY : all-bundles bundle-mainnet bundle-caterpillarnet bundle-butterflynet bundle-calibrationnet bundle-devnet bundle-testing bundle-size
70
75
71
76
# Check if the working tree is clean.
72
77
check-clean :
Original file line number Diff line number Diff line change
1
+ 6033975
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # Checks and updates bundle size file, printing delta between the previous and current bundle size.
3
+
4
+ # Check if the user provided both arguments
5
+ if [ $# -ne 2 ]; then
6
+ echo " Usage: ./update-bundle-size.sh <bundle-size-path> <bundle-path>"
7
+ exit 1
8
+ fi
9
+
10
+ # Check if paths exist
11
+ if [[ ! -f $1 || ! -f $2 ]]; then
12
+ echo " Invalid arguments. Please check that the files exist."
13
+ exit 1
14
+ fi
15
+
16
+ bundle_size_path=$1
17
+ bundle_path=$2
18
+
19
+ # Grab the current bundle size
20
+ size_old=$( head -n 1 " $bundle_size_path " )
21
+
22
+ # Update bundle size
23
+ wc -c < " $bundle_path " > " $bundle_size_path "
24
+
25
+ # Grab the new bundle size
26
+ size_new=$( head -n 1 " $bundle_size_path " )
27
+
28
+ # Calculate the difference
29
+ diff=$(( size_new - size_old))
30
+
31
+ # Print stats
32
+ echo " Old bundle size: $size_old "
33
+ echo " New bundle size: $size_new "
34
+ echo " Delta: $diff bytes"
You can’t perform that action at this time.
0 commit comments