2022-10-28 13:59:09 +00:00
|
|
|
name: 'Unit tests'
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
env:
|
|
|
|
TARGETS: f7
|
|
|
|
DEFAULT_TARGET: f7
|
|
|
|
|
|
|
|
jobs:
|
2022-11-02 15:21:43 +00:00
|
|
|
run_units_on_test_bench:
|
2022-10-28 13:59:09 +00:00
|
|
|
runs-on: [self-hosted, FlipperZeroTest]
|
|
|
|
steps:
|
2022-12-10 20:34:12 +00:00
|
|
|
- name: 'Decontaminate previous build leftovers'
|
|
|
|
run: |
|
|
|
|
if [ -d .git ]; then
|
|
|
|
git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
|
|
|
|
fi
|
|
|
|
|
2022-10-28 13:59:09 +00:00
|
|
|
- name: Checkout code
|
2022-12-10 13:10:51 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-10-28 13:59:09 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
|
|
|
|
- name: 'Get flipper from device manager (mock)'
|
|
|
|
id: device
|
|
|
|
run: |
|
|
|
|
echo "flipper=/dev/ttyACM0" >> $GITHUB_OUTPUT
|
|
|
|
|
2022-11-02 15:21:43 +00:00
|
|
|
- name: 'Flash unit tests firmware'
|
|
|
|
id: flashing
|
2022-10-28 13:59:09 +00:00
|
|
|
run: |
|
|
|
|
FBT_TOOLCHAIN_PATH=/opt ./fbt flash OPENOCD_ADAPTER_SERIAL=2A0906016415303030303032 FIRMWARE_APP_SET=unit_tests FORCE=1
|
|
|
|
|
|
|
|
- name: 'Wait for flipper to finish updating'
|
|
|
|
id: connect
|
2022-11-02 15:21:43 +00:00
|
|
|
if: steps.flashing.outcome == 'success'
|
2022-10-28 13:59:09 +00:00
|
|
|
run: |
|
2022-11-02 15:15:40 +00:00
|
|
|
. scripts/toolchain/fbtenv.sh
|
|
|
|
./scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}
|
2022-10-28 13:59:09 +00:00
|
|
|
|
|
|
|
- name: 'Format flipper SD card'
|
|
|
|
id: format
|
|
|
|
if: steps.connect.outcome == 'success'
|
|
|
|
run: |
|
2022-11-02 15:15:40 +00:00
|
|
|
. scripts/toolchain/fbtenv.sh
|
2022-10-28 13:59:09 +00:00
|
|
|
./scripts/storage.py -p ${{steps.device.outputs.flipper}} format_ext
|
|
|
|
|
2022-10-28 15:45:22 +00:00
|
|
|
- name: 'Copy assets and unit tests data to flipper'
|
2022-10-28 13:59:09 +00:00
|
|
|
id: copy
|
|
|
|
if: steps.format.outcome == 'success'
|
|
|
|
run: |
|
2022-11-02 15:15:40 +00:00
|
|
|
. scripts/toolchain/fbtenv.sh
|
2022-10-28 15:45:22 +00:00
|
|
|
./scripts/storage.py -p ${{steps.device.outputs.flipper}} send assets/resources /ext
|
2022-10-28 13:59:09 +00:00
|
|
|
./scripts/storage.py -p ${{steps.device.outputs.flipper}} send assets/unit_tests /ext/unit_tests
|
|
|
|
|
|
|
|
- name: 'Run units and validate results'
|
|
|
|
if: steps.copy.outcome == 'success'
|
|
|
|
run: |
|
2022-11-02 15:15:40 +00:00
|
|
|
. scripts/toolchain/fbtenv.sh
|
|
|
|
./scripts/testing/units.py ${{steps.device.outputs.flipper}}
|