-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathaction.yml
More file actions
188 lines (158 loc) · 8.09 KB
/
Copy pathaction.yml
File metadata and controls
188 lines (158 loc) · 8.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
name: "Run on DUT"
author: "Igor Pecovnik"
inputs:
DUT_USER:
required: false
default: 'root'
DUT_IP:
required: true
DUT_SLUG:
required: true
DUT_CONF_TYPE:
required: true
BOARD_NAME:
required: true
LINUXFAMILY:
required: true
BRANCH:
required: true
REPOSITORY:
required: true
STATUS:
required: false
TIMEOUT:
required: false
default: 120
outputs:
status:
description: "Exit status"
value: ${{ steps.value.outputs.status }}
description: "DUT runner"
runs:
using: "composite"
steps:
- name: "Select repository"
if: ${{ inputs.STATUS == '' }}
shell: bash
run: |
ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "sed -i 's|http:\/\/[^ ]*|http:\/\/${{ inputs.REPOSITORY }}|' /etc/apt/sources.list.d/armbian.list" || true
ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "apt update; dpkg --configure -a; apt-get -o Dpkg::Options::='--force-confold' --force-yes -fuy dist-upgrade; apt-get -y install binutils iperf3 datamash p7zip-full; apt clean" || true
if [ "${{ inputs.REPOSITORY }}" == "beta.armbian.com" ]; then
echo "REPOSITORY=beta" >> $GITHUB_ENV
else
echo "REPOSITORY=stable" >> $GITHUB_ENV
fi
- name: "Handling exceptions"
if: ${{ inputs.STATUS == '' }}
shell: bash
run: |
if [ "${{ inputs.LINUXFAMILY }}" == "rk35xx" ] && [ "${{ inputs.BRANCH }}" != "vendor" ] ; then
echo "LINUXFAMILY=rockchip-rk3588" >> $GITHUB_ENV
else
echo "LINUXFAMILY=${{ inputs.LINUXFAMILY }}" >> $GITHUB_ENV
fi
- name: "Check if kernel package exists"
if: ${{ inputs.STATUS == '' }}
shell: bash
run: |
# check if kernel install is possible
if ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "apt search linux-image-${{ inputs.BRANCH }}-${{ env.LINUXFAMILY }}" 2>/dev/null | grep linux-image-${{ inputs.BRANCH }}-${{ env.LINUXFAMILY }}; then
# download new
ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "apt-get reinstall -y --download-only linux-image-${{ inputs.BRANCH }}-${{ env.LINUXFAMILY }}"
# purge previously installed ones
ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "apt-get -y purge '^linux-image-*'" || true
# install new
ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "apt-get reinstall -y linux-image-${{ inputs.BRANCH }}-${{ env.LINUXFAMILY }}"
echo "Install: linux-image-${{ inputs.BRANCH }}-${{ env.LINUXFAMILY }}" >> $GITHUB_STEP_SUMMARY
else
echo "STATUS=notfound" >> $GITHUB_ENV
echo "Kernel for ${{ inputs.BRANCH }}-${{ env.LINUXFAMILY }} does not exists" >> $GITHUB_STEP_SUMMARY
fi
# check if DTB install is possible
if ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "apt search linux-dtb-${{ inputs.BRANCH }}-${{ env.LINUXFAMILY }}" 2>/dev/null | grep linux-dtb-${{ inputs.BRANCH }}-${{ env.LINUXFAMILY }}; then
# download new
ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "apt-get reinstall -y --download-only linux-dtb-${{ inputs.BRANCH }}-${{ env.LINUXFAMILY }}"
# purge previously installed ones
ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "apt-get -y purge '^linux-dtb-*'" || true
# install new
ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "apt-get reinstall -y linux-dtb-${{ inputs.BRANCH }}-${{ env.LINUXFAMILY }}"
echo "Install: linux-dtb-${{ inputs.BRANCH }}-${{ env.LINUXFAMILY }}" >> $GITHUB_STEP_SUMMARY
else
# If DTB does not exists we don't set as some kernels don't have it
#
#echo "STATUS=notfound" >> $GITHUB_ENV
#
#
echo "DTB for ${{ inputs.BRANCH }}-${{ env.LINUXFAMILY }} does not exists" >> $GITHUB_STEP_SUMMARY
fi
# check if headers install is possible
if ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "apt search linux-headers-${{ inputs.BRANCH }}-${{ env.LINUXFAMILY }}" 2>/dev/null | grep linux-headers-${{ inputs.BRANCH }}-${{ env.LINUXFAMILY }}; then
# download new
ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "apt-get reinstall -y --download-only linux-headers-${{ inputs.BRANCH }}-${{ env.LINUXFAMILY }}"
# purge previously installed ones
ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "apt-get -y purge '^linux-headers-*'" || true
# install new
ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "apt-get reinstall -y linux-headers-${{ inputs.BRANCH }}-${{ env.LINUXFAMILY }}"
echo "Install: linux-headers-${{ inputs.BRANCH }}-${{ env.LINUXFAMILY }}" >> $GITHUB_STEP_SUMMARY
else
echo "STATUS=notfound" >> $GITHUB_ENV
echo "Headers for ${{ inputs.BRANCH }}-${{ env.LINUXFAMILY }} does not exists" >> $GITHUB_STEP_SUMMARY
fi
# list other files
#ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "apt search armbian-bsp-cli-${{ env.DUT_SLUG }}-legacy" || true
#ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "apt search armbian-bsp-desktop-${{ env.DUT_SLUG }}-legacy" || true
#ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "apt search armbian-zsh" || true
#ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "apt search armbian-firmware-full" || true
#ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "apt search armbian-plymouth-theme" || true
- name: Reboot
if: ${{ env.STATUS == '' }}
shell: bash
run: |
ssh -o StrictHostKeyChecking=no ${{ inputs.DUT_USER }}@${{ inputs.DUT_IP }} "shutdown --no-wall -r now" || true
sleep 30
secs=${{ inputs.TIMEOUT }}
while [ $secs -gt 0 ]; do
echo -ne "$secs\033[0K\r"
sleep 10
: $((secs--))
if timeout 3 nc -z "${{ inputs.DUT_IP }}" 22 -w 15 2>/dev/null; then break; fi
done
if [ $secs -eq 0 ]; then echo "STATUS=timeout" >> $GITHUB_ENV; fi
- name: Collect data
if: ${{ env.STATUS == '' }}
uses: armbian/actions/collect-data@main
with:
STATUS: "${{ env.STATUS }}"
DUT_IP: "${{ inputs.DUT_IP }}"
- name: Generate JSON
shell: bash
run: |
STARTED=$(date -u +"%Y-%m-%d %H:%M:%S")
cat <<- EOD >> data-"${{ inputs.DUT_IP }}"-"${{ inputs.DUT_SLUG }}".parts
{
"started" : "${STARTED}",
"status" : "${{ env.STATUS }}",
"dut_ip" : "${{ inputs.DUT_IP }}",
"board_name" : "${{ inputs.BOARD_NAME }}",
"board_slug" : "${{ inputs.DUT_SLUG }}",
"board_conf_type" : "${{ inputs.DUT_CONF_TYPE }}",
"u-boot" : "${{ env.UBOOT || 'n/a' }}",
"kernel" : "${{ env.KERNEL || 'n/a' }}",
"iperf" : "${{ env.IPERF || 'n/a' }}",
"sevenzip" : "${{ env.SEVENZIP || 'n/a' }}",
"armbian_monitor" : "${{ env.ARMBIAN_MONITOR || '<img src=https://img.shields.io/static/v1?label=&message=n/a&color=white>' }}",
"kernel_target" : "${{ inputs.BRANCH }}",
"repository" : "${{ env.REPOSITORY }}"
},
EOD
- name: Upload JSON
uses: actions/upload-artifact@v3
with:
name: JSON
path: data-*.*
- name: Set output
if: always()
id: value
shell: bash
run:
echo "status={{ env.STATUS }}" >> $GITHUB_OUTPUT