Skip to content

Commit 8ddc6a6

Browse files
committed
Refactor hardware info step by OS in benchmark workflow
Split the hardware information printing step into separate steps for Linux, macOS, and Windows in the manual-benchmark workflow. This improves clarity and ensures each OS uses the appropriate commands for gathering hardware details.
1 parent c47765a commit 8ddc6a6

1 file changed

Lines changed: 28 additions & 29 deletions

File tree

.github/workflows/manual-benchmark.yml

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,36 +26,35 @@ jobs:
2626

2727
steps:
2828
# --- Print System Hardware Information ---
29-
- name: Print System Hardware Information
29+
- name: Print Linux Hardware Info
30+
if: runner.os == 'Linux'
3031
run: |
31-
echo "=============================================================================="
32-
echo "Hardware Information for ${{ matrix.os }}"
33-
echo "=============================================================================="
34-
35-
if [[ "${{ runner.os }}" == "Linux" ]]; then
36-
echo "--- CPU Information ---"
37-
lscpu
38-
echo -e "\n--- Memory Information ---"
39-
free -h
40-
41-
elif [[ "${{ runner.os }}" == "macOS" ]]; then
42-
echo "--- System Information ---"
43-
sysctl -a | grep machdep.cpu
44-
echo -e "\n--- Memory Information ---"
45-
sysctl hw.memsize
46-
47-
elif [[ "${{ runner.os }}" == "Windows" ]]; then
48-
echo "--- CPU Information ---"
49-
wmic cpu get Name, NumberOfCores, NumberOfLogicalProcessors /format:list
50-
echo "--- Memory Information ---"
51-
wmic ComputerSystem get TotalPhysicalMemory /format:list
52-
fi
53-
54-
echo "=============================================================================="
55-
# This uses the default shell for each runner, which is bash on
56-
# Linux/macOS and PowerShell on Windows. The syntax here is
57-
# bash-compatible. For Windows, GitHub Actions uses a bash shell
58-
# wrapper.
32+
echo "==================== Hardware Information ===================="
33+
echo "--- CPU ---"
34+
lscpu
35+
echo -e "\n--- Memory ---"
36+
free -h
37+
echo "=========================================================="
38+
39+
- name: Print macOS Hardware Info
40+
if: runner.os == 'macOS'
41+
run: |
42+
echo "==================== Hardware Information ===================="
43+
echo "--- CPU ---"
44+
sysctl -a | grep machdep.cpu
45+
echo -e "\n--- Memory ---"
46+
sysctl hw.memsize
47+
echo "=========================================================="
48+
49+
- name: Print Windows Hardware Info
50+
if: runner.os == 'Windows'
51+
run: |
52+
echo "==================== Hardware Information ===================="
53+
echo "--- CPU ---"
54+
wmic cpu get Name, NumberOfCores, NumberOfLogicalProcessors /format:list
55+
echo "--- Memory ---"
56+
wmic ComputerSystem get TotalPhysicalMemory /format:list
57+
echo "=========================================================="
5958
6059
# Step 2: Check out the specific Git ref provided by the user.
6160
- name: Check out repository

0 commit comments

Comments
 (0)