Skip to content

Commit

Permalink
add wf
Browse files Browse the repository at this point in the history
  • Loading branch information
EricB-ADI committed Aug 15, 2024
1 parent 3c1cf09 commit a40c628
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/hello_world.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
boards: |
${{ env.MAX32655 }}
lock: true

- name: Flash
uses: Analog-Devices-MSDK/btm-ci-scripts/actions/[email protected]
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/[email protected]
with:
all_owned: true
lock: false
30 changes: 30 additions & 0 deletions .github/workflows/scripts/hello_world_test.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit a40c628

Please sign in to comment.