Skip to content

Commit 7c0a434

Browse files
WIP.
Signed-off-by: Ramya Subramanyam <[email protected]>
1 parent 4e8b7e2 commit 7c0a434

File tree

2 files changed

+51
-59
lines changed

2 files changed

+51
-59
lines changed
Lines changed: 35 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: Hil unity library checks
1+
name: Hil Unity Library Checks
22

33
# Events triggering the workflow
44
on:
5-
- push
6-
- pull_request
5+
push:
6+
pull_request:
77

88
env:
99
TEST_VERSION: 1.0.0
@@ -15,40 +15,32 @@ jobs:
1515
matrix: ${{ steps.set-test-matrix.outputs.matrix }}
1616

1717
steps:
18-
1918
- name: Checkout repository
2019
uses: actions/checkout@v4
2120

2221
- name: Set test matrix
2322
id: set-test-matrix
2423
run: |
25-
test_matrix=$(cat ./tests/hil-unity-checklist.json)
26-
echo $test_matrix
27-
echo "matrix=$test_matrix" >> $GITHUB_OUTPUT
24+
cat ./tests/hil-unity-checklist.json
25+
matrix=$(jq -c '[.boards[] | { fqbn: .fqbn, single: .tests.single, multi: .tests.multi}]' ./tests/hil-unity-checklist.json)
26+
echo "::set-output name=matrix::$matrix"
2827
2928
tests:
30-
3129
needs: set-test-matrix
3230
runs-on:
3331
- self-hosted
3432
- X64
3533
- Linux
3634
- PSoC
3735

38-
# which combination of sample code and boards should run
39-
# for this example of 2 sample codes and 3 boards a total of 2x3=6 runners have to work.
40-
# if we have only 4 runner then these 4 are started and the last 2 are waiting until they can start
4136
strategy:
42-
matrix: ${{fromJson(needs.set-test-matrix.outputs.matrix)}}
37+
matrix:
38+
include: ${{ fromJson(needs.set-test-matrix.outputs.matrix) }}
4339

44-
45-
# These are the steps which should run for each combination of fqbn and example code
4640
steps:
47-
48-
- name: Checkout repository
41+
- name: Checkout repository
4942
uses: actions/checkout@v4
5043
with:
51-
token: ${{ secrets.UNITY_TOKEN }}
5244
submodules: true
5345
fetch-tags: true
5446
fetch-depth: 0
@@ -60,16 +52,14 @@ jobs:
6052
ref: latest
6153
path: arduino-devops
6254

63-
- name: Install arduino-cli
64-
# TODO: We need to find a way to install the arduino-cli for multiple OS
65-
# without the need of containers
66-
run: |
67-
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh -s 1.1.0
68-
sudo mv bin/arduino-cli /usr/local/bin/arduino-cli
69-
arduino-cli version
55+
# - name: Install arduino-cli
56+
# run: |
57+
# curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh -s 1.1.0
58+
# sudo mv bin/arduino-cli /usr/local/bin/arduino-cli
59+
# arduino-cli version
7060

7161
- name: Core setup
72-
if : ${{ inputs.setup-script }} != null
62+
if: ${{ inputs.setup-script }} != ''
7363
run: |
7464
${{ inputs.setup-script }}
7565
@@ -88,27 +78,27 @@ jobs:
8878
8979
- name: copy/link repository to arduino path
9080
run: |
91-
mkdir ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION
81+
mkdir -p ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION
9282
cp -a ./* ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION
9383
cd ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION
9484
9585
- name: copy/link arduino core api path
9686
run: |
97-
mkdir ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION/cores/psoc/api
87+
mkdir -p ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION/cores/psoc/api
9888
cp -a ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION/extras/arduino-core-api/api/* ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION/cores/psoc/api
9989
100-
- name: check ports
90+
- name: Check ports
10191
run: |
10292
cd /opt/runner_support/
10393
readarray -t SERIALS < <(echo $(./py_checkusb.py --type ${LIB} --json) | jq ".\"${LIB}\".\"${{ env.device }}\"|keys[]" -r)
10494
105-
# check if we have one or more serial numbers for this lib or stop here
95+
# Check if we have one or more serial numbers for this lib or stop here
10696
if [[ -z $SERIALS ]]; then
10797
echo "No serial or library information found"
10898
exit 0
10999
fi
110100
111-
# loop over all serials and fetch the ports
101+
# Loop over all serials and fetch the ports
112102
declare -a PORTS
113103
for SERIAL in "${SERIALS[@]}"; do
114104
PORTS+=($(/opt/runner_support/find_usb.sh $SERIAL))
@@ -124,26 +114,24 @@ jobs:
124114
echo "=============================================================================================================="
125115
echo "Run Tests"
126116
echo "=============================================================================================================="
127-
make FQBN=${{ matrix.fqbn }} PORT=${PORTS[0]} ${{ matrix.tests.single }}
128-
mkdir -p ~/artefact/unit_tests/${{ matrix.tests.single }}
129-
mv ./build/* ~/artefact/unit_tests/.
130-
echo "=============================================================================================================="
131-
132-
echo "=============================================================================================================="
133-
echo "Monitor"
134-
timeout 1m \
135-
/opt/runner_support/py_console.py \
136-
--port ${PORTS[0]} \
137-
--baud 115200 \
138-
--report ~/artefact/unit_tests/${{ matrix.tests.single }}/report.json
139-
140-
echo "=============================================================================================================="
117+
for test in ${{ matrix.single }}; do
118+
make FQBN=${{ matrix.fqbn }} PORT=${PORTS[0]} $test
119+
mkdir -p ~/artefact/unit_tests/$test
120+
mv ./build/* ~/artefact/unit_tests/.
121+
echo "=============================================================================================================="
122+
echo "Monitor"
123+
timeout 1m \
124+
/opt/runner_support/py_console.py \
125+
--port ${PORTS[0]} \
126+
--baud 115200 \
127+
--report ~/artefact/unit_tests/$test/report.json
128+
echo "=============================================================================================================="
129+
done
141130
142-
143131
# Upload the compiled HEX files to the GitHub server
144132
- name: Artefact
145133
uses: actions/upload-artifact@v4
146134
with:
147-
name: ${{ matrix.tests.single }}
135+
name: ${{ matrix.fqbn }}
148136
path: ~/artefact/*
149-
if-no-files-found: ignore
137+
if-no-files-found: ignore

tests/hil-unity-checklist.json

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
{
2-
"fqbn": "infineon:psoc:cy8ckit_062s2_ai",
3-
"tests": {
4-
"single": [
5-
"test_digitalio_single",
6-
"test_time_single"
7-
],
8-
"multi": {
9-
"uart": [
10-
"test_uart_connected2_tx",
11-
"test_uart_connected2_rx"
12-
]
2+
"boards": [
3+
{
4+
"fqbn": "infineon:psoc:cy8ckit_062s2_ai",
5+
"tests": {
6+
"single": [
7+
"test_digitalio_single",
8+
"test_time_single"
9+
],
10+
"multi": {
11+
"uart": [
12+
"test_uart_connected2_tx",
13+
"test_uart_connected2_rx"
14+
]
15+
}
16+
}
1317
}
14-
}
18+
]
1519
}

0 commit comments

Comments
 (0)