Skip to content

Commit 4ee6017

Browse files
committed
Automated USB performance testing: enabling GHA
1 parent 58f9c73 commit 4ee6017

File tree

2 files changed

+194
-2
lines changed

2 files changed

+194
-2
lines changed
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
name: "Scan USB devices"
2+
on:
3+
workflow_dispatch: # Manually triggered via GitHub Actions UI
4+
schedule:
5+
- cron: '0 8 * * *'
6+
7+
jobs:
8+
9+
prepare:
10+
name: "Power system on"
11+
outputs:
12+
DEPLOYMENT_MATRIX: "${{ steps.json.outputs.DEPLOYMENT_MATRIX }}"
13+
runs-on: "ubuntu-24.04"
14+
steps:
15+
16+
# step for actual powering on / off TBD
17+
18+
- name: Get devices from database
19+
id: json
20+
run: |
21+
22+
delimiter="$(openssl rand -hex 8)"
23+
echo "DEPLOYMENT_MATRIX<<${delimiter}" >> "${GITHUB_OUTPUT}"
24+
curl -H "Authorization: Token ${{ secrets.NETBOX_TOKEN }}" -H "Accept: application/json; indent=4" \
25+
"https://stuff.armbian.com/netbox/api/dcim/devices/?limit=500&name__empty=false&status=active" | \
26+
jq '.results[] | select(.device_role.slug == "wifi-dut") | {name: .name, serial: .serial, device_type: .device_type.model, device_class: .custom_fields.class}' | \
27+
jq -s >> $GITHUB_OUTPUT
28+
echo "${delimiter}" >> "${GITHUB_OUTPUT}"
29+
30+
gradle:
31+
name: "Testing ${{ matrix.json.name }}"
32+
runs-on: "ubuntu-24.04"
33+
needs: prepare
34+
if: ${{ needs.prepare.outputs.DEPLOYMENT_MATRIX != '[]' }}
35+
timeout-minutes: 20
36+
strategy:
37+
max-parallel: 1
38+
fail-fast: false
39+
matrix:
40+
json: ${{ fromJSON(needs.prepare.outputs.DEPLOYMENT_MATRIX) }}
41+
steps:
42+
43+
- name: "Connect to Tailscale network"
44+
uses: tailscale/github-action@v3
45+
with:
46+
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
47+
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
48+
tags: tag:ci
49+
50+
- name: "Install SSH key"
51+
uses: shimataro/ssh-key-action@v2
52+
with:
53+
key: ${{ secrets.KEY_CI }}
54+
known_hosts: ${{ secrets.KNOWN_HOSTS_ARMBIAN_CI }}
55+
if_key_exists: replace
56+
57+
- name: "Generate YAML for wireless device"
58+
shell: bash
59+
run: |
60+
61+
DEVICE=$(echo "wlx${{ matrix.json.serial }}" | sed "s/://g")
62+
63+
case "${{ matrix.json.device_class }}" in
64+
"AC600")
65+
ACCESS_POINT="GOSTJE50"
66+
;;
67+
*)
68+
ACCESS_POINT="GOSTJE24"
69+
;;
70+
esac
71+
72+
cat > wireless.yaml <<- EOT
73+
network:
74+
version: 2
75+
renderer: networkd
76+
wifis:
77+
${DEVICE}:
78+
addresses:
79+
- "10.0.50.50/24"
80+
nameservers:
81+
addresses:
82+
- 9.9.9.9
83+
- 1.1.1.1
84+
dhcp4: false
85+
dhcp6: false
86+
macaddress: "${{ matrix.json.serial }}"
87+
access-points:
88+
"${ACCESS_POINT}":
89+
auth:
90+
key-management: "psk"
91+
password: "password"
92+
EOT
93+
94+
- name: "Enable wireless adapter"
95+
shell: bash
96+
run: |
97+
98+
scp wireless.yaml [email protected]:/tmp
99+
ssh [email protected] "sudo mv /tmp/wireless.yaml /etc/netplan/"
100+
ssh [email protected] "sudo chmod 600 /etc/netplan/*"
101+
ssh [email protected] "sudo netplan apply"
102+
103+
- name: "Make sure its connected"
104+
timeout-minutes: 1
105+
shell: bash
106+
run: |
107+
108+
DEVICE=$(echo "wlx${{ matrix.json.serial }}" | sed "s/://g")
109+
while true; do
110+
#CONNECTION=$(ssh [email protected] "nmcli -t -f NAME connection show --active | grep ${DEVICE} || true")
111+
CONNECTION=$(ssh [email protected] "networkctl | grep ${DEVICE} | grep routable || true")
112+
if [[ -n "${CONNECTION}" ]]; then
113+
break
114+
fi
115+
sleep 2
116+
done
117+
118+
- name: "Do some perf testing"
119+
shell: bash
120+
run: |
121+
122+
DEVICE=$(echo "wlx${{ matrix.json.serial }}" | sed "s/://g")
123+
echo "DEVICE=$DEVICE" >> $GITHUB_ENV
124+
rm -rf test; mkdir -p test
125+
numbers=$(ssh [email protected] "iperf3 -R -c 10.0.60.10 -B 10.0.50.50 -t 5 -J | jq '.intervals[] .sum .bits_per_second' | LC_ALL=C datamash median 1 | cut -d"-" -f2")
126+
mbits=$(echo $numbers | LC_ALL=C awk '{$1/=1048576;printf "%.0f Mbps\n",$1}')
127+
echo "|${{ matrix.json.name }}|${{ matrix.json.device_type }}| ${{ matrix.json.serial }} | ${{ matrix.json.device_class }} | ${mbits} |" > test/${DEVICE}.iperf
128+
129+
# get Armbian version and kernel
130+
echo "$(ssh [email protected] "cat /etc/armbian-release | grep VERSION")" > test/${DEVICE}.system
131+
echo "$(ssh [email protected] "cat /etc/armbian-release | grep ^ARCH")" > test/${DEVICE}.system
132+
echo "KERNEL=$(ssh [email protected] "uname -r")" >> test/${DEVICE}.system
133+
134+
- name: "Remove adapter"
135+
shell: bash
136+
run: |
137+
138+
ssh [email protected] "sudo rm /etc/netplan/wireless.yaml"
139+
ssh [email protected] "sudo netplan apply"
140+
141+
- name: "Upload test summary"
142+
uses: actions/upload-artifact@v4
143+
with:
144+
name: test-${{ env.DEVICE }}
145+
path: test
146+
if-no-files-found: ignore
147+
148+
stop:
149+
name: "Merge test artifacts"
150+
if: always()
151+
needs: gradle
152+
runs-on: ubuntu-24.04
153+
steps:
154+
155+
- name: "Connect to Tailscale network"
156+
uses: tailscale/github-action@v3
157+
with:
158+
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
159+
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
160+
tags: tag:ci
161+
162+
- name: "Install SSH key"
163+
uses: shimataro/ssh-key-action@v2
164+
with:
165+
key: ${{ secrets.KEY_CI }}
166+
known_hosts: ${{ secrets.KNOWN_HOSTS_ARMBIAN_CI }}
167+
if_key_exists: replace
168+
169+
- name: Download All Artifacts
170+
uses: actions/download-artifact@v4
171+
with:
172+
path: test
173+
pattern: test-*
174+
merge-multiple: true
175+
176+
- name: Install
177+
run: |
178+
179+
source test/*.system
180+
echo "# USB dongles performance test:" >> $GITHUB_STEP_SUMMARY
181+
echo "Armbian: $VERSION - Kernel: $KERNEL - Architecture: $ARCH" >> $GITHUB_STEP_SUMMARY
182+
echo "|Name|Chip|MAC|Class|Average Iperf|" >> $GITHUB_STEP_SUMMARY
183+
echo "|:---|:---|:---|:---|---:|" >> $GITHUB_STEP_SUMMARY
184+
cat test/*.iperf | sed '$ s/.$//' >> $GITHUB_STEP_SUMMARY
185+
echo "### System logs" >> $GITHUB_STEP_SUMMARY
186+
echo "$(ssh [email protected] "sudo dmesg")" >> $GITHUB_STEP_SUMMARY
187+
188+
- uses: geekyeggo/delete-artifact@v5
189+
with:
190+
name: |
191+
test-*

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ It prepares several data exchange files.
1818
| [Publish content](https://github.armbian.com/) of what is pushed to `data` folder inside `data` repository. | <a href=https://github.com/armbian/armbian.github.io/actions/workflows/directory-listing.yml><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/armbian/armbian.github.io/directory-listing.yml?logo=githubactions&label=Status&style=for-the-badge&branch=main"></a> |
1919
| Extract and store information about base-files. | <a href=https://github.com/armbian/armbian.github.io/actions/workflows/generate-base-files-info-json.yml><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/armbian/armbian.github.io/generate-base-files-info-json.yml?logo=githubactions&label=Status&style=for-the-badge&branch=main"></a> |
2020
| Compare all mirrors content and generate redirector configs | <a href=https://github.com/armbian/armbian.github.io/actions/workflows/generate-redirector-config.yml><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/armbian/armbian.github.io/generate-redirector-config.yml?logo=githubactions&label=Status&style=for-the-badge&branch=main"></a> |
21-
|Update download JSON index|<a href=https://github.com/armbian/armbian.github.io/actions/workflows/generate-web-index.yml><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/armbian/armbian.github.io/generate-web-index.yml?logo=githubactions&label=Status&style=for-the-badge&branch=main"></a>|
22-
|Pull excerpts from Armbian Jira|<a href=https://github.com/armbian/armbian.github.io/actions/workflows/generate-jira-excerpt.yml><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/armbian/armbian.github.io/generate-jira-excerpt.yml?logo=githubactions&label=Status&style=for-the-badge&branch=main"></a>|
21+
| Update download JSON index|<a href=https://github.com/armbian/armbian.github.io/actions/workflows/generate-web-index.yml><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/armbian/armbian.github.io/generate-web-index.yml?logo=githubactions&label=Status&style=for-the-badge&branch=main"></a>|
22+
| Pull excerpts from Armbian Jira|<a href=https://github.com/armbian/armbian.github.io/actions/workflows/generate-jira-excerpt.yml><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/armbian/armbian.github.io/generate-jira-excerpt.yml?logo=githubactions&label=Status&style=for-the-badge&branch=main"></a>|
23+
| USB wireless performance testig |<a href=https://github.com/armbian/armbian.github.io/actions/workflows/usb-wireless-autotest.yml><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/armbian/armbian.github.io/usb-wireless-autotest.yml?logo=githubactions&label=Status&style=for-the-badge&branch=main"></a>|

0 commit comments

Comments
 (0)