From ef127dd86edec5eacaffee40673c46a1bdc1f4c9 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 15 Sep 2023 23:30:26 -0500 Subject: [PATCH] TODO Add parseConfigs.py to workflow --- .github/workflows/run-tests.yml | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 02df2e7..7a9d772 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -47,6 +47,19 @@ jobs: - name: Check if mbed-os Libraries Need to be Fetched id: check-mbed-os-libs run: | + echo ${{ github.event.before }} ${{ github.event.after }} + git reflog + # Get the commit hashes of the two most recent states of the repo on the runner + # If mbed-os.lib changed between the two states, fetch the mbed libraries in the next step + git reflog | head -n 1 + echo "SEPARATOR" + git reflog | head -n 1 | grep -Po "( moving from )\K.*( to )\K.*" + echo "SEPARATOR" + hashes=$(git reflog | head -n 1 | grep -Po "( moving from )\K.*( to )\K.*") + echo "$hashes" + git diff --name-only $hashes + echo "SEPARATOR" + git diff $hashes if [[ -f "$MBED_OS_REF_LOCATION/mbed-os.lib" ]]; then if [[ -n $(diff "$MBED_OS_REF_LOCATION/mbed-os.lib" mbed-os.lib) ]]; then cp mbed-os.lib "$MBED_OS_REF_LOCATION" @@ -75,16 +88,18 @@ jobs: mbed-tools deploy # Gets device info using `mbed-tools detect` and sets output needed for compiling and flashing -# NOTE: Expecting '/mnt/$USER/' to be the base path for the mount point, as specified in the runner's ldm (https://github.com/LemonBoy/ldm) configuration, despite /media/[$USER/] typically being the base path for removable media +# NOTE: Expecting '/mnt/$USER/' to be the base path for the mount point, as specified in the runner's ldm (https://github.com/LemonBoy/ldm) configuration, +# despite /media/[$USER/] typically being the base path for removable media - name: Get Device Info id: get-dev-info run: | - detect_out=$(mbed-tools detect) - device=$(echo "$detect_out" | grep -oE "NUCLEO_\\S*") + device=$(python3 parseConfigs.py) + detect_out=$(mbed-tools detect | grep "$device") + #device=$(echo "$detect_out" | grep -oE "NUCLEO_\\S*") serial=$(echo "$detect_out" | grep -oE "/dev/tty\\S*") mountpoint=$(echo "$detect_out" | grep -oE "/mnt/$USER/\\S*") - if [[ -z "$device" || -z "$serial" || -z "$mountpoint" ]]; then - echo "Failed to detect target, serial port, and/or mount point matching 'NUCLEO_*', '/dev/tty*', and '/mnt/$USER/*', respectively :hurtrealbad:" >> $GITHUB_STEP_SUMMARY + if [[ -z "$serial" || -z "$mountpoint" ]]; then + echo "Failed to detect serial port and/or mount point matching '/dev/tty*' and '/mnt/$USER/*', respectively, for target '$device' :hurtrealbad:" >> $GITHUB_STEP_SUMMARY exit 1 fi echo "device=$device" >> "$GITHUB_OUTPUT" @@ -102,6 +117,7 @@ jobs: steps: - name: Compile and Flash + if: false # TODO Remove run: | mbed-tools configure -t ${{ env.TOOLCHAIN }} -m ${{ needs.setup.outputs.target }} cmake -S . -B cmake_build/${{ needs.setup.outputs.target }}/${{ env.BUILD_PROFILE }}/${{ env.TOOLCHAIN }} -GNinja