Skip to content

feat(MiscDrivers): Add Ability to Set Pushbutton Polarity #4517

feat(MiscDrivers): Add Ability to Set Pushbutton Polarity

feat(MiscDrivers): Add Ability to Set Pushbutton Polarity #4517

###############################################################################
#
# Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
# Analog Devices, Inc.),
# Copyright (C) 2023-2024 Analog Devices, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
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
pull_request:
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
RESULTS_DIR: "ble_test_results"
jobs:
BLE_Tests:
# The type of runner that the job will run on
runs-on: [self-hosted]
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v4
with:
submodules: false
repository: analogdevicesinc/msdk
fetch-depth: 0
- 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/Bluetooth/BLE_*
Examples/MAX32655/Bluetooth/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
- name: Check MAX32665
if: false
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/Bluetooth/BLE_*
Examples/MAX32665/Bluetooth/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
- name: Check MAX32690
if: false
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/Bluetooth/BLE_*
Examples/MAX32690/Bluetooth/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
- name: Lock Boards
uses: Analog-Devices-MSDK/btm-ci-scripts/actions/lock-board@v1.1
with:
boards: |
max32655_board1
max32655_board2
max32665_board1
max32690_board_w1
lock: true
timeout: 3600 # Attempt to lock for an hour
- name: Init Tests
run: |
#set advertising names
# sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_dats/dats_main.c
# sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_datc/datc_main.c
# sed -i "s/'S'/'!'/g" Examples/MAX32665/Bluetooth/BLE_dats/dats_main.c
# sed -i "s/'S'/'!'/g" Examples/MAX32690/Bluetooth/BLE_datc/datc_main.c
# sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_otas/dats_main.c
# sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_otac/datc_main.c
# sed -i "s/'S'/'!'/g" Examples/MAX32665/Bluetooth/BLE_otas/dats_main.c
# sed -i "s/'S'/'!'/g" Examples/MAX32690/Bluetooth/BLE_otac/datc_main.c
- name: Erase Boards DATS
if: ${{env.MAX32655_DATS_CONNECTED_TEST == 'true' || env.MAX32665_DATS_CONNECTED_TEST == 'true' || env.MAX32690_DATS_CONNECTED_TEST == 'true'}}
uses: Analog-Devices-MSDK/btm-ci-scripts/actions/ocderase@v1.1
with:
board: |
max32655_board1
max32655_board2
max32665_board1
max32690_board_w1
has_two_flash_banks: |
true
true
true
true
- name: Flash DATS 655
if: ${{env.MAX32655_DATS_CONNECTED_TEST == 'true'}}
uses: Analog-Devices-MSDK/btm-ci-scripts/actions/ocdflash@v1.1
with:
board: |
max32655_board1
max32655_board2
project: |
BLE_dats
BLE_datc
suppress_output: true
build_flags: |
ADV_NAME=DAT?
ADV_NAME=DAT?
build: true
distclean: true
- name: DATS 655
if: ${{env.MAX32655_DATS_CONNECTED_TEST == 'true'}}
run: |
DATS_TEST_DIR=$TEST_DIR/dats
DATS_BOARD_655=max32655_board1
DATC_BOARD_655=max32655_board2
(cd $DATS_TEST_DIR && ls && python3 datsc_connected.py $DATS_BOARD_655 $DATC_BOARD_655)
- name: Erase Boards OTAS
if: ${{env.MAX32655_DATS_CONNECTED_TEST == 'true' || env.MAX32665_DATS_CONNECTED_TEST == 'true' || env.MAX32690_DATS_CONNECTED_TEST == 'true'}}
uses: Analog-Devices-MSDK/btm-ci-scripts/actions/ocderase@v1.1
with:
board: |
max32655_board1
max32655_board2
max32665_board1
max32690_board_w1
- name: Flash OTAS
if: ${{env.MAX32655_DATS_CONNECTED_TEST == 'true' || env.MAX32665_DATS_CONNECTED_TEST == 'true' || env.MAX32690_DATS_CONNECTED_TEST == 'true'}}
uses: Analog-Devices-MSDK/btm-ci-scripts/actions/ocdflash@v1.1
with:
board: |
max32655_board1
max32655_board2
max32665_board1
build_flags: |
ADV_NAME=OTA?
ADV_NAME=OTA?
ADV_NAME=OTA!
ADV_NAME=OTA!
project: |
BLE_otas
BLE_otac
BLE_otac
suppress_output: true
build: true
distclean: true
- name: OTAS
if: ${{env.MAX32655_DATS_CONNECTED_TEST == 'true' || env.MAX32665_DATS_CONNECTED_TEST == 'true' || env.MAX32690_DATS_CONNECTED_TEST == 'true'}}
run: |
OTAS_TEST_DIR=$TEST_DIR/otas
OTAS_BOARD_655=max32655_board1
OTAC_BOARD_655=max32655_board2
OTAC_BOARD_665=max32665_board1
OTAC_BOARD_690=max32690_board_w1
if [[ $MAX32655_OTAS_CONNECTED_TEST == 'true' ]]; then
(cd $OTAS_TEST_DIR && python3 otas_connected.py $OTAS_BOARD_655 $OTAC_BOARD_655)
fi
# disable for now
# (cd $OTAS_TEST_DIR && python3 otas_connected.py $OTAS_BOARD_655 $OTAC_BOARD_665)
# (cd $OTAS_TEST_DIR && python3 otas_connected.py $OTAS_BOARD_690 $OTAC_BOARD_655)
- name: Result Consolidation
if: failure()
run: |
set +e
rm -rf $RESULTS_DIR
mkdir $RESULTS_DIR
mv $TEST_DIR/dats/dats_out $RESULTS_DIR
mv $TEST_DIR/otas/otas_out $RESULTS_DIR
set -e
- name: Unlock Boards
if: always()
uses: Analog-Devices-MSDK/btm-ci-scripts/actions/lock-board@v1.1
with:
lock: false
all_owned: true
#----------------------------------------------------------------------------------------------
# Save test reports
- uses: actions/upload-artifact@v3
if: failure()
with:
name: failure-report
path: ${{ env.RESULTS_DIR }}
- name: Clean up
if: always()
run: |
git clean -ffdx
git reset --hard