1
- name : Hil unity library checks
1
+ name : Hil Unity Library Checks
2
2
3
3
# Events triggering the workflow
4
4
on :
5
- - push
6
- - pull_request
5
+ push :
6
+ pull_request :
7
7
8
8
env :
9
9
TEST_VERSION : 1.0.0
@@ -15,40 +15,32 @@ jobs:
15
15
matrix : ${{ steps.set-test-matrix.outputs.matrix }}
16
16
17
17
steps :
18
-
19
18
- name : Checkout repository
20
19
uses : actions/checkout@v4
21
20
22
21
- name : Set test matrix
23
22
id : set-test-matrix
24
23
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"
28
27
29
28
tests :
30
-
31
29
needs : set-test-matrix
32
30
runs-on :
33
31
- self-hosted
34
32
- X64
35
33
- Linux
36
34
- PSoC
37
35
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
41
36
strategy :
42
- matrix : ${{fromJson(needs.set-test-matrix.outputs.matrix)}}
37
+ matrix :
38
+ include : ${{ fromJson(needs.set-test-matrix.outputs.matrix) }}
43
39
44
-
45
- # These are the steps which should run for each combination of fqbn and example code
46
40
steps :
47
-
48
- - name : Checkout repository
41
+ - name : Checkout repository
49
42
uses : actions/checkout@v4
50
43
with :
51
- token : ${{ secrets.UNITY_TOKEN }}
52
44
submodules : true
53
45
fetch-tags : true
54
46
fetch-depth : 0
@@ -60,16 +52,14 @@ jobs:
60
52
ref : latest
61
53
path : arduino-devops
62
54
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
70
60
71
61
- name : Core setup
72
- if : ${{ inputs.setup-script }} != null
62
+ if : ${{ inputs.setup-script }} != ''
73
63
run : |
74
64
${{ inputs.setup-script }}
75
65
@@ -88,27 +78,27 @@ jobs:
88
78
89
79
- name : copy/link repository to arduino path
90
80
run : |
91
- mkdir ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION
81
+ mkdir -p ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION
92
82
cp -a ./* ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION
93
83
cd ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION
94
84
95
85
- name : copy/link arduino core api path
96
86
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
98
88
cp -a ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION/extras/arduino-core-api/api/* ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION/cores/psoc/api
99
89
100
- - name : check ports
90
+ - name : Check ports
101
91
run : |
102
92
cd /opt/runner_support/
103
93
readarray -t SERIALS < <(echo $(./py_checkusb.py --type ${LIB} --json) | jq ".\"${LIB}\".\"${{ env.device }}\"|keys[]" -r)
104
94
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
106
96
if [[ -z $SERIALS ]]; then
107
97
echo "No serial or library information found"
108
98
exit 0
109
99
fi
110
100
111
- # loop over all serials and fetch the ports
101
+ # Loop over all serials and fetch the ports
112
102
declare -a PORTS
113
103
for SERIAL in "${SERIALS[@]}"; do
114
104
PORTS+=($(/opt/runner_support/find_usb.sh $SERIAL))
@@ -124,26 +114,24 @@ jobs:
124
114
echo "=============================================================================================================="
125
115
echo "Run Tests"
126
116
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
141
130
142
-
143
131
# Upload the compiled HEX files to the GitHub server
144
132
- name : Artefact
145
133
uses : actions/upload-artifact@v4
146
134
with :
147
- name : ${{ matrix.tests.single }}
135
+ name : ${{ matrix.fqbn }}
148
136
path : ~/artefact/*
149
- if-no-files-found : ignore
137
+ if-no-files-found : ignore
0 commit comments