CI: display number of cores, physical memory, and partition size (#2353)

This commit is contained in:
andri lim 2024-06-14 13:04:25 +07:00 committed by GitHub
parent 7fd777cfa9
commit 3b5a56fd32
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 0 deletions

View File

@ -91,12 +91,24 @@ jobs:
case '${{ runner.os }}' in
'Linux')
ncpu=$(nproc)
echo "Number of cores: ${ncpu}"
echo "$(grep MemTotal /proc/meminfo)"
echo -e "Partition sizes:\n$(df -k -h .)"
;;
'macOS')
ncpu=$(sysctl -n hw.ncpu)
hwmemsize=$(sysctl -n hw.memsize)
ramsize=$(expr $hwmemsize / $((1024**3)))
echo "Number of cores: ${ncpu}"
echo "Physical memory: ${ramsize} GB"
echo -e "Partition sizes:\n$(df -k -h .)"
;;
'Windows')
ncpu=${NUMBER_OF_PROCESSORS}
CD=${PWD:1:1}
echo "Number of cores: ${NUMBER_OF_PROCESSORS}"
echo "Physical memory: $(wmic ComputerSystem get TotalPhysicalMemory)"
echo -e "Partition sizes:\n$(wmic logicaldisk get name,size,freespace | grep -e "${CD^}" -e "FreeSpace")"
;;
esac
[[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1