diff --git a/.github/workflows/hello_world.yml b/.github/workflows/hello_world.yml new file mode 100644 index 00000000000..c36a965db83 --- /dev/null +++ b/.github/workflows/hello_world.yml @@ -0,0 +1,83 @@ +############################################################################### +# +# 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: Hello World 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: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + pull_request: + branches: ["main"] +env: + TEST_DIR: tests + MAX32655: max32655_board_B38 + +jobs: + ActionTest: + # 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 + ref: main + fetch-depth: 0 + - uses: actions/checkout@v4 + - name: Debug + run: ls + + - name: Lock + uses: Analog-Devices-MSDK/btm-ci-scripts/actions/lock-board@v1.1 + with: + boards: | + ${{ env.MAX32655 }} + lock: true + + - name: Flash + uses: Analog-Devices-MSDK/btm-ci-scripts/actions/ocdflash@v1.1 + with: + board: | + ${{ env.MAX32655 }} + project: Hello_World + msdk_path: ${{ github.workspace }} + build: true + + - name: Test + run: | + + cd tests + python3 hello_world_test.py + exit $? + + - name: Unlock + if: always() + uses: Analog-Devices-MSDK/btm-ci-scripts/actions/lock-board@v1.1 + with: + all_owned: true + lock: false diff --git a/.github/workflows/scripts/hello_world_test.py b/.github/workflows/scripts/hello_world_test.py new file mode 100644 index 00000000000..769d91a54d9 --- /dev/null +++ b/.github/workflows/scripts/hello_world_test.py @@ -0,0 +1,30 @@ +import serial +import argparse +import sys +import time +from resource_manager import ResourceManager + +if __name__== "__main__": + parser = argparse.ArgumentParser(description='Script to verif Hello world output') + parser.add_argument('board', help='Board to test Hello World on') + args = parser.parse_args() + + board = args.board + rman = ResourceManager() + + + + port = rman.get_item_value(f'{board}.console_port') + port = serial.Serial(port) + + rman.resource_reset(board) + time.sleep(5) + + text = port.read_all().decode('utf-8') + + + text_lower = text.lower() + if 'count' in text_lower and "hello" in text_lower: + sys.exit(0) + else: + sys.exit(-1)