Skip to content

Commit 60df9bf

Browse files
committed
ci(workflows): enhance cross-platform benchmark workflow
- add multi-OS support for benchmarking (Ubuntu, macOS, Windows) - implement detailed platform information logging script - update benchmark artifact upload to include binaries for each OS - configure matrix strategy with fail-fast disabled - simplify benchmark binary build and execution process
1 parent 9cde91b commit 60df9bf

File tree

1 file changed

+46
-7
lines changed

1 file changed

+46
-7
lines changed

.github/workflows/benchmark.yml

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ jobs:
1616
if: |
1717
github.event_name == 'workflow_dispatch' ||
1818
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
19-
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
os: [ubuntu-latest, macos-latest, windows-latest]
22+
fail-fast: false
23+
runs-on: ${{ matrix.os }}
2024
steps:
2125
- name: Checkout code
2226
uses: actions/checkout@v4
@@ -26,16 +30,51 @@ jobs:
2630
with:
2731
version: 0.15.1
2832

29-
- name: Build benchmark
30-
run: zig build bench -Doptimize=ReleaseFast
33+
- name: Display platform information
34+
shell: bash
35+
run: |
36+
echo "================================"
37+
echo "Platform Configuration"
38+
echo "================================"
39+
echo "OS: ${{ runner.os }}"
40+
echo "Runner: ${{ matrix.os }}"
41+
echo "Architecture: $(uname -m)"
42+
if [ "$RUNNER_OS" == "Linux" ]; then
43+
echo "Kernel: $(uname -r)"
44+
echo "Distribution: $(cat /etc/os-release | grep PRETTY_NAME | cut -d'=' -f2)"
45+
echo "CPU: $(lscpu | grep 'Model name' | cut -d':' -f2 | xargs)"
46+
echo "Total Memory: $(free -h | grep Mem | awk '{print $2}')"
47+
elif [ "$RUNNER_OS" == "macOS" ]; then
48+
echo "Kernel: $(uname -r)"
49+
echo "CPU: $(sysctl -n machdep.cpu.brand_string)"
50+
echo "Total Memory: $(sysctl -n hw.memsize | awk '{print $1/1024/1024/1024 " GB"}')"
51+
elif [ "$RUNNER_OS" == "Windows" ]; then
52+
echo "Kernel: $(uname -r)"
53+
echo "CPU: $(wmic cpu get name | sed -n 2p)"
54+
echo "Total Memory: $(wmic computersystem get totalphysicalmemory | sed -n 2p | awk '{print $1/1024/1024/1024 " GB"}')"
55+
fi
56+
echo "================================"
57+
echo ""
58+
59+
- name: Build benchmark binary
60+
run: zig build -Doptimize=ReleaseFast
3161

3262
- name: Run benchmark
33-
run: zig-out/bin/msgpack-bench > benchmark-results.txt
63+
shell: bash
64+
run: |
65+
if [ "$RUNNER_OS" == "Windows" ]; then
66+
zig-out/bin/msgpack-bench.exe
67+
else
68+
zig-out/bin/msgpack-bench
69+
fi
3470
35-
- name: Upload benchmark results
71+
- name: Upload benchmark binary
3672
uses: actions/upload-artifact@v4
3773
with:
38-
name: benchmark-results-${{ github.sha }}
39-
path: benchmark-results.txt
74+
name: msgpack-bench-${{ runner.os }}-${{ github.sha }}
75+
path: |
76+
zig-out/bin/msgpack-bench
77+
zig-out/bin/msgpack-bench.exe
4078
retention-days: 7
79+
if-no-files-found: ignore
4180

0 commit comments

Comments
 (0)