Skip to content

fix(Boards, Examples): Fix MAX32690 GPIO Example #3210

fix(Boards, Examples): Fix MAX32690 GPIO Example

fix(Boards, Examples): Fix MAX32690 GPIO Example #3210

name: BLE Examples Test
# Cancels workflows in progress that are in the same PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
#push:
# branches: [ "main" ]
pull_request:
branches: ["main"]
types: [opened, reopened, synchronize, ready_for_review] # When to run the workflow on PR
paths-ignore:
# Any files in a docs directory anywhere in the repository.
- "**/docs/**"
- "**/Documentation/**"
# Any README.md file anywhere in the repository.
- "**/README.md"
# Any .pdf file anywhere in the repository.
- "**/*.pdf"
# Any .yml file anywhere in the repository.
# can comment this out when testing changes to THIS yml file
- "**/*.yml"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
LOCK_MAX32655_B2: false
LOCK_MAX32655_B1: false
LOCK_MAX32665_B1: false
#----------------------------------------------------------------------------------------------
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
BLE_Tests:
# The type of runner that the job will run on
runs-on: [self-hosted, btm-ci]
if: github.event.pull_request.draft == false
#----------------------------------------------------------------------------------------------
# De inits submodules and cleans repo
steps:
# Clean and remove any local modifications
- name: Clean
continue-on-error: true
run: |
# Remove local modifications
set +e
# Attempt to clean the repo
git scorch
git clean -ffdx
git reset --hard
retval=$?
# Remove everything if this fails
if [[ $retval -ne 0 ]]
then
rm -rf *
fi
set -e
# give launcher script permission to execute
cd .github/workflows/scripts
chmod +x test_launcher.sh
chmod +x mass_erase_board.sh
#----------------------------------------------------------------------------------------------
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
submodules: false
fetch-depth: 0
#----------------------------------------------------------------------------------------------
#------------------------------| MAX32655 |----------------------------------------------------
#----------------------------------------------------------------------------------------------
- name: Check MAX32655
id: MAX32655
env:
MAX32655_BLE_FILES_CHANGED: false
MAX32655_EXAMPLES_TO_TEST: ()
MAX32655_RUN_ALL_TEST: false
MAX32655_DATS_CONNECTED_TEST: false
MAX32655_OTAS_CONNECTED_TEST: false
run: |
# BLE examples to watch
declare -a watched_examples=(
# underscore in filter to ignore the BLE5_ctr examples
Examples/MAX32655/BLE_*
Examples/MAX32655/Bootloader
)
# Other directories to watch
declare -a watched_other=(
#To test changes this workflow push a commit with this uncommented
#.github/workflows/
.github/workflows/ci-tests/Examples_tests
Libraries/libs.mk
# Bluetooth
Libraries/BlePhy/MAX32655
Libraries/Cordio
# Board specific
Libraries/Boards/MAX32655
# Libraries
Libraries/CMSIS/Device/Maxim/MAX32655
Libraries/PeriphDrivers/libPeriphDriver.mk
Libraries/PeriphDrivers/periphdriver.mk
Libraries/PeriphDrivers/max32655_files.mk
# AES
Libraries/PeriphDrivers/Source/AES/aes_me17.c
Libraries/PeriphDrivers/Source/AES/aes_revb_regs.h
Libraries/PeriphDrivers/Source/AES/aes_revb.c
Libraries/PeriphDrivers/Source/AES/aes_revb.h
Libraries/PeriphDrivers/Source/AES/aeskeys_revb_regs.h
# Flash controller
Libraries/PeriphDrivers/Source/FLC/flc_common.c
Libraries/PeriphDrivers/Source/FLC/flc_common.h
Libraries/PeriphDrivers/Source/FLC/flc_me17.c
Libraries/PeriphDrivers/Source/FLC/flc_reva.c
Libraries/PeriphDrivers/Source/FLC/flc_reva.h
# GPIO
Libraries/PeriphDrivers/Source/GPIO/gpio_common.c
Libraries/PeriphDrivers/Source/GPIO/gpio_common.h
Libraries/PeriphDrivers/Source/GPIO/gpio_me17.c
Libraries/PeriphDrivers/Source/GPIO/gpio_reva.c
Libraries/PeriphDrivers/Source/GPIO/gpio_reva.h
# LowPower
Libraries/PeriphDrivers/Source/LP/lp_me17.c
# Simo
Libraries/PeriphDrivers/Source/SIMO/simo_me17.c
Libraries/PeriphDrivers/Source/SIMO/simo_reva_regs.h
Libraries/PeriphDrivers/Source/SIMO/simo_.c
Libraries/PeriphDrivers/Source/SIMO/simo_.h
# System
Libraries/PeriphDrivers/Source/SYS/mxc_assert.c
Libraries/PeriphDrivers/Source/SYS/mxc_delay.c
Libraries/PeriphDrivers/Source/SYS/mxc_lock.c
Libraries/PeriphDrivers/Source/SYS/mxc_table.c
Libraries/PeriphDrivers/Source/SYS/pins_me17.c
Libraries/PeriphDrivers/Source/SYS/sys_me17.c
# Timer
Libraries/PeriphDrivers/Source/TMR/tmr_common.c
Libraries/PeriphDrivers/Source/TMR/tmr_common.h
Libraries/PeriphDrivers/Source/TMR/tmr_me17.c
Libraries/PeriphDrivers/Source/TMR/tmr_revb_regs.h
Libraries/PeriphDrivers/Source/TMR/tmr_revb.c
Libraries/PeriphDrivers/Source/TMR/tmr_revb.h
# True Random Number Generator
Libraries/PeriphDrivers/Source/TRNG/trng_me17.c
Libraries/PeriphDrivers/Source/TRNG/trng_revb_regs.h
Libraries/PeriphDrivers/Source/TRNG/trng_revb.c
Libraries/PeriphDrivers/Source/TRNG/trng_revb.h
# UART
Libraries/PeriphDrivers/Source/UART/uart_common.c
Libraries/PeriphDrivers/Source/UART/uart_common.h
Libraries/PeriphDrivers/Source/UART/uart_me17.c
Libraries/PeriphDrivers/Source/UART/uart_revb_regs.h
Libraries/PeriphDrivers/Source/UART/uart_revb.c
Libraries/PeriphDrivers/Source/UART/uart_revb.h
# WakeUp Timer
Libraries/PeriphDrivers/Source/WUT/wut_me17.c
Libraries/PeriphDrivers/Source/WUT/wut_reva_regs.h
Libraries/PeriphDrivers/Source/WUT/wut_reva.c
Libraries/PeriphDrivers/Source/WUT/wut_reva_regs.h )
# Directories to ignore
declare -a ignored=(
Libraries/Cordio/docs
Documentation
)
# Create an associative array for ignored()
declare -A aignored=()
for ignore in "${ignored[@]}"; do aignored["${ignore%/}"]=1; done
# Copy the working directory list, skipping entries in ignored()
declare -a results_other=()
for watch in "${watched_other[@]}"; do test -v aignored["${watch%/}"] || results_other+=("${watch%/}"); done
# Copy the working directory list, skipping entries in ignored()
declare -a results_examples=()
for watch in "${watched_examples[@]}"; do test -v aignored["${watch%/}"] || results_examples+=("${watch%/}"); done
# Print the resulting array, separated by newlines, in sorted order
printf "\r\n-------- Watched Examples ------------\r\n\r\n"
printf '%s\n' "${results_examples[@]}" | sort
printf "\r\n-----------------------------------\r\n"
# Print the resulting array, separated by newlines, in sorted order
printf "\r\n-------- Watched Other ------------\r\n\r\n"
printf '%s\n' "${results_other[@]}" | sort
printf "\r\n-----------------------------------\r\n"
#Get the diff from main
CHANGE_FILES=$(git diff --ignore-submodules --name-only remotes/origin/main)
# Assume we want to actually run the workflow if no files changed
if [[ "$CHANGE_FILES" != "" ]]; then
# Check if ALL test are required due to 'OTHER' non BLE example directory modified
for watch_file in "${results_other[@]}"; do
if [[ "$CHANGE_FILES" == *"$watch_file"* ]]; then
MAX32655_RUN_ALL_TEST=true
echo "MAX32655_RUN_ALL_TEST=true" >> $GITHUB_ENV
echo "Enabled all tests to run because $watch_file was modified"
fi
done
# Check to see which examples have been modified to only test those
for watch_file in "${results_examples[@]}"; do
if [[ "$CHANGE_FILES" == *"$watch_file"* ]]; then
MAX32655_BLE_FILES_CHANGED=true
echo "MAX32655_BLE_FILES_CHANGED=true" >> $GITHUB_ENV
example_to_test=$(basename "$watch_file")
# Store list of examples that need to be tested
examples_list+=($example_to_test)
echo "Enabled example tests to run because $watch_file was modified"
# If dats/c or OTAC/s were modified we should also test the connected functionality
if [[ $example_to_test == "BLE_dats" ]] || [[ $example_to_test == "BLE_datc" ]]; then
MAX32655_DATS_CONNECTED_TEST=true
echo "MAX32655_DATS_CONNECTED_TEST=true" >> $GITHUB_ENV
echo "Enabled Datsc connected test"
fi
if [[ $example_to_test == "BLE_otas" ]] || [[ $example_to_test == "BLE_otac" ]]; then
MAX32655_OTAS_CONNECTED_TEST=true
echo "MAX32655_OTAS_CONNECTED_TEST=true" >> $GITHUB_ENV
echo "Enabled OTA connected test"
fi
fi
done
# Save examples list to env varaible available across steps
echo "MAX32655_EXAMPLES_TO_TEST=${examples_list[@]}" >> $GITHUB_ENV
else
# Assume we want to actually run the workflow if no files changed
MAX32655_RUN_ALL_TEST=true
echo "MAX32655_RUN_ALL_TEST=true" >> $GITHUB_ENV
echo "Assuming you want all tests to run"
fi
# Lock main board and DUT if any connected test is required otherwise just lock DUT
if [[ $MAX32655_OTAS_CONNECTED_TEST == 'true' ]] || [[ $MAX32655_DATS_CONNECTED_TEST == 'true' ]] || [[ $MAX32655_RUN_ALL_TEST == 'true' ]]; then
echo "LOCK_MAX32655_B1=true" >> $GITHUB_ENV
echo "LOCK_MAX32655_B2=true" >> $GITHUB_ENV
elif [[ $MAX32655_BLE_FILES_CHANGED == 'true' ]]; then
echo "LOCK_MAX32655_B2=true" >> $GITHUB_ENV
else
echo "no tests enabled, NOT locking anything at this step"
fi
#----------------------------------------------------------------------------------------------
#------------------------------| MAX32665 |----------------------------------------------------
#----------------------------------------------------------------------------------------------
# Checks if changes have been made to require a test on ME14
- name: Check MAX32665
id: MAX32665
env:
MAX32665_BLE_FILES_CHANGED: false
MAX32665_EXAMPLES_TO_TEST: ()
MAX32665_RUN_ALL_TEST: false
MAX32665_DATS_CONNECTED_TEST: false
MAX32665_OTAS_CONNECTED_TEST: false
run: |
# BLE examples to watch
declare -a watched_examples=(
# underscore in filter to ignore the BLE5_ctr examples
Examples/MAX32665/BLE_*
Examples/MAX32665/Bootloader
)
# Other directories to watch
declare -a watched_other=(
#To test changes this workflow push a commit with this uncommented
#.github/workflows/
.github/workflows/ci-tests/Examples_tests
Libraries/libs.mk
# Bluetooth
Libraries/BlePhy/MAX32665
Libraries/Cordio
# Board specific
Libraries/Boards/MAX32665
# Libraries
Libraries/CMSIS/Device/Maxim/MAX32665
Libraries/PeriphDrivers/libPeriphDriver.mk
Libraries/PeriphDrivers/periphdriver.mk
Libraries/PeriphDrivers/max32665_files.mk
# Flash controller
Libraries/PeriphDrivers/Source/FLC/flc_common.c
Libraries/PeriphDrivers/Source/FLC/flc_common.h
Libraries/PeriphDrivers/Source/FLC/flc_me14.c
Libraries/PeriphDrivers/Source/FLC/flc_reva.c
Libraries/PeriphDrivers/Source/FLC/flc_reva.h
# GPIO
Libraries/PeriphDrivers/Source/GPIO/gpio_common.c
Libraries/PeriphDrivers/Source/GPIO/gpio_common.h
Libraries/PeriphDrivers/Source/GPIO/gpio_me14.c
Libraries/PeriphDrivers/Source/GPIO/gpio_reva.c
Libraries/PeriphDrivers/Source/GPIO/gpio_reva.h
# LowPower
Libraries/PeriphDrivers/Source/LP/lp_me14.c
# Simo
Libraries/PeriphDrivers/Source/SIMO/simo_me14.c
Libraries/PeriphDrivers/Source/SIMO/simo_reva_regs.h
Libraries/PeriphDrivers/Source/SIMO/simo_.c
Libraries/PeriphDrivers/Source/SIMO/simo_.h
# System
Libraries/PeriphDrivers/Source/SYS/mxc_assert.c
Libraries/PeriphDrivers/Source/SYS/mxc_delay.c
Libraries/PeriphDrivers/Source/SYS/mxc_lock.c
Libraries/PeriphDrivers/Source/SYS/mxc_table.c
Libraries/PeriphDrivers/Source/SYS/pins_me14.c
Libraries/PeriphDrivers/Source/SYS/sys_me14.c
# Timer
Libraries/PeriphDrivers/Source/TMR/tmr_common.c
Libraries/PeriphDrivers/Source/TMR/tmr_common.h
Libraries/PeriphDrivers/Source/TMR/tmr_me14.c
Libraries/PeriphDrivers/Source/TMR/tmr_reva_regs.h
Libraries/PeriphDrivers/Source/TMR/tmr_reva.c
Libraries/PeriphDrivers/Source/TMR/tmr_reva.h
# TPU
Libraries/PeriphDrivers/Source/TPU/tpu_me14.c
Libraries/PeriphDrivers/Source/TPU/tpu_reva_regs.h
Libraries/PeriphDrivers/Source/TPU/tpu_reva.c
Libraries/PeriphDrivers/Source/TPU/tpu_reva.h
# True Random Number Generator
Libraries/PeriphDrivers/Source/TRNG/trng_me14.c
Libraries/PeriphDrivers/Source/TRNG/trng_revb_regs.h
Libraries/PeriphDrivers/Source/TRNG/trng_revb.c
Libraries/PeriphDrivers/Source/TRNG/trng_revb.h
# UART
Libraries/PeriphDrivers/Source/UART/uart_common.c
Libraries/PeriphDrivers/Source/UART/uart_common.h
Libraries/PeriphDrivers/Source/UART/uart_me14.c
Libraries/PeriphDrivers/Source/UART/uart_reva_regs.h
Libraries/PeriphDrivers/Source/UART/uart_reva.c
Libraries/PeriphDrivers/Source/UART/uart_reva.h
# WakeUp Timer
Libraries/PeriphDrivers/Source/WUT/wut_me14.c
Libraries/PeriphDrivers/Source/WUT/wut_reva_regs.h
Libraries/PeriphDrivers/Source/WUT/wut_reva.c
Libraries/PeriphDrivers/Source/WUT/wut_reva_regs.h )
# Directories to ignore
declare -a ignored=(
Libraries/Cordio/docs
Documentation
)
# Create an associative array for ignored()
declare -A aignored=()
for ignore in "${ignored[@]}"; do aignored["${ignore%/}"]=1; done
# Copy the working directory list, skipping entries in ignored()
declare -a results_other=()
for watch in "${watched_other[@]}"; do test -v aignored["${watch%/}"] || results_other+=("${watch%/}"); done
# Copy the working directory list, skipping entries in ignored()
declare -a results_examples=()
for watch in "${watched_examples[@]}"; do test -v aignored["${watch%/}"] || results_examples+=("${watch%/}"); done
# Print the resulting array, separated by newlines, in sorted order
printf "\r\n-------- Watched Examples ------------\r\n\r\n"
printf '%s\n' "${results_examples[@]}" | sort
printf "\r\n-----------------------------------\r\n"
# Print the resulting array, separated by newlines, in sorted order
printf "\r\n-------- Watched Other ------------\r\n\r\n"
printf '%s\n' "${results_other[@]}" | sort
printf "\r\n-----------------------------------\r\n"
#Get the diff from main
CHANGE_FILES=$(git diff --ignore-submodules --name-only remotes/origin/main)
# Assume we want to actually run the workflow if no files changed
if [[ "$CHANGE_FILES" != "" ]]; then
# Check if ALL test are required due to 'OTHER' non BLE example directory modified
for watch_file in "${results_other[@]}"; do
if [[ "$CHANGE_FILES" == *"$watch_file"* ]]; then
MAX32665_RUN_ALL_TEST=true
echo "MAX32665_RUN_ALL_TEST=true" >> $GITHUB_ENV
echo "Enabled all tests to run because $watch_file was modified"
fi
done
# Check to see which examples have been modified to only test those
for watch_file in "${results_examples[@]}"; do
if [[ "$CHANGE_FILES" == *"$watch_file"* ]]; then
MAX32665_BLE_FILES_CHANGED=true
echo "MAX32665_BLE_FILES_CHANGED=true" >> $GITHUB_ENV
example_to_test=$(basename "$watch_file")
# Store list of examples that need to be tested
examples_list+=($example_to_test)
echo "Enabled example tests to run because $watch_file was modified"
# If dats/c or OTAC/s were modified we should also test the connected functionality
if [[ $example_to_test == "BLE_dats" ]] || [[ $example_to_test == "BLE_datc" ]]; then
MAX32665_DATS_CONNECTED_TEST=true
echo "MAX32665_DATS_CONNECTED_TEST=true" >> $GITHUB_ENV
echo "Enabled Datsc connected test"
fi
if [[ $example_to_test == "BLE_otas" ]] || [[ $example_to_test == "BLE_otac" ]]; then
MAX32665_OTAS_CONNECTED_TEST=true
echo "MAX32665_OTAS_CONNECTED_TEST=true" >> $GITHUB_ENV
echo "Enabled OTA connected test"
fi
fi
done
# Save examples list to env varaible available across steps
echo "MAX32665_EXAMPLES_TO_TEST=${examples_list[@]}" >> $GITHUB_ENV
else
# Assume we want to actually run the workflow if no files changed
MAX32665_RUN_ALL_TEST=true
echo "MAX32665_RUN_ALL_TEST=true" >> $GITHUB_ENV
fi
# Lock main board and DUT if any connected test is required otherwise just lock DUT
if [[ $MAX32665_OTAS_CONNECTED_TEST == 'true' ]] || [[ $MAX32665_DATS_CONNECTED_TEST == 'true' ]] || [[ $MAX32665_RUN_ALL_TEST == 'true' ]]; then
echo "LOCK_MAX32655_B1=true" >> $GITHUB_ENV
echo "LOCK_MAX32665_B1=true" >> $GITHUB_ENV
elif [[ $MAX32665_BLE_FILES_CHANGED == 'true' ]]; then
echo "LOCK_MAX32665_B1=true" >> $GITHUB_ENV
else
echo "no tests enabled, NOT locking anything at this step"
fi
#----------------------------------------------------------------------------------------------
#------------------------------| MAX32690 |----------------------------------------------------
#----------------------------------------------------------------------------------------------
# Checks if changes have been made to require a test on ME14
- name: Check MAX32690
id: MAX32690
env:
MAX32690_BLE_FILES_CHANGED: false
MAX32690_EXAMPLES_TO_TEST: ()
MAX32690_RUN_ALL_TEST: false
MAX32690_DATS_CONNECTED_TEST: false
MAX32690_OTAS_CONNECTED_TEST: false
run: |
# BLE examples to watch
declare -a watched_examples=(
# underscore in filter to ignore the BLE5_ctr examples
Examples/MAX32690/BLE_*
Examples/MAX32690/Bootloader
)
# Other directories to watch
declare -a watched_other=(
#To test changes this workflow push a commit with this uncommented
#.github/workflows/
.github/workflows/ci-tests/Examples_tests
Libraries/libs.mk
# Bluetooth
Libraries/BlePhy/MAX32690
Libraries/Cordio
# Board specific
Libraries/Boards/MAX32690
# Libraries
Libraries/CMSIS/Device/Maxim/MAX32690
Libraries/PeriphDrivers/libPeriphDriver.mk
Libraries/PeriphDrivers/periphdriver.mk
Libraries/PeriphDrivers/max32690_files.mk
# AES
Libraries/PeriphDrivers/Source/AES/aes_me18.c
Libraries/PeriphDrivers/Source/AES/aes_revb_regs.h
Libraries/PeriphDrivers/Source/AES/aes_revb.c
Libraries/PeriphDrivers/Source/AES/aes_revb.h
Libraries/PeriphDrivers/Source/AES/aeskeys_revb_regs.h
# Flash controller
Libraries/PeriphDrivers/Source/FLC/flc_common.c
Libraries/PeriphDrivers/Source/FLC/flc_common.h
Libraries/PeriphDrivers/Source/FLC/flc_me18.c
Libraries/PeriphDrivers/Source/FLC/flc_reva.c
Libraries/PeriphDrivers/Source/FLC/flc_reva.h
# GPIO
Libraries/PeriphDrivers/Source/GPIO/gpio_common.c
Libraries/PeriphDrivers/Source/GPIO/gpio_common.h
Libraries/PeriphDrivers/Source/GPIO/gpio_me18.c
Libraries/PeriphDrivers/Source/GPIO/gpio_reva.c
Libraries/PeriphDrivers/Source/GPIO/gpio_reva.h
# LowPower
Libraries/PeriphDrivers/Source/LP/lp_me18.c
# System
Libraries/PeriphDrivers/Source/SYS/mxc_assert.c
Libraries/PeriphDrivers/Source/SYS/mxc_delay.c
Libraries/PeriphDrivers/Source/SYS/mxc_lock.c
Libraries/PeriphDrivers/Source/SYS/mxc_table.c
Libraries/PeriphDrivers/Source/SYS/pins_me18.c
Libraries/PeriphDrivers/Source/SYS/sys_me18.c
# Timer
Libraries/PeriphDrivers/Source/TMR/tmr_common.c
Libraries/PeriphDrivers/Source/TMR/tmr_common.h
Libraries/PeriphDrivers/Source/TMR/tmr_me18.c
Libraries/PeriphDrivers/Source/TMR/tmr_revb_regs.h
Libraries/PeriphDrivers/Source/TMR/tmr_revb.c
Libraries/PeriphDrivers/Source/TMR/tmr_revb.h
# True Random Number Generator
Libraries/PeriphDrivers/Source/CTB/ctb_common.c
Libraries/PeriphDrivers/Source/CTB/ctb_common.h
Libraries/PeriphDrivers/Source/CTB/ctb_me18.c
Libraries/PeriphDrivers/Source/CTB/ctb_reva_regs.h
Libraries/PeriphDrivers/Source/CTB/ctb_reva.c
Libraries/PeriphDrivers/Source/CTB/ctb_reva.h
Libraries/PeriphDrivers/Source/CTB/trng_reva_regs.h
# UART
Libraries/PeriphDrivers/Source/UART/uart_common.c
Libraries/PeriphDrivers/Source/UART/uart_common.h
Libraries/PeriphDrivers/Source/UART/uart_me18.c
Libraries/PeriphDrivers/Source/UART/uart_revb_regs.h
Libraries/PeriphDrivers/Source/UART/uart_revb.c
Libraries/PeriphDrivers/Source/UART/uart_revb.h
# WakeUp Timer
Libraries/PeriphDrivers/Source/WUT/wut_me18.c
Libraries/PeriphDrivers/Source/WUT/wut_reva_regs.h
Libraries/PeriphDrivers/Source/WUT/wut_reva.c
Libraries/PeriphDrivers/Source/WUT/wut_reva_regs.h )
# Directories to ignore
declare -a ignored=(
Libraries/Cordio/docs
Documentation
)
# Create an associative array for ignored()
declare -A aignored=()
for ignore in "${ignored[@]}"; do aignored["${ignore%/}"]=1; done
# Copy the working directory list, skipping entries in ignored()
declare -a results_other=()
for watch in "${watched_other[@]}"; do test -v aignored["${watch%/}"] || results_other+=("${watch%/}"); done
# Copy the working directory list, skipping entries in ignored()
declare -a results_examples=()
for watch in "${watched_examples[@]}"; do test -v aignored["${watch%/}"] || results_examples+=("${watch%/}"); done
# Print the resulting array, separated by newlines, in sorted order
printf "\r\n-------- Watched Examples ------------\r\n\r\n"
printf '%s\n' "${results_examples[@]}" | sort
printf "\r\n-----------------------------------\r\n"
# Print the resulting array, separated by newlines, in sorted order
printf "\r\n-------- Watched Other ------------\r\n\r\n"
printf '%s\n' "${results_other[@]}" | sort
printf "\r\n-----------------------------------\r\n"
#Get the diff from main
CHANGE_FILES=$(git diff --ignore-submodules --name-only remotes/origin/main)
# Assume we want to actually run the workflow if no files changed
if [[ "$CHANGE_FILES" != "" ]]; then
# Check if ALL test are required due to 'OTHER' non BLE example directory modified
for watch_file in "${results_other[@]}"; do
if [[ "$CHANGE_FILES" == *"$watch_file"* ]]; then
MAX32690_RUN_ALL_TEST=true
echo "MAX32690_RUN_ALL_TEST=true" >> $GITHUB_ENV
echo "Enabled all tests to run because $watch_file was modified"
fi
done
# Check to see which examples have been modified to only test those
for watch_file in "${results_examples[@]}"; do
if [[ "$CHANGE_FILES" == *"$watch_file"* ]]; then
MAX32690_BLE_FILES_CHANGED=true
echo "MAX32690_BLE_FILES_CHANGED=true" >> $GITHUB_ENV
example_to_test=$(basename "$watch_file")
# Store list of examples that need to be tested
examples_list+=($example_to_test)
echo "Enabled example tests to run because $watch_file was modified"
# If dats/c or OTAC/s were modified we should also test the connected functionality
if [[ $example_to_test == "BLE_dats" ]] || [[ $example_to_test == "BLE_datc" ]]; then
MAX32690_DATS_CONNECTED_TEST=true
echo "MAX32690_DATS_CONNECTED_TEST=true" >> $GITHUB_ENV
echo "Enabled Datsc connected test"
fi
if [[ $example_to_test == "BLE_otas" ]] || [[ $example_to_test == "BLE_otac" ]]; then
MAX32690_OTAS_CONNECTED_TEST=true
echo "MAX32690_OTAS_CONNECTED_TEST=true" >> $GITHUB_ENV
echo "Enabled OTA connected test"
fi
fi
done
# Save examples list to env varaible available across steps
echo "MAX32690_EXAMPLES_TO_TEST=${examples_list[@]}" >> $GITHUB_ENV
else
# Assume we want to actually run the workflow if no files changed
MAX32690_RUN_ALL_TEST=true
echo "MAX32690_RUN_ALL_TEST=true" >> $GITHUB_ENV
fi
# Lock main board and DUT if any connected test is required otherwise just lock DUT
if [[ $MAX32690_OTAS_CONNECTED_TEST == 'true' ]] || [[ $MAX32690_DATS_CONNECTED_TEST == 'true' ]] || [[ $MAX32690_RUN_ALL_TEST == 'true' ]]; then
echo "LOCK_MAX32655_B1=true" >> $GITHUB_ENV
echo "LOCK_MAX32690_B1=true" >> $GITHUB_ENV
elif [[ $MAX32690_BLE_FILES_CHANGED == 'true' ]]; then
echo "LOCK_MAX32690_B1=true" >> $GITHUB_ENV
else
echo "no tests enabled, NOT locking anything at this step"
fi
#----------------------------------------------------------------------------------------------
#------------------------------| Lock all required boards at once |-----------------------------
#----------------------------------------------------------------------------------------------
- name: Lock Boards
if: env.LOCK_MAX32655_B1 == 'true' || env.LOCK_MAX32655_B2 == 'true' || env.LOCK_MAX32665_B1 == 'true' || env.LOCK_MAX32690_B1 == 'true'
id: lock_boards
run: |
python3 /home/$USER/Workspace/Resource_Share/Resource_Share_multiboard.py -l -t 3600 -b max32655_board1 -b max32655_board2 -b max32665_board1 -b max32690_board_w1
#----------------------------------------------------------------------------------------------
#------------------------------| Erase all required boards at once |-----------------------------
#----------------------------------------------------------------------------------------------
- name: Erase Boards
if: steps.lock_boards.outcome == 'success'
id: erase_boards
run: |
# start with boards in known state
cd .github/workflows/scripts
echo "Erasing Main MAX32655 B1"
./mass_erase_board.sh max32655 max32655_board1
echo "Erasing Main MAX32655 B2"
./mass_erase_board.sh max32655 max32655_board2
echo "Erasing Main MAX32665 B1"
./mass_erase_board.sh max32665 max32665_board1
echo "Erasing Main MAX32690"
./mass_erase_board.sh max32690 max32690_board_w1
#----------------------------------------------------------------------------------------------
#----------------------------------------------------------------------------------------------
#----------------------------------------------------------------------------------------------
#------------------------------| Test all required boards at once |-----------------------------
#----------------------------------------------------------------------------------------------
- name: Test MAX32655 #name used for display purposes on github webpage
if: steps.lock_boards.outcome == 'success' && env.LOCK_MAX32655_B2 == 'true'
id: Test_MAX32655 #id used to reference this step in other parts of the yml
run: |
FILE=/home/$USER/Workspace/Resource_Share/boards_config.json
dut_uart=$(/usr/bin/python3 -c "import sys, json; print(json.load(open('$FILE'))['max32655_board2']['uart0'])")
dut_serial=$(/usr/bin/python3 -c "import sys, json; print(json.load(open('$FILE'))['max32655_board2']['daplink'])")
examples_to_test=(${MAX32655_EXAMPLES_TO_TEST[@]})
echo
echo
echo "Examples to be tested : ${examples_to_test[@]}"
echo "MAX32655_RUN_ALL_TEST : $MAX32655_RUN_ALL_TEST"
echo "MAX32655_DATS_CONNECTED_TEST : $MAX32655_DATS_CONNECTED_TEST "
echo "MAX32655_OTAS_CONNECTED_TEST : $MAX32655_OTAS_CONNECTED_TEST"
echo "MAX32655_BLE_FILES_CHANGED : $MAX32655_BLE_FILES_CHANGED "
echo "LOCK_MAX32655_B2 : $LOCK_MAX32655_B2 "
cd .github/workflows/scripts
if [[ $MAX32655_RUN_ALL_TEST == 'true' ]]; then
echo "Testing all examples"
set +e
./test_launcher.sh max32655 $dut_uart $dut_serial "all"
let "testResult=$?"
if [ "$testResult" -ne "0" ]; then
# update failed test count
let "numOfFailedTests+=$testResult"
fi
set -e
else
if [[ $MAX32655_BLE_FILES_CHANGED == 'true' ]]; then
#------non connected tests---------
for example in "${examples_to_test[@]}"; do
# launch single tests
echo "Running $example test on MAX32655"
set +e
./test_launcher.sh max32655 $dut_uart $dut_serial $example
let "testResult=$?"
if [ "$testResult" -ne "0" ]; then
# update failed test count
let "numOfFailedTests+=$testResult"
failedTestList+="| $example"
fi
set -e
done
#------connected tests---------
if [[ $MAX32655_DATS_CONNECTED_TEST == 'true' ]]; then
#conencted test launcher
echo "Testing MAX32655_DATS_CONNECTED_TEST"
set +e
./test_launcher.sh max32655 $dut_uart $dut_serial "dats"
let "testResult=$?"
if [ "$testResult" -ne "0" ]; then
# update failed_test count
let "numOfFailedTests+=$testResult"
failedTestList+="| MAX32655 Dats/c"
fi
set -e
fi
#------connected tests---------
if [[ $MAX32655_OTAS_CONNECTED_TEST == 'true' ]]; then
#conencted test launcher
echo "Testing MAX32655_OTAS_CONNECTED_TEST"
set +e
#call test here
#***************** uncomment actual test here *************
./test_launcher.sh max32655 $dut_uart $dut_serial "ota"
let "testResult=$?"
if [ "$testResult" -ne "0" ]; then
# update failed test count
let "numOfFailedTests+=$testResult"
failedTestList+="| MAX32655 OTAS/C"
fi
set -e
fi
else
echo "Skipping all tests"
fi
echo "=============================================================================="
echo "=============================================================================="
if [[ $numOfFailedTests -ne 0 ]]; then
printf "Test completed with $numOfFailedTests failed tests located in: \r\n $failedTestList"
else
echo "Relax! ALL TESTS PASSED"
fi
echo
echo "=============================================================================="
echo "=============================================================================="
echo
fi
exit $numOfFailedTests
#----------------------------------------------------------------------------------------------
- name: Test MAX32665 #name used for display purposes on github webpage
if: steps.lock_boards.outcome == 'success' && env.LOCK_MAX32665_B1 == 'true'
id: Test_MAX32665 #id used to reference this step in other parts of the yml
run: |
FILE=/home/$USER/Workspace/Resource_Share/boards_config.json
dut_uart=$(/usr/bin/python3 -c "import sys, json; print(json.load(open('$FILE'))['max32665_board1']['uart1'])")
dut_serial=$(/usr/bin/python3 -c "import sys, json; print(json.load(open('$FILE'))['max32665_board1']['daplink'])")
examples_to_test=(${MAX32665_EXAMPLES_TO_TEST[@]})
echo
echo
echo "Examples to be tested : ${examples_to_test[@]}"
echo "MAX32665_RUN_ALL_TEST : $MAX32665_RUN_ALL_TEST"
echo "MAX32665_DATS_CONNECTED_TEST : $MAX32665_DATS_CONNECTED_TEST "
echo "MAX32665_OTAS_CONNECTED_TEST : $MAX32665_OTAS_CONNECTED_TEST"
echo "MAX32665_BLE_FILES_CHANGED : $MAX32665_BLE_FILES_CHANGED "
echo "LOCK_MAX32665_B1 : $LOCK_MAX32665_B1 "
cd .github/workflows/scripts
if [[ $MAX32665_RUN_ALL_TEST == 'true' ]]; then
echo "Testing all examples"
set +e
./test_launcher.sh max32665 $dut_uart $dut_serial "all"
let "testResult=$?"
if [ "$testResult" -ne "0" ]; then
# update failed test count
let "numOfFailedTests+=$testResult"
fi
set -e
else
if [[ $MAX32665_BLE_FILES_CHANGED == 'true' ]]; then
#------non connected tests---------
for example in "${examples_to_test[@]}"; do
# launch single tests
echo "Running $example test on MAX32665"
set +e
./test_launcher.sh max32665 $dut_uart $dut_serial $example
let "testResult=$?"
if [ "$testResult" -ne "0" ]; then
# update failed test count
let "numOfFailedTests+=$testResult"
failedTestList+="| $example"
fi
set -e
done
#------connected tests---------
if [[ $MAX32665_DATS_CONNECTED_TEST == 'true' ]]; then
#conencted test launcher
echo "Testing MAX32665_DATS_CONNECTED_TEST"
set +e
./test_launcher.sh max32665 $dut_uart $dut_serial "dats"
let "testResult=$?"
if [ "$testResult" -ne "0" ]; then
# update failed_test count
let "numOfFailedTests+=$testResult"
failedTestList+="| MAX32665 Dats/c"
fi
set -e
fi
#------connected tests---------
if [[ $MAX32665_OTAS_CONNECTED_TEST == 'true' ]]; then
#conencted test launcher
echo "Testing MAX32665_OTAS_CONNECTED_TEST"
set +e
#call test here
#***************** uncomment actual test here *************
./test_launcher.sh max32665 $dut_uart $dut_serial "ota"
let "testResult=$?"
if [ "$testResult" -ne "0" ]; then
# update failed test count
let "numOfFailedTests+=$testResult"
failedTestList+="| MAX32665 OTAS/C"
fi
set -e
fi
else
echo "Skipping all tests"
fi
echo "=============================================================================="
echo "=============================================================================="
if [[ $numOfFailedTests -ne 0 ]]; then
printf "Test completed with $numOfFailedTests failed tests located in: \r\n $failedTestList"
else
echo "Relax! ALL TESTS PASSED"
fi
echo
echo "=============================================================================="
echo "=============================================================================="
echo
fi
exit $numOfFailedTests
#----------------------------------------------------------------------------------------------
- name: Test MAX32690 #name used for display purposes on github webpage
if: steps.lock_boards.outcome == 'success' && env.LOCK_MAX32690_B1 == 'true'
id: Test_MAX32690 #id used to reference this step in other parts of the yml
run: |
FILE=/home/$USER/Workspace/Resource_Share/boards_config.json
dut_uart=$(/usr/bin/python3 -c "import sys, json; print(json.load(open('$FILE'))['max32690_board_w1']['uart2'])")
dut_serial=$(/usr/bin/python3 -c "import sys, json; print(json.load(open('$FILE'))['max32690_board_w1']['daplink'])")
examples_to_test=(${MAX32690_EXAMPLES_TO_TEST[@]})
echo
echo
echo "Examples to be tested : ${examples_to_test[@]}"
echo "MAX32690_RUN_ALL_TEST : $MAX32690_RUN_ALL_TEST"
echo "MAX32690_DATS_CONNECTED_TEST : $MAX32690_DATS_CONNECTED_TEST "
echo "MAX32690_OTAS_CONNECTED_TEST : $MAX32690_OTAS_CONNECTED_TEST"
echo "MAX32690_BLE_FILES_CHANGED : $MAX32690_BLE_FILES_CHANGED "
echo "LOCK_MAX32690_B1 : $LOCK_MAX32690_B1 "
cd .github/workflows/scripts
if [[ $MAX32690_RUN_ALL_TEST == 'true' ]]; then
echo "Testing all examples"
set +e
./test_launcher.sh max32690 $dut_uart $dut_serial "all"
let "testResult=$?"
if [ "$testResult" -ne "0" ]; then
# update failed test count
let "numOfFailedTests+=$testResult"
fi
set -e
else
if [[ $MAX32690_BLE_FILES_CHANGED == 'true' ]]; then
#------non connected tests---------
for example in "${examples_to_test[@]}"; do
# launch single tests
echo "Running $example test on MAX32690"
set +e
./test_launcher.sh max32690 $dut_uart $dut_serial $example
let "testResult=$?"
if [ "$testResult" -ne "0" ]; then
# update failed test count
let "numOfFailedTests+=$testResult"
failedTestList+="| $example"
fi
set -e
done
#------connected tests---------
if [[ $MAX32690_DATS_CONNECTED_TEST == 'true' ]]; then
#conencted test launcher
echo "Testing MAX32690_DATS_CONNECTED_TEST"
set +e
./test_launcher.sh max32690 $dut_uart $dut_serial "dats"
let "testResult=$?"
if [ "$testResult" -ne "0" ]; then
# update failed_test count
let "numOfFailedTests+=$testResult"
failedTestList+="| MAX32690 Dats/c"
fi
set -e
fi
#------connected tests---------
if [[ $MAX32690_OTAS_CONNECTED_TEST == 'true' ]]; then
#conencted test launcher
echo "Testing MAX32690_OTAS_CONNECTED_TEST"
set +e
#call test here
#***************** uncomment actual test here *************
./test_launcher.sh max32690 $dut_uart $dut_serial "ota"
let "testResult=$?"
if [ "$testResult" -ne "0" ]; then
# update failed test count
let "numOfFailedTests+=$testResult"
failedTestList+="| MAX32690 OTAS/C"
fi
set -e
fi
else
echo "Skipping all tests"
fi
echo "=============================================================================="
echo "=============================================================================="
if [[ $numOfFailedTests -ne 0 ]]; then
printf "Test completed with $numOfFailedTests failed tests located in: \r\n $failedTestList"
else
echo "Relax! ALL TESTS PASSED"
fi
echo
echo "=============================================================================="
echo "=============================================================================="
echo
fi
exit $numOfFailedTests
#----------------------------------------------------------------------------------------------
#----------------------------------------------------------------------------------------------
#------------------------------| Erase & Unlock all required boards at once |-----------------------------
#----------------------------------------------------------------------------------------------
- name: Clean up
if: ${{ always() && steps.lock_boards.outcome == 'success'}}
run: |
git clean -ffdx
git reset --hard
# leave board in known state if workflow should end early
cd .github/workflows/scripts
echo "Erasing Main MAX32655 B1"
./mass_erase_board.sh max32655 max32655_board1
echo "Erasing Main MAX32655 B2"
./mass_erase_board.sh max32655 max32655_board2
echo "Erasing Main MAX32665 B1"
./mass_erase_board.sh max32665 max32665_board1
echo "Erasing Main MAX32690"
./mass_erase_board.sh max32690 max32690_board_w1
- name: Unlock Boards
if: ${{ always() && steps.lock_boards.outcome == 'success'}}
run: |
python3 /home/$USER/Workspace/Resource_Share/Resource_Share_multiboard.py -b max32655_board1 -b max32655_board2 -b max32665_board1 -b max32690_board_w1
#----------------------------------------------------------------------------------------------
# Save test reports
- uses: actions/upload-artifact@v3
if: failure()
with:
name: failure-report
path: .github/workflows/ci-tests/Examples_tests/results/