only clean/checkout/download artifacts on first attempt
This commit is contained in:
24
.github/workflows/build.yml
vendored
24
.github/workflows/build.yml
vendored
@@ -199,26 +199,20 @@ jobs:
|
|||||||
runs-on: [self-hosted, X64, hathach, hardware-in-the-loop]
|
runs-on: [self-hosted, X64, hathach, hardware-in-the-loop]
|
||||||
steps:
|
steps:
|
||||||
- name: Clean workspace
|
- name: Clean workspace
|
||||||
|
if: github.run_attempt == '1'
|
||||||
run: |
|
run: |
|
||||||
# Skip boards that passed with previous run
|
echo "Cleaning up for the first run"
|
||||||
if [ -f ${{ env.HIL_JSON }}.skip ]; then
|
|
||||||
SKIP_ARGS=$(cat "${HIL_JSON}.skip")
|
|
||||||
else
|
|
||||||
SKIP_ARGS=""
|
|
||||||
fi
|
|
||||||
echo "SKIP_ARGS=$SKIP_ARGS"
|
|
||||||
echo "SKIP_ARGS=$SKIP_ARGS" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
echo "Cleaning up previous run"
|
|
||||||
rm -rf "${{ github.workspace }}"
|
rm -rf "${{ github.workspace }}"
|
||||||
mkdir -p "${{ github.workspace }}"
|
mkdir -p "${{ github.workspace }}"
|
||||||
|
|
||||||
- name: Checkout TinyUSB
|
- name: Checkout TinyUSB
|
||||||
|
if: github.run_attempt == '1'
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
sparse-checkout: test/hil
|
sparse-checkout: test/hil
|
||||||
|
|
||||||
- name: Download Artifacts
|
- name: Download Artifacts
|
||||||
|
if: github.run_attempt == '1'
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: cmake-build
|
path: cmake-build
|
||||||
@@ -227,7 +221,15 @@ jobs:
|
|||||||
- name: Test on actual hardware
|
- name: Test on actual hardware
|
||||||
run: |
|
run: |
|
||||||
ls cmake-build/
|
ls cmake-build/
|
||||||
python3 test/hil/hil_test.py ${{ env.HIL_JSON }} $SKIP_ARGS
|
|
||||||
|
# Skip boards that passed with previous run, file is generated by hil_test.py
|
||||||
|
SKIP_BOARDS=""
|
||||||
|
if [ -f ${{ env.HIL_JSON }}.skip ]; then
|
||||||
|
SKIP_BOARDS=$(cat "${HIL_JSON}.skip")
|
||||||
|
fi
|
||||||
|
echo "SKIP_BOARDS=$SKIP_BOARDS"
|
||||||
|
|
||||||
|
python3 test/hil/hil_test.py ${{ env.HIL_JSON }} $SKIP_BOARDS
|
||||||
|
|
||||||
# ---------------------------------------
|
# ---------------------------------------
|
||||||
# Hardware in the loop (HIL)
|
# Hardware in the loop (HIL)
|
||||||
|
@@ -544,29 +544,30 @@ def test_example(board, f1, example):
|
|||||||
|
|
||||||
# flash firmware. It may fail randomly, retry a few times
|
# flash firmware. It may fail randomly, retry a few times
|
||||||
max_rety = 3
|
max_rety = 3
|
||||||
|
start_s = time.time()
|
||||||
for i in range(max_rety):
|
for i in range(max_rety):
|
||||||
ret = globals()[f'flash_{board["flasher"]["name"].lower()}'](board, fw_name)
|
ret = globals()[f'flash_{board["flasher"]["name"].lower()}'](board, fw_name)
|
||||||
if ret.returncode == 0:
|
if ret.returncode == 0:
|
||||||
try:
|
try:
|
||||||
globals()[f'test_{example.replace("/", "_")}'](board)
|
globals()[f'test_{example.replace("/", "_")}'](board)
|
||||||
print('OK')
|
print(' OK', end='')
|
||||||
break
|
break
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if i == max_rety - 1:
|
if i == max_rety - 1:
|
||||||
err_count += 1
|
err_count += 1
|
||||||
print(STATUS_FAILED)
|
print(f'{STATUS_FAILED}: {e}')
|
||||||
print(f' {e}')
|
|
||||||
else:
|
else:
|
||||||
print()
|
print(f'\n Test failed: {e}, retry {i+2}/{max_rety}', end='')
|
||||||
print(f' Test failed: {e}, retry {i+2}/{max_rety}')
|
time.sleep(0.5)
|
||||||
time.sleep(1)
|
|
||||||
else:
|
else:
|
||||||
print(f'Flashing failed, retry {i+2}/{max_rety}')
|
print(f'\n Flash failed, retry {i+2}/{max_rety}', end='')
|
||||||
time.sleep(1)
|
time.sleep(0.5)
|
||||||
|
|
||||||
if ret.returncode != 0:
|
if ret.returncode != 0:
|
||||||
err_count += 1
|
err_count += 1
|
||||||
print(f'Flash {STATUS_FAILED}')
|
print(f' Flash {STATUS_FAILED}', end='')
|
||||||
|
|
||||||
|
print(f' in {time.time() - start_s:.1f}s')
|
||||||
|
|
||||||
return err_count
|
return err_count
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user