Skip to content

Commit 337d047

Browse files
authored
Grab Bag of CI Enhancements (#284)
* Grab Bag of CI Enhancements This first set of changes includes the following: - Removes outdated github actions recipes that are no longer functioning. - Updates the benchmark flow to complete much more quickly by: 1. Don't try to run 10 processes concurrently; this seems to be what previously caused some benchmarks to run for hours. 2. Just do 1 iteration (for PR flow); nightly runs will be added later to get more complete results. 3. Partition the test suite to run in 8 parallel jobs. - Build wasmtime main and compare with version 25 (chosen arbitrarily) for test runs. I suspect this will be a discussion point but this was somewhere to start. Matrixing in other versions is very straightforward. * ci: Extract suite splitting to script * ci: re-enable the rebuild job * fixup! ci: Extract suite splitting to script
1 parent b2d61cd commit 337d047

File tree

4 files changed

+118
-32
lines changed

4 files changed

+118
-32
lines changed

.github/workflows/benchmarks.yml

Lines changed: 61 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,80 @@ on:
1010
env:
1111
CARGO_TERM_COLOR: always
1212
RUST_LOG: info
13+
PARTITIONS: 8
1314

1415
jobs:
16+
# verify that we are able to rebuild all benchmarks; the results here
17+
# are not used in the CI pipeline but this verifies that changes have
18+
# not regressed our ability to rebuild benchmarks.
1519
rebuild:
1620
runs-on: ubuntu-latest
1721
steps:
18-
- uses: actions/checkout@v2
19-
- name: Install nightly
20-
uses: actions-rs/toolchain@v1
21-
with:
22-
toolchain: nightly
22+
- uses: actions/checkout@v4
23+
- run: rustup update
2324
- name: Rebuild benchmarks
24-
run: benchmarks/build-all.sh 5
25+
run: benchmarks/build-all.sh
2526

26-
run:
27+
build-wasmtime:
2728
runs-on: ubuntu-latest
29+
strategy:
30+
matrix:
31+
# for now, limit this a bit
32+
revision: ["main", "v25.0.0"]
33+
env:
34+
REVISION: ${{ matrix.revision }}
2835
steps:
29-
- uses: actions/checkout@v2
30-
- name: Install nightly
31-
uses: actions-rs/toolchain@v1
36+
- uses: actions/checkout@v4
37+
- run: rustup update
38+
- name: Build Engine
39+
run: |
40+
pushd engines/wasmtime
41+
rustc build.rs
42+
./build
43+
popd
44+
- name: Upload Wasmtime Shared Library
45+
uses: actions/upload-artifact@v4
3246
with:
33-
toolchain: nightly
34-
- name: Run benchmarks
35-
run: benchmarks/run-all.sh
47+
name: wasmtime-${{ matrix.revision }}
48+
path: engines/wasmtime/libengine.so
49+
50+
benchmark:
51+
runs-on: ubuntu-latest
52+
needs: build-wasmtime
53+
strategy:
54+
matrix:
55+
partition: ["00", "01", "02", "03", "04", "05", "06", "07"]
56+
env:
57+
SPLIT_PREFIX: "benchmarks/split-"
58+
PARTITION_SUITE: "benchmarks/split-${{ matrix.partition }}.suite"
59+
steps:
60+
- uses: actions/checkout@v4
61+
- name: Downloads All Artifacts (root)
62+
uses: actions/download-artifact@v4
63+
with:
64+
path: artifacts
65+
- run: ls -al . artifacts/
66+
- run: rustup update
67+
- run: chmod +x artifacts/*/*.so
68+
- name: Partition Benchmark Suite
69+
run: |
70+
benchmarks/split-suite.sh benchmarks/all.suite ${PARTITIONS} "${SPLIT_PREFIX}"
71+
72+
- name: Output Running Benchmarks
73+
run: cat "${PARTITION_SUITE}"
74+
75+
- name: Benchmark Partition ${{ matrix.partition }}
76+
run: |
77+
cargo run benchmark \
78+
--engine=artifacts/wasmtime-main/libengine.so \
79+
--engine=artifacts/wasmtime-v25.0.0/libengine.so \
80+
--processes=4 \
81+
--iterations-per-process=1 \
82+
-- "${PARTITION_SUITE}"
3683
3784
check:
3885
runs-on: ubuntu-latest
3986
steps:
40-
- uses: actions/checkout@v2
87+
- uses: actions/checkout@v4
4188
- name: Check for missing paths in `all.suite`
4289
run: benchmarks/check-incomplete-suite.sh

.github/workflows/benchmarks_native.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ jobs:
1111
name: Build and run native benchmarks
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
15-
- name: Install nightly
16-
uses: actions-rs/toolchain@v1
17-
with:
18-
toolchain: nightly
14+
- uses: actions/checkout@v4
15+
- run: rustup update nightly
1916
- name: Rebuild and run native benchmarks using Docker
2017
run: benchmarks/build-all-native.sh --run

.github/workflows/sightglass.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,10 @@ jobs:
1919
format:
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v4
2323
with:
2424
submodules: true
25-
- name: Install stable
26-
uses: actions-rs/toolchain@v1
27-
with:
28-
toolchain: stable
25+
- run: rustup update
2926
- run: rustup component add rustfmt
3027
- run: cargo fmt --all -- --check
3128

@@ -35,15 +32,10 @@ jobs:
3532
matrix:
3633
os: [ubuntu-latest, macos-latest, windows-latest]
3734
steps:
38-
- uses: actions/checkout@v2
39-
40-
- name: Install nightly
41-
uses: actions-rs/toolchain@v1
42-
with:
43-
toolchain: nightly
44-
35+
- uses: actions/checkout@v4
36+
- run: rustup update nightly
4537
- name: Download Cached Wasmtime engine
46-
uses: actions/cache@v2
38+
uses: actions/cache@v4
4739
id: wasmtime-cache
4840
with:
4941
path: engines/wasmtime/*

benchmarks/split-suite.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env sh
2+
#
3+
# This script splits a test suite into N roughly
4+
# equally sized test suites using the provided
5+
# output prefix.
6+
#
7+
# Usage:
8+
# ./ci-split.sh <input.suite> <N> <output-prefix>
9+
#
10+
# The naming of the split files will being in the form generated
11+
# by `split` which is `<prefix><num>.suite` where num is in %02d
12+
# format; for example, a prefix of "benchmarks/split-" will yield
13+
# files with names like benchmarks/split-07.suite.
14+
15+
set -e
16+
17+
if [ "$#" -ne 3 ]; then
18+
echo "Usage: $0 <suite> <number splits> <output prefix>"
19+
exit 1
20+
fi
21+
22+
SUITE="$1"
23+
NUMBER_SPLITS="$2"
24+
OUTPUT_PREFIX="$3"
25+
26+
ceil_div() {
27+
echo "($1 + $2 - 1) / $2" | bc
28+
}
29+
30+
count_lines() {
31+
wc -l "$1" | awk '{print $1}'
32+
}
33+
34+
tmpdir="$(mktemp -d)"
35+
tmp_suite="${tmpdir}/input.suite"
36+
grep -v '^\#' "${SUITE}" > "${tmp_suite}"
37+
line_count=$(count_lines "${tmp_suite}")
38+
lines_per_split=$(ceil_div "$line_count" "$NUMBER_SPLITS")
39+
split -d -l "$lines_per_split" "${tmp_suite}" "${OUTPUT_PREFIX}"
40+
rm -rf "$tmpdir"
41+
42+
echo "Generated Splits:"
43+
for f in "${OUTPUT_PREFIX}"*; do
44+
# suite files must end with ".suite" to work correctly
45+
# with sigtglass, so do the rename as split isn't
46+
# able to do it directly.
47+
suited="${f}.suite"
48+
mv "$f" "${suited}"
49+
echo "- ${suited}"
50+
done

0 commit comments

Comments
 (0)