Skip to content

Commit 6e19477

Browse files
author
doomwastaken
committed
added retries to QA workflows for science, I know what DRY means, didnt want to make extra yaml files and flood workflows
1 parent 5786066 commit 6e19477

File tree

2 files changed

+233
-13
lines changed

2 files changed

+233
-13
lines changed

.github/workflows/unit_tests.yml

Lines changed: 140 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,160 @@ env:
99
FBT_GIT_SUBMODULE_SHALLOW: 1
1010

1111
jobs:
12-
run_units_on_bench:
12+
unit_attempt_1:
1313
runs-on: [ self-hosted, FlipperZeroTest ]
14+
outputs:
15+
timed_out: ${{ steps.check_timeout.outputs.timed_out }}
1416
steps:
1517
- name: Checkout code
1618
uses: actions/checkout@v4
1719
with:
1820
fetch-depth: 1
1921
ref: ${{ github.event.pull_request.head.sha }}
2022

21-
- name: 'Flash unit tests firmware'
23+
- name: Flash unit tests firmware
2224
id: flashing
23-
if: success()
2425
timeout-minutes: 5
26+
continue-on-error: true
2527
run: |
2628
source scripts/toolchain/fbtenv.sh
2729
./fbt resources firmware_latest flash LIB_DEBUG=1 FIRMWARE_APP_SET=unit_tests FORCE=1
2830
31+
- name: Copy assets and unit data, reboot and wait for flipper
32+
id: copy
33+
if: steps.flashing.outcome == 'success'
34+
timeout-minutes: 5
35+
continue-on-error: true
36+
run: |
37+
source scripts/toolchain/fbtenv.sh
38+
python3 scripts/testops.py -t=15 await_flipper
39+
python3 scripts/storage.py -f send build/latest/resources /ext
40+
python3 scripts/storage.py -f send /region_data /ext/.int/.region_data
41+
python3 scripts/power.py reboot
42+
python3 scripts/testops.py -t=30 await_flipper
43+
44+
- name: Run units and validate results
45+
id: run_units
46+
if: steps.copy.outcome == 'success'
47+
timeout-minutes: 5
48+
continue-on-error: true
49+
run: |
50+
source scripts/toolchain/fbtenv.sh
51+
python3 scripts/testops.py run_units
52+
53+
- name: Upload test results
54+
if: failure() && steps.flashing.outcome == 'success' && steps.run_units.outcome != 'skipped'
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: unit-tests_output
58+
path: unit_tests*.txt
59+
60+
- name: Check GDB output
61+
if: failure() && steps.flashing.outcome == 'success'
62+
run: |
63+
./fbt gdb_trace_all LIB_DEBUG=1 FIRMWARE_APP_SET=unit_tests FORCE=1
64+
65+
- name: Check for timeout
66+
id: check_timeout
67+
run: |
68+
if [ "${{ steps.flashing.conclusion }}" == "timed_out" ] || \
69+
[ "${{ steps.copy.conclusion }}" == "timed_out" ] || \
70+
[ "${{ steps.run_units.conclusion }}" == "timed_out" ]; then
71+
echo "timed_out=true" >> $GITHUB_OUTPUT
72+
else
73+
echo "timed_out=false" >> $GITHUB_OUTPUT
74+
fi
75+
76+
unit_attempt_2:
77+
needs: unit_attempt_1
78+
if: needs.unit_attempt_1.outputs.timed_out == 'true'
79+
runs-on: [ self-hosted, FlipperZeroTest ]
80+
outputs:
81+
timed_out: ${{ steps.check_timeout.outputs.timed_out }}
82+
steps:
83+
- name: Checkout code
84+
uses: actions/checkout@v4
85+
with:
86+
fetch-depth: 1
87+
ref: ${{ github.event.pull_request.head.sha }}
88+
89+
- name: Flash unit tests firmware
90+
id: flashing
91+
timeout-minutes: 5
92+
continue-on-error: true
93+
run: |
94+
source scripts/toolchain/fbtenv.sh
95+
./fbt resources firmware_latest flash LIB_DEBUG=1 FIRMWARE_APP_SET=unit_tests FORCE=1
96+
97+
- name: Copy assets and unit data, reboot and wait for flipper
98+
id: copy
99+
if: steps.flashing.outcome == 'success'
100+
timeout-minutes: 5
101+
continue-on-error: true
102+
run: |
103+
source scripts/toolchain/fbtenv.sh
104+
python3 scripts/testops.py -t=15 await_flipper
105+
python3 scripts/storage.py -f send build/latest/resources /ext
106+
python3 scripts/storage.py -f send /region_data /ext/.int/.region_data
107+
python3 scripts/power.py reboot
108+
python3 scripts/testops.py -t=30 await_flipper
109+
110+
- name: Run units and validate results
111+
id: run_units
112+
if: steps.copy.outcome == 'success'
113+
timeout-minutes: 5
114+
continue-on-error: true
115+
run: |
116+
source scripts/toolchain/fbtenv.sh
117+
python3 scripts/testops.py run_units
118+
119+
- name: Upload test results
120+
if: failure() && steps.flashing.outcome == 'success' && steps.run_units.outcome != 'skipped'
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: unit-tests_output
124+
path: unit_tests*.txt
125+
126+
- name: Check GDB output
127+
if: failure() && steps.flashing.outcome == 'success'
128+
run: |
129+
./fbt gdb_trace_all LIB_DEBUG=1 FIRMWARE_APP_SET=unit_tests FORCE=1
130+
131+
- name: Check for timeout
132+
id: check_timeout
133+
run: |
134+
if [ "${{ steps.flashing.conclusion }}" == "timed_out" ] || \
135+
[ "${{ steps.copy.conclusion }}" == "timed_out" ] || \
136+
[ "${{ steps.run_units.conclusion }}" == "timed_out" ]; then
137+
echo "timed_out=true" >> $GITHUB_OUTPUT
138+
else
139+
echo "timed_out=false" >> $GITHUB_OUTPUT
140+
fi
141+
142+
unit_attempt_3:
143+
needs: unit_attempt_2
144+
if: needs.unit_attempt_2.outputs.timed_out == 'true'
145+
runs-on: [ self-hosted, FlipperZeroTest ]
146+
steps:
147+
- name: Checkout code
148+
uses: actions/checkout@v4
149+
with:
150+
fetch-depth: 1
151+
ref: ${{ github.event.pull_request.head.sha }}
152+
153+
- name: Flash unit tests firmware
154+
id: flashing
155+
timeout-minutes: 5
156+
continue-on-error: true
157+
run: |
158+
source scripts/toolchain/fbtenv.sh
159+
./fbt resources firmware_latest flash LIB_DEBUG=1 FIRMWARE_APP_SET=unit_tests FORCE=1
29160
30-
- name: 'Copy assets and unit data, reboot and wait for flipper'
161+
- name: Copy assets and unit data, reboot and wait for flipper
31162
id: copy
32163
if: steps.flashing.outcome == 'success'
33164
timeout-minutes: 5
165+
continue-on-error: true
34166
run: |
35167
source scripts/toolchain/fbtenv.sh
36168
python3 scripts/testops.py -t=15 await_flipper
@@ -39,22 +171,23 @@ jobs:
39171
python3 scripts/power.py reboot
40172
python3 scripts/testops.py -t=30 await_flipper
41173
42-
- name: 'Run units and validate results'
174+
- name: Run units and validate results
43175
id: run_units
44176
if: steps.copy.outcome == 'success'
45177
timeout-minutes: 5
178+
continue-on-error: true
46179
run: |
47180
source scripts/toolchain/fbtenv.sh
48181
python3 scripts/testops.py run_units
49182
50-
- name: 'Upload test results'
183+
- name: Upload test results
51184
if: failure() && steps.flashing.outcome == 'success' && steps.run_units.outcome != 'skipped'
52185
uses: actions/upload-artifact@v4
53186
with:
54187
name: unit-tests_output
55188
path: unit_tests*.txt
56189

57-
- name: 'Check GDB output'
190+
- name: Check GDB output
58191
if: failure() && steps.flashing.outcome == 'success'
59192
run: |
60193
./fbt gdb_trace_all LIB_DEBUG=1 FIRMWARE_APP_SET=unit_tests FORCE=1

.github/workflows/updater_test.yml

Lines changed: 93 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,118 @@ env:
99
FBT_GIT_SUBMODULE_SHALLOW: 1
1010

1111
jobs:
12-
test_updater_on_bench:
13-
runs-on: [self-hosted, FlipperZeroTest ]
12+
attempt1:
13+
runs-on: [self-hosted, FlipperZeroTest]
14+
outputs:
15+
timed_out: ${{ steps.check_timeout.outputs.timed_out }}
1416
steps:
1517
- name: Checkout code
1618
uses: actions/checkout@v4
1719
with:
1820
fetch-depth: 1
1921
ref: ${{ github.event.pull_request.head.sha }}
2022

21-
- name: 'Flashing target firmware'
23+
- name: Flashing target firmware
2224
id: first_full_flash
2325
timeout-minutes: 5
26+
continue-on-error: true
2427
run: |
2528
source scripts/toolchain/fbtenv.sh
2629
python3 scripts/testops.py -t=180 await_flipper
2730
./fbt flash_usb_full FORCE=1
28-
2931
30-
- name: 'Validating updater'
32+
- name: Validating updater
3133
id: second_full_flash
34+
if: steps.first_full_flash.outcome == 'success'
3235
timeout-minutes: 5
33-
if: success()
36+
continue-on-error: true
3437
run: |
3538
source scripts/toolchain/fbtenv.sh
3639
python3 scripts/testops.py -t=180 await_flipper
3740
./fbt flash_usb FORCE=1
3841
python3 scripts/testops.py -t=180 await_flipper
3942
43+
- name: Check for timeout
44+
id: check_timeout
45+
run: |
46+
if grep -q "Timeout" "${{ github.workspace }}/logs.txt" 2>/dev/null; then
47+
echo "timed_out=true" >> $GITHUB_OUTPUT
48+
elif [ "${{ steps.first_full_flash.outcome }}" == "failure" ] && [ "${{ steps.first_full_flash.conclusion }}" == "timed_out" ]; then
49+
echo "timed_out=true" >> $GITHUB_OUTPUT
50+
elif [ "${{ steps.second_full_flash.outcome }}" == "failure" ] && [ "${{ steps.second_full_flash.conclusion }}" == "timed_out" ]; then
51+
echo "timed_out=true" >> $GITHUB_OUTPUT
52+
else
53+
echo "timed_out=false" >> $GITHUB_OUTPUT
54+
fi
55+
56+
attempt2:
57+
needs: attempt1
58+
if: needs.attempt1.outputs.timed_out == 'true'
59+
runs-on: [self-hosted, FlipperZeroTest]
60+
outputs:
61+
timed_out: ${{ steps.check_timeout.outputs.timed_out }}
62+
steps:
63+
- name: Checkout code
64+
uses: actions/checkout@v4
65+
with:
66+
fetch-depth: 1
67+
ref: ${{ github.event.pull_request.head.sha }}
68+
69+
- name: Flashing target firmware
70+
id: first_full_flash
71+
timeout-minutes: 5
72+
continue-on-error: true
73+
run: |
74+
source scripts/toolchain/fbtenv.sh
75+
python3 scripts/testops.py -t=180 await_flipper
76+
./fbt flash_usb_full FORCE=1
77+
78+
- name: Validating updater
79+
id: second_full_flash
80+
if: steps.first_full_flash.outcome == 'success'
81+
timeout-minutes: 5
82+
continue-on-error: true
83+
run: |
84+
source scripts/toolchain/fbtenv.sh
85+
python3 scripts/testops.py -t=180 await_flipper
86+
./fbt flash_usb FORCE=1
87+
python3 scripts/testops.py -t=180 await_flipper
88+
89+
- name: Check for timeout
90+
id: check_timeout
91+
run: |
92+
if grep -q "Timeout" "${{ github.workspace }}/logs.txt" 2>/dev/null; then
93+
echo "timed_out=true" >> $GITHUB_OUTPUT
94+
elif [ "${{ steps.first_full_flash.outcome }}" == "failure" ] && [ "${{ steps.first_full_flash.conclusion }}" == "timed_out" ]; then
95+
echo "timed_out=true" >> $GITHUB_OUTPUT
96+
elif [ "${{ steps.second_full_flash.outcome }}" == "failure" ] && [ "${{ steps.second_full_flash.conclusion }}" == "timed_out" ]; then
97+
echo "timed_out=true" >> $GITHUB_OUTPUT
98+
else
99+
echo "timed_out=false" >> $GITHUB_OUTPUT
100+
fi
101+
102+
attempt3:
103+
needs: attempt2
104+
if: needs.attempt2.outputs.timed_out == 'true'
105+
runs-on: [self-hosted, FlipperZeroTest]
106+
steps:
107+
- name: Checkout code
108+
uses: actions/checkout@v4
109+
with:
110+
fetch-depth: 1
111+
ref: ${{ github.event.pull_request.head.sha }}
112+
113+
- name: Flashing target firmware
114+
timeout-minutes: 5
115+
run: |
116+
source scripts/toolchain/fbtenv.sh
117+
python3 scripts/testops.py -t=180 await_flipper
118+
./fbt flash_usb_full FORCE=1
119+
120+
- name: Validating updater
121+
timeout-minutes: 5
122+
run: |
123+
source scripts/toolchain/fbtenv.sh
124+
python3 scripts/testops.py -t=180 await_flipper
125+
./fbt flash_usb FORCE=1
126+
python3 scripts/testops.py -t=180 await_flipper

0 commit comments

Comments
 (0)