-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Expand file tree
/
Copy pathjustfile
More file actions
176 lines (145 loc) · 6.27 KB
/
justfile
File metadata and controls
176 lines (145 loc) · 6.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# list all available recipes
default:
just --list --unsorted
[group('ci')]
[confirm("Do you want to install cargo-sort, cargo-generate and cargo-udeps from crates.io?")]
install-ci-check:
cargo install cargo-sort
cargo install cargo-generate
cargo install cargo-udeps
[group('ci')]
ci-check:
bash ./ci_checks.sh
[group('automation')]
[confirm("Do you want to bump all fuel maintained dependencies?")]
update-fuel-dependencies:
bash ./update_fuel_dependencies.sh
[group('automation')]
[confirm("Do you want to automatically update contractIds in this repo?")]
update-contract-ids:
bash ./test/update-contract-ids.sh
[group('automation')]
bisect-forc path command:
bash ./scripts/bisect-forc/bisect-forc.sh "{{path}}" "{{command}}"
# The `benchmark` group contains recipes related to benchmarking the Sway compiler, e.g., compilation times.
[group('benchmark')]
benchmark:
bash ./benchmark.sh
[group('benchmark')]
benchmark-tests:
bash ./test/bench.sh
# The `performance` group contains recipes related to benchmarking the performance of compiled code:
# gas usages and bytecode sizes.
alias pe2e := perf-e2e
# collect gas usages and bytecode sizes from E2E tests
[group('performance')]
perf-e2e filter='':
cargo r -r -p test -- --release --kind e2e --perf-only --perf {{filter}}
alias pil := perf-in-lang
# collect gas usages from in-language tests
[group('performance')]
perf-in-lang filter='':
#!/usr/bin/env bash
branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null); [[ "$branch" == "HEAD" || -z "$branch" ]] && branch="unknown-branch"; branch=${branch//\//-};
outfile="./test/perf_out/$(date '+%m%d%H%M%S')-in-language-gas-usages-release-$branch.csv"
cargo r -r -p forc -- test --release --path ./test/src/in_language_tests {{filter}} | ./scripts/perf/extract-gas-usages.sh > "$outfile"
echo "Gas usages written to: $outfile"
alias pa := perf-all
# collect gas usages and bytecode sizes from all tests (E2E and in-language)
[group('performance')]
perf-all filter='': (perf-e2e filter) (perf-in-lang filter)
alias pd := perf-diff
# generate performance diff between two CSV files
[group('performance')]
perf-diff before after format='md':
./scripts/perf/perf-diff.sh "{{before}}" "{{after}}" "{{format}}"
alias pds := perf-diff-stats
# generate performance statistics summary from a `perf-diff` output CSV file
[group('performance')]
perf-diff-stats diff_file:
cat "{{diff_file}}" | ./scripts/perf/perf-diff-stats.sh
alias pdl := perf-diff-latest
# generate performance diffs between the latest two CSV files per testing category
[group('performance')]
perf-diff-latest format='md':
./scripts/perf/perf-diff-latest.sh "{{format}}"
# This recipe should be used on snapshot tests that contain gas usages from `forc test`.
# It will extract gas usages from versions of the test's `stdout.snap` file
# that are within of the `revision_range`, and output a CSV pivot table
# or an interactive HTML report, depending on the `format`.
# path: repo path to `stdout.snap` file to extract gas usage from, e.g.: `test/src/e2e_vm_tests/path_to/some_test/stdout.snap`
# revision_range: Git revision range to consider when collecting historic gas usages, e.g.: `HEAD~10..HEAD` (default: all revisions)
# format: output format, either `csv` or `html` (default: `csv`)
# open: for `html` output, `-o` opens the report in the default browser
alias psh := perf-snapshot-historical
# collect historic gas usages from a snapshot test that has a `forc test` output
[linux]
[group('performance')]
perf-snapshot-historical path revision_range='' format='csv' open='':
#!/usr/bin/env bash
if [[ "{{format}}" != "csv" && "{{format}}" != "html" ]]; then
echo "ERROR: Invalid output format '{{format}}'. Output format must be either 'csv' or 'html'."
exit 1
fi
now_ts=$(date '+%m%d%H%M%S')
outfile="./test/perf_out/$now_ts-snapshot-gas-usages-historical-$(basename "$(dirname "{{path}}")")"
echo "test,gas,commit" > "$outfile.csv"
for HASH in `git log --format='%H' {{revision_range}} -- {{path}}`; do
TIMESTAMP=$(git show -s --format='%as-%ct-%H' "$HASH")
git --no-pager show "$HASH:{{path}}" | bash -c "scripts/perf/extract-gas-usages.sh $TIMESTAMP" >> "$outfile.csv"
done
echo "Historical gas usages written to: $outfile.csv"
if [ "{{format}}" = "html" ]; then
./scripts/csv2html/csv2html.sh "$outfile.csv" >> "$outfile.html"
echo "Pivot table written to: $outfile.html"
if [ -n "{{open}}" ]; then
if which xdg-open &>> /dev/null
then
xdg-open "$outfile.html"
elif which gnome-open &>> /dev/null
then
gnome-open "$outfile.html"
fi
fi
else
pivot_file="./test/perf_out/$now_ts-pivot-snapshot-gas-usages-historical-$(basename "$(dirname "{{path}}")")"
clipivot max $outfile.csv --rows=test --cols=commit --val=gas > $pivot_file.csv
echo "Pivot table written to: $pivot_file.csv"
fi
alias pl := perf-list
# list all performance files (*gas-usages-*.* and *bytecode-sizes-*.*)
[group('performance')]
perf-list:
find . -type f \( -name '*-gas-usages-*.*' -o -name '*-bytecode-sizes-*.*' \) -print | sort
alias pr := perf-remove
# remove all performance files (*gas-usages-*.* and *bytecode-sizes-*.*)
[group('performance')]
perf-remove:
#!/usr/bin/env bash
files=$(find . -type f \( -name '*-gas-usages-*.*' -o -name '*-bytecode-sizes-*.*' \) -print | sort)
if [ -z "$files" ]; then
echo "No performance data files to remove."
exit 0
fi
echo "The following performance data files will be removed:"
echo "$files"
echo
read -r -p 'Do you want to proceed with removing? [y/N] ' yn
if [[ $yn =~ ^[Yy]$ ]]; then
echo "Removing..."
find . -type f \( -name '*-gas-usages-*.*' -o -name '*-bytecode-sizes-*.*' \) -print -delete
else
echo "Removing canceled."
fi
[group('build')]
build-prism:
cd ./scripts/prism && ./build.sh
[group('build')]
build-highlightjs:
cd ./scripts/highlightjs && ./build.sh
[group('build')]
generate-sway-lib-std:
cd ./sway-lib-std && ./generate.sh
[group('test')]
test-forc-fmt-check-panic:
cd ./scripts/formatter && ./forc-fmt-check-panic.sh