Skip to content

Commit 68b3d57

Browse files
authored
Improve test-apps (#1326)
1 parent e89f4df commit 68b3d57

File tree

1 file changed

+54
-33
lines changed

1 file changed

+54
-33
lines changed

.github/workflows/test-apps.yml

Lines changed: 54 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ env:
66
on:
77
push:
88
branches: main
9-
paths: 'programs/x86_64/**'
9+
paths:
10+
- 'programs/x86_64/**'
11+
- .github/workflows/test-apps.yml
1012

1113
#pull_request:
1214
# branches: main
@@ -50,7 +52,7 @@ jobs:
5052
fi
5153
git fetch origin main
5254
if [[ $(git rev-list HEAD...origin/main --count) -gt 0 ]]; then
53-
echo "Changes detected between 'main' and 'testing'. Rebasing..."
55+
echo "Changes detected between 'main' and 'testing'. Merging..."
5456
git merge origin/main --no-edit
5557
git push origin testing
5658
fi
@@ -64,18 +66,34 @@ jobs:
6466
needs: update-testing-branch
6567

6668
steps:
67-
- name: "Check out repository 🏃"
69+
- name: "Check out main branch (for programs count) 🏃"
6870
uses: actions/checkout@v4
6971
with:
70-
ref: testing # Work on testing branch
72+
ref: main # Work on main branch
7173

72-
- name: "Show stats 📝"
74+
- name: "Count programs 📊"
7375
run: |
7476
x64Count=$(find programs/x86_64/ -type f | wc -l)
7577
i68Count=$(find programs/i686/ -type f | wc -l)
7678
a64Count=$(find programs/aarch64/ -type f | wc -l)
79+
echo "x64Count=$x64Count" >> $GITHUB_ENV
80+
echo "i68Count=$i68Count" >> $GITHUB_ENV
81+
echo "a64Count=$a64Count" >> $GITHUB_ENV
82+
83+
- name: "Check out testing branch (for tested & failed) 🏃"
84+
uses: actions/checkout@v4
85+
with:
86+
ref: testing # Work on testing branch
87+
88+
- name: "Count tested & failed 📊"
89+
run: |
7790
tested=$(wc -l < tested.list 2>/dev/null || echo 0)
7891
failed=$(wc -l < failed.list 2>/dev/null || echo 0)
92+
echo "x86_64: $x64Count"
93+
echo "i686: $i68Count"
94+
echo "aarch64: $a64Count"
95+
echo "🏁 Tested: $tested"
96+
echo "❌ Failed: $failed"
7997
echo "### 🎬 apps" >> $GITHUB_STEP_SUMMARY
8098
echo "$x64Count x86_64" >> $GITHUB_STEP_SUMMARY
8199
echo "$i68Count i686" >> $GITHUB_STEP_SUMMARY
@@ -105,18 +123,22 @@ jobs:
105123
find programs/x86_64/ -maxdepth 1 -type f -printf "%f\n" | sort > all.list
106124
if [[ -f tested.list ]]; then
107125
if diff -q all.list tested.list; then
126+
echo "Everything tested" >> $GITHUB_STEP_SUMMARY
108127
echo "skip=true" >> $GITHUB_OUTPUT
109128
exit 0
110129
else
111130
comm -23 all.list tested.list > totest_tmp.list
112131
fi
113132
else
133+
echo "First run!" >> $GITHUB_STEP_SUMMARY
114134
cp all.list totest_tmp.list
115135
fi
116136
if [[ -f failed.list ]]; then
117137
comm -23 totest_tmp.list failed.list > totest.list
118-
echo "Excluding failed!"
138+
echo "Excluding failed:" >> $GITHUB_STEP_SUMMARY
139+
cat failed.list >> $GITHUB_STEP_SUMMARY
119140
if [ ! -s totest.list ]; then
141+
echo " 🏁 Nothing to test 🏁" >> $GITHUB_STEP_SUMMARY
120142
echo "skip=true" >> $GITHUB_OUTPUT
121143
exit 0
122144
fi
@@ -140,7 +162,7 @@ jobs:
140162
fail-fast: false
141163
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
142164
env:
143-
TIMEOUT: 10
165+
TIMEOUT: 23
144166
steps:
145167
- name: "Check out repository 🏃"
146168
uses: actions/checkout@v4
@@ -164,9 +186,6 @@ jobs:
164186
mkdir -p results
165187
script_content=$(curl -Ls https://raw.githubusercontent.com/ivan-hc/AM/main/programs/x86_64/"${{ matrix.file }}")
166188
pure_arg=$(echo "${{ matrix.file }}" | sed 's/\.appimage//g; s/\^debian-testing-//g; s/\-appimage$//g' | sed 's:.*/::')
167-
to_failed() {
168-
echo "${{ matrix.file }}" > results/ko-${{ matrix.file }}
169-
}
170189
if timeout "$TIMEOUT"m am -i "${{ matrix.file }}" --debug 2>&1 | tee -a results/log-"${{ matrix.file }}"; then
171190
echo ""
172191
echo " Structure of the directory in /opt"
@@ -183,12 +202,10 @@ jobs:
183202
echo /opt/avidemux | tee -a results/log-"${{ matrix.file }}"
184203
elif [[ "$pure_arg" =~ (bat-extras|code|deadbeef*|libfuse2|libreoffice|microsoft-edge*|mpv|node|npm|swift|wine) ]]; then
185204
echo "App not installed, this is a Known error related to GitHub Actions" | tee -a results/log-"${{ matrix.file }}"
186-
OK="1"
187205
elif test -d /opt/"$pure_arg"*; then
188206
ls /opt/"$pure_arg"* | tee -a results/log-"${{ matrix.file }}"
189207
elif echo "$script_content" | grep -q "spooky"; then
190208
echo "App not installed because marked as \"spooky\", require to be tested manually" | tee -a results/log-"${{ matrix.file }}"
191-
OK="1"
192209
else
193210
ls /opt/"${{ matrix.file }}" | tee -a results/log-"${{ matrix.file }}"
194211
fi
@@ -210,34 +227,32 @@ jobs:
210227
fi
211228
echo ""
212229
echo "-------------------------------------------------------------"
213-
am -R "${{ matrix.file }}" && echo "${{ matrix.file }}" > results/ok-${{ matrix.file }} || [ "OK" =1 ] && echo "${{ matrix.file }}" > results/ok-${{ matrix.file }} || to_failed
230+
am -R "${{ matrix.file }}" && echo "${{ matrix.file }}" >> results/ok-${{ matrix.file }} || echo "${{ matrix.file }}" >> results/log-${{ matrix.file }}
214231
else
215232
if [[ $? -eq 124 ]]; then
216233
echo "### 💥 ${{ matrix.file }} timeout!" >> $GITHUB_STEP_SUMMARY
217-
echo "Installation timeout in 10 minutes" >> results/log-"${{ matrix.file }}"
218-
to_failed
234+
echo "Installation timeout in 23 minutes" >> results/log-"${{ matrix.file }}"
235+
echo "${{ matrix.file }}" >> results/log-${{ matrix.file }}
219236
else
220237
echo "### 💀 ${{ matrix.file }}" >> $GITHUB_STEP_SUMMARY
221-
to_failed
238+
echo "${{ matrix.file }}" >> results/log-${{ matrix.file }}
222239
fi
223240
exit 1
224241
fi
225242
226-
- name: "Upload Failed Results ☝️"
243+
- name: "Rename Failed Results ☝️"
227244
if: failure()
228-
uses: actions/upload-artifact@v4
229-
with:
230-
name: ko-${{ matrix.file }}
231-
path: results/ko-${{ matrix.file }}
245+
run: |
246+
mv results/log-${{ matrix.file }} results/ko-${{ matrix.file }}
232247
233-
- name: "Upload Log Results ☝️"
248+
- name: "Upload KO Results ☝️"
234249
if: failure()
235250
uses: actions/upload-artifact@v4
236251
with:
237-
name: log-${{ matrix.file }}
238-
path: results/log-${{ matrix.file }}
252+
name: ko-${{ matrix.file }}
253+
path: results/ko-${{ matrix.file }}
239254

240-
- name: "Upload Test Results ⬆️"
255+
- name: "Upload OK Results ⬆️"
241256
if: success()
242257
uses: actions/upload-artifact@v4
243258
with:
@@ -248,28 +263,31 @@ jobs:
248263
name: "results 📰"
249264
needs: run-actions
250265
runs-on: ubuntu-22.04
251-
if: ${{ needs.generate-matrix.outputs.skip != 'true' }}
266+
if: always()
252267
steps:
253268
- name: "Check out repository 🏃"
254269
uses: actions/checkout@v4
255270
with:
256271
ref: testing
257272

258273
- name: "Download Test Results ⬇️"
274+
if: success()
259275
uses: actions/download-artifact@v4
260276
with:
261277
path: results
262278
merge-multiple: true
263-
- run: ls -R results
279+
- run: ls -R results || echo "Nothing tested"
264280

265281
- name: "Git Config"
282+
if: always()
266283
run: |
267284
git config user.name "github-actions[bot]"
268285
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
269286
270287
- name: "Aggregate and push results"
288+
if: always()
271289
run: |
272-
ls -R results
290+
ls -R results || echo "Nothing tested"
273291
#git checkout -b testing
274292
#git push --set-upstream origin testing
275293
if compgen -G "results/ok-*" > /dev/null; then
@@ -284,17 +302,16 @@ jobs:
284302
fi
285303
if compgen -G "results/ko-*" > /dev/null; then
286304
for file in results/ko-*; do
287-
cat "$file" >> fail.list
305+
echo "$file" | cut -d'-' -f2- >> fail.list
288306
done
289307
mkdir -p logs
290-
cp results/log-* logs/
308+
cp results/ko-* logs/
291309
fail=$(wc -l < fail.list)
292310
cat fail.list >> failed.list
293311
sort -u failed.list -o failed.list
294312
git add failed.list logs
295313
else
296314
echo "Nothing failed? Great!"
297-
fail="0"
298315
fi
299316
if git diff --cached --quiet; then
300317
echo "No changes to commit?"
@@ -319,12 +336,16 @@ jobs:
319336
echo "## 🛅 $remaining to test" >> $GITHUB_STEP_SUMMARY
320337
echo "😱 $failed fails listed" >> $GITHUB_STEP_SUMMARY
321338
echo ":x: $fail failed now" >> $GITHUB_STEP_SUMMARY
339+
if [[ -f fail.list ]]; then
340+
echo "💀" >> $GITHUB_STEP_SUMMARY
341+
cat fail.list >> $GITHUB_STEP_SUMMARY
342+
fi
322343
323344
delete-all-artifacts:
324345
name: "cleanup 🧹"
325346
runs-on: ubuntu-22.04
326347
needs: update-tested-list
327-
if: ${{ needs.generate-matrix.outputs.skip != 'true' }}
348+
if: always()
328349
steps:
329350
- name: "Check out repository 🏃"
330351
uses: actions/checkout@v4
@@ -357,7 +378,7 @@ jobs:
357378
echo "Successfully deleted $DELETED artifacts."
358379
359380
already-tested:
360-
name: "tested"
381+
name: "all tested"
361382
runs-on: ubuntu-22.04
362383
needs: generate-matrix
363384
if: ${{ needs.generate-matrix.outputs.skip == 'true' }}

0 commit comments

Comments
 (0)