-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (130 loc) · 5.94 KB
/
hil_unity_checks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Hil unity library checks
# on which event should we start push, pull request or schedule dispatches
on:
- push
- pull_request
env:
TEST_VERSION: 1.0.0
jobs:
# The build job compiles the sample code for different boards
tests:
#############################################################################
# This action sets common variables for the flow and
# identifies the libs to compile
runs-on:
- self-hosted
- X64
- Linux
- PSoC
# which combination of sample code and boards should run
# for this example of 2 sample codes and 3 boards a total of 2x3=6 runners have to work.
# if we have only 4 runner then these 4 are started and the last 2 are waiting until they can start
strategy:
matrix:
# List of all examples in the lib to compile
example: [
examples/testSketch/testSketch.ino
]
# board packages we want to run
# attention the matrix spans over the fqbn not platform so that we can choose different boards
# this example compiles each sample code for Arduino Uno, XMC2Go and XMC4700 boards
fqbn: [
"infineon:psoc:cy8ckit_062s2_ai"
]
# include additional information for each fqbn, in this case the platform name to install
include:
- fqbn: "infineon:psoc:cy8ckit_062s2_ai"
platform: "infineon:psoc"
# These are the steps which should run for each combination of fqbn and example code
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-tags: true
fetch-depth: 0
- name: Checkout arduino-devops
uses: actions/checkout@v4
with:
repository: Infineon/arduino-devops
ref: latest
path: arduino-devops
- name: Pack Arduino core
run: |
python ./arduino-devops/arduino-packager.py --no-version-check --no-previous-releases
- name: Install Arduino core
run: |
python ./arduino-devops/pckg-install-local.py --pckg-dir build --verbose
- name: Remove latest installed platform version
run: |
cd ~/.arduino15/packages/infineon/hardware/psoc
rm -rf *
- name: copy/link repository to arduino path
run: |
mkdir ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION
cp -a ./* ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION
cd ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION
- name: copy/link arduino core api path
run: |
mkdir ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION/cores/psoc/api
cp -a ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION/extras/arduino-core-api/api/* ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION/cores/psoc/api
# Fetch variables and move them to the GITHUB_OUTPUT and fetch HIL information
- id: startup
run: |
# switch on the HIL
cd /opt/runner_support/
# set the hil-unity-checks
hil=$(./py_checkusb.py --readyaml ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION/tests/hil-unity-checklist.yaml --json)
echo "hil=${hil}" >> $GITHUB_OUTPUT
echo "hil=${hil}"
# fetch unity libraries
readarray -t data < <(echo $hil | jq -r '.|keys[]')
export dev=$(jq --compact-output --null-input '$ARGS.positional' --args -- "${data[@]}")
echo "devices=${dev}" >> $GITHUB_OUTPUT
echo "devices=${dev}"
# setup environment
- name: Environment
run: |
hil=${{ toJson(steps.startup.outputs.hil) }}
REPO="$(basename "$GITHUB_REPOSITORY")"
DEVICE=${{ steps.startup.outputs.devices }}
DEVICE=$(echo $DEVICE | tr -d '[]')
FQBN=$(echo $DEVICE | tr -d '[]')
DEVICE=`tr ':' '.' <<<"${DEVICE}"`
echo "repo=$REPO" >> $GITHUB_ENV
echo "device=$DEVICE" >> $GITHUB_ENV
echo "version=$TEST_VERSION" >> $GITHUB_ENV
echo "fqbn=$FQBN" >> $GITHUB_ENV
echo "Repo " $REPO
echo "Device " $DEVICE
echo "FQBN " $FQBN
echo "Version " ${TEST_VERSION}
- name: Build
run: |
export TMPDIR=$HOME/tmp
mkdir -p $TMPDIR
rm -rf $HOME/artefact
mkdir -p $HOME/artefact
cd ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION/tests/arduino-core-tests/
echo "=============================================================================================================="
echo "Run Tests"
echo "=============================================================================================================="
make FQBN=${{ env.fqbn }} PORT=/dev/ttyACM0 test_digitalio_single
mkdir -p ~/artefact/unit_tests/${{ env.device }}
mv ./build/* ~/artefact/unit_tests/.
echo "=============================================================================================================="
echo "=============================================================================================================="
echo "Monitor"
timeout 1m \
/opt/runner_support/py_console.py \
--port /dev/ttyACM0 \
--baud 115200 \
--report ~/artefact/unit_tests/${{ env.device }}/report.json
echo "=============================================================================================================="
# Upload the compiled HEX files to the GitHub server
- name: Artefact
uses: actions/upload-artifact@v4
with:
name: ${{ env.device }}
path: ~/artefact/*
if-no-files-found: ignore