Files
actions/collect-data/action.yml
2023-11-25 21:35:25 +01:00

64 lines
2.7 KiB
YAML

name: "Collect data"
author: "Igor Pecovnik"
inputs:
STATUS:
required: true
DUT_IP:
required: true
description: ""
runs:
using: "composite"
steps:
- name: "Iperf test"
shell: bash
run: |
if [[ "${{ inputs.STATUS }}" != "notfound" ]]; then
while :
do
IPERF=$(timeout 1000 ssh -o StrictHostKeyChecking=no root@${{ inputs.DUT_IP }} "iperf3 -c 10.0.40.2 -t 5 -J 2>/dev/null | jq '.intervals[] .sum .bits_per_second' | LC_ALL=C datamash median 1 | cut -d"-" -f2" | LC_ALL=C awk '{$1/=1048576;printf "%.0f\n",$1}')
if [[ -n "${IPERF}" ]] ; then
echo "IPERF=${IPERF}" >> $GITHUB_ENV
break
fi
echo "The server is busy running a test"
sleep 2
done
fi
- name: "7Zip benchmark"
shell: bash
run: |
if [[ "${{ inputs.STATUS }}" != "notfound" ]]; then
SEVENZIP=$(timeout 1000 ssh -o StrictHostKeyChecking=no root@${{ inputs.DUT_IP }} "7z b | grep 'Tot:' | awk '{print \$NF}'")
if [[ -n "${SEVENZIP}" ]] ; then
echo "SEVENZIP=${SEVENZIP}" >> $GITHUB_ENV
fi
fi
- name: "Read kernel and U-boot"
shell: bash
run: |
if [[ "${{ inputs.STATUS }}" != "notfound" ]]; then
echo "KERNEL=$(ssh -o StrictHostKeyChecking=no root@${{ inputs.DUT_IP }} "uname -r" || true)" >> $GITHUB_ENV
# read u-boot
root_uuid=$(ssh -o StrictHostKeyChecking=no root@${{ inputs.DUT_IP }} "sed -e 's/^.*root=//' -e 's/ .*$//' < /proc/cmdline" || true)
root_partition_device=$(ssh -o StrictHostKeyChecking=no root@${{ inputs.DUT_IP }} "blkid | tr -d '\":' | grep \"${root_uuid}\" | awk '{print \$1}' | rev | cut -c3- | rev" || true)
echo "UBOOT=$(ssh -o StrictHostKeyChecking=no root@${{ inputs.DUT_IP }} "dd status=none if=${root_partition_device} count=5000 | strings | grep armbian | grep U-Boot | tail -1 | grep -P \"[0-9]{4}.[0-9]{2}\" -o" || true )" >> $GITHUB_ENV
fi
- name: "Armbianmonitor"
shell: bash
run: |
echo "ARMBIAN_MONITOR=<a href=#><img src=https://img.shields.io/static/v1?label=&message=N/A&color=white></a>" >> $GITHUB_ENV
if [[ "${{ inputs.STATUS }}" != "notfound" ]]; then
armbian_monitor=$(ssh -o StrictHostKeyChecking=no root@${{ inputs.DUT_IP }} "armbianmonitor -u | grep -Eo 'https://[^ >]+'" | head -1 || true)
if [[ -n "${armbian_monitor}" ]]; then
echo "ARMBIAN_MONITOR=<a href=${armbian_monitor}><img src=https://img.shields.io/static/v1?label=&message=Log&color=blue></a>" >> $GITHUB_ENV
fi
fi