Skip to content

Commit 3d92f98

Browse files
committed
Add option to skip the tests and split it out in the build steps
1 parent 6c4d96c commit 3d92f98

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

.github/workflows/benchmarks-run.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ jobs:
102102
echo "Pallets: $pallets_str"
103103
if [ -z "${pallets_str}" -o $pallets_str = 'all' ]; then
104104
echo "Running benchmarks for all pallets..."
105-
./scripts/run_benchmarks.sh -s
105+
./scripts/run_benchmarks.sh -s -n
106106
else
107107
IFS=',' read -r -a pallets <<< "$pallets_str"
108108
echo "Running benchmarks for pallets: ${pallets[*]}..."
109-
./scripts/run_benchmarks.sh -s "${pallets[@]}"
109+
./scripts/run_benchmarks.sh -s -n "${pallets[@]}"
110110
echo "Finished benchmarks for pallets: ${pallets[*]}."
111111
fi
112112
@@ -121,3 +121,19 @@ jobs:
121121
with:
122122
commit_message: "Update weights"
123123
file_pattern: "pallets/**/*.rs runtime/common/src/weights/*"
124+
125+
test:
126+
if: github.repository == 'frequency-chain/frequency'
127+
name: Post Benchmark Tests
128+
runs-on: ubicloud-standard-16
129+
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.4.0
130+
permissions:
131+
contents: read
132+
steps:
133+
- name: Check Out Repo
134+
uses: actions/checkout@v4
135+
with:
136+
ref: ${{github.event.inputs.branch}}
137+
138+
- name: Run Tests
139+
run: cargo test --features runtime-benchmarks,frequency-lint-check --workspace --release

scripts/run_benchmarks.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ ALL_CUSTOM_PALLETS=( \
3838
declare -a CUSTOM_PALLETS
3939
declare -a EXTERNAL_PALLETS
4040
skip_build=false
41+
skip_tests=false
4142
build_only=false
4243
OVERHEAD=
4344
VERBOSE=
@@ -56,6 +57,8 @@ function usage() {
5657
5758
-s Skip the build step; use existing binary for the current profile
5859
60+
-n Skip the test step
61+
5962
-b Build only; exit after building the binary
6063
6164
-t <profile> Use '--profile=<profile>' in the build step & for locating the
@@ -97,7 +100,7 @@ function is_custom_pallet() {
97100
return 1
98101
}
99102

100-
while getopts 'd:hp:st:vb' flag; do
103+
while getopts 'd:hp:snt:vb' flag; do
101104
case "${flag}" in
102105
d)
103106
# Set project directory
@@ -111,6 +114,10 @@ while getopts 'd:hp:st:vb' flag; do
111114
# Skip build.
112115
skip_build=true
113116
;;
117+
n)
118+
# Skip tests.
119+
skip_tests=true
120+
;;
114121
b)
115122
# Build only
116123
build_only=true
@@ -255,7 +262,10 @@ then
255262
${BENCHMARK} overhead --weight-path=runtime/common/src/weights --chain=dev --warmup=10 --repeat=100 --header="./HEADER-APACHE2" || exit_err
256263
fi
257264

258-
echo "Running tests..."
259-
CMD="cargo test --profile=${PROFILE} --features=runtime-benchmarks,frequency-lint-check --workspace"
260-
echo ${CMD}
261-
${CMD} || exit_err
265+
if [[ ${skip_tests} == false ]]
266+
then
267+
echo "Running tests..."
268+
CMD="cargo test --profile=${PROFILE} --features=runtime-benchmarks,frequency-lint-check --workspace"
269+
echo ${CMD}
270+
${CMD} || exit_err
271+
fi

0 commit comments

Comments
 (0)