forked from Infineon/TLE5012-Magnetic-Angle-Sensor
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (111 loc) · 4.26 KB
/
arduino_ci.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
name: Arduino CI
# on which event should we start push, pullrequest or schedule dispatches
on:
- push
- pull_request
jobs:
build:
# we run this on selhosted runner, use labels to be more specific
runs-on:
- self-hosted
- X64
- Linux
strategy:
matrix:
# List of all examples in the lib to compile
example: [
examples/E9000SPC,
examples/readAngleSpeedRevolutions,
examples/readAngleTest,
examples/readAngleValueProcessing,
examples/readMultipleRegisters,
examples/readSpeedProcessing,
examples/sensorRegisters,
examples/sensorType,
examples/testSensorMainValues,
examples/useMultipleSensors,
examples/writeRegisters
]
# board packages we want to run
platform: [
"arduino:avr",
"infineon:xmc"
]
include:
- fqbn: arduino:avr:uno
platform: "arduino:avr"
- fqbn: Infineon:xmc:XMC1100_XMC2GO
platform: "infineon:xmc"
- fqbn: Infineon:xmc:XMC4700_Relax_Kit
platform: "infineon:xmc"
steps:
- name: Checkout actions
uses: actions/checkout@v4
- name: Setup Arduino CLI
uses: arduino/setup-arduino-cli@master
# setup links inside the selfhosted runner for correct directory setup
- name: Set and check environment, install repos
run: |
export REPO="$(basename "$GITHUB_REPOSITORY")"
ln -sfn /opt/XMC-for-Arduino ~/.arduino15/packages/Infineon
mkdir -p "$HOME/Arduino/libraries"
ln -sf $GITHUB_WORKSPACE/ $HOME/Arduino/libraries/$REPO
# Update the arduino code. Attention this does not setup XMC packages as this are set inside the selfhosted runner
- name: Install/Update Arduino Platform
run: |
arduino-cli core update-index
arduino-cli core install ${{ matrix.platform }}
- name: Compile Sketch
run: |
arduino-cli compile --fqbn ${{ matrix.fqbn }} --libraries="." --libraries="$HOME/Arduino/libraries/." ${{ matrix.example }}
deploy:
needs: build
runs-on:
- self-hosted
- X64
- Linux
strategy:
max-parallel: 1
matrix:
# Samples to flash
example: [
examples/sensorType,
examples/readAngleTest,
]
# board packages we want to run and flash
platform: [
"infineon:xmc"
]
# for flashig we need the port_name, see board2port.yaml
include:
- platform: "infineon:xmc"
fqbn: Infineon:xmc:XMC1100_XMC2GO
port_name: infineon.xmc.XMC1100_XMC2GO.magnetic-angle-sensor.port_serial.0
device: infineon.xmc.XMC1100_XMC2GO.magnetic-angle-sensor.device.0
steps:
- name: Checkout action
uses: actions/checkout@v4
- name: Setup Arduino CLI
uses: arduino/setup-arduino-cli@master
- name: Compile Sketch
run: |
export REPO="$(basename "$GITHUB_REPOSITORY")"
ln -sfn /opt/XMC-for-Arduino ~/.arduino15/packages/Infineon
mkdir -p "$HOME/Arduino/libraries"
ln -sf $GITHUB_WORKSPACE/ $HOME/Arduino/libraries/$REPO
arduino-cli compile --fqbn ${{ matrix.fqbn }} --libraries="." --libraries="$HOME/Arduino/libraries/." ${{ matrix.example }} --export-binaries
- name: Deploy
run: |
cd /opt/runner_support/
export SERIAL_NUM=`cat ./board2port.yaml | shyaml get-value ${{ matrix.port_name}}`
export DEVICE=`cat ./board2port.yaml | shyaml get-value ${{ matrix.device}}`
export PORT=`./find_usb.sh $SERIAL_NUM`
export REPO="$(basename "$GITHUB_REPOSITORY")"
export HEXNAME=`tr ':' '.' <<<"${{ matrix.fqbn }}"`
echo "Port Serial Num: ".$SERIAL_NUM
echo "Port found: ".$PORT
echo "Flash device: ".$DEVICE
echo "Repo name extracted: ".$REPO
echo "Build HEX name: ".$HEXNAME
cd $HOME
python $HOME/.arduino15/packages/Infineon/hardware/xmc/3.0.0/tools/xmc-flasher.py upload -d $DEVICE -p $PORT -f $HOME/Arduino/libraries/$REPO/${{ matrix.example }}/build/$HEXNAME/*.hex