Skip to content

Commit 187e57d

Browse files
authored
Merge pull request #1724 from hathach/add-self-host
Add self host
2 parents a97f6a4 + 030b50d commit 187e57d

File tree

6 files changed

+119
-22
lines changed

6 files changed

+119
-22
lines changed

.github/workflows/build_aarch64.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ jobs:
2121
- 'broadcom_64bit'
2222
steps:
2323
- name: Setup Python
24-
uses: actions/setup-python@v2
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: '3.x'
2527

2628
- name: Checkout TinyUSB
2729
uses: actions/checkout@v3

.github/workflows/build_arm.yml

Lines changed: 90 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ jobs:
6565
- 'xmc4000'
6666
steps:
6767
- name: Setup Python
68-
uses: actions/setup-python@v3
68+
uses: actions/setup-python@v4
69+
with:
70+
python-version: '3.x'
6971

7072
- name: Install ARM GCC
7173
uses: carlosperate/arm-none-eabi-gcc-action@v1
@@ -99,11 +101,26 @@ jobs:
99101
- name: Linker Map
100102
run: |
101103
pip install linkermap/
102-
for ex in `ls -d examples/device/*/`; do \
103-
find ${ex} -name *.map -print -quit | \
104-
xargs -I % sh -c 'echo "::group::%"; linkermap -v %; echo "::endgroup::"'; \
104+
# find -quit to only print linkermap of 1 board per example
105+
for ex in `ls -d examples/*/*/`
106+
do
107+
find ${ex} -name *.map -print -quit | xargs -I % sh -c 'echo "::group::%"; linkermap -v %; echo "::endgroup::"'
105108
done
106109
110+
# Following steps are for Hardware Test with self-hosted
111+
112+
- name: Prepare Artifacts
113+
if: matrix.family == 'rp2040' && github.repository_owner == 'hathach'
114+
run: find examples/ -name "*.elf" -exec mv {} . \;
115+
116+
- name: Upload Artifacts for Hardware Test
117+
if: matrix.family == 'rp2040' && github.repository_owner == 'hathach'
118+
uses: actions/upload-artifact@v3
119+
with:
120+
name: ${{ matrix.family }}
121+
path: |
122+
*.elf
123+
107124
# ---------------------------------------
108125
# Build all no-family (orphaned) boards
109126
# ---------------------------------------
@@ -122,7 +139,9 @@ jobs:
122139

123140
steps:
124141
- name: Setup Python
125-
uses: actions/setup-python@v3
142+
uses: actions/setup-python@v4
143+
with:
144+
python-version: '3.x'
126145

127146
- name: Install ARM GCC
128147
uses: carlosperate/arm-none-eabi-gcc-action@v1
@@ -137,3 +156,69 @@ jobs:
137156

138157
- name: Build
139158
run: python3 tools/build_board.py ${{ matrix.example }}
159+
160+
# ---------------------------------------
161+
# Hardware in the loop (HIL)
162+
# Current self-hosted instance is running on an RPI4 with
163+
# - pico + pico-probe connected via USB
164+
# - pico-probe is /dev/ttyACM0
165+
# ---------------------------------------
166+
hw-test:
167+
# Limit the run to only hathach due to limited resource on RPI4
168+
if: github.repository_owner == 'hathach'
169+
needs: build-arm
170+
runs-on: [self-hosted, Linux, ARM64]
171+
172+
steps:
173+
- name: Clean workspace
174+
run: |
175+
echo "Cleaning up previous run"
176+
rm -rf "${{ github.workspace }}"
177+
mkdir -p "${{ github.workspace }}"
178+
179+
- name: Download rp2040 Artifacts
180+
uses: actions/download-artifact@v3
181+
with:
182+
name: rp2040
183+
184+
- name: Create flash.sh
185+
run: |
186+
touch flash.sh
187+
chmod +x flash.sh
188+
echo > flash.sh 'openocd -f "interface/picoprobe.cfg" -f "target/rp2040.cfg" -c "program $1 reset exit"'
189+
190+
- name: Test cdc_dual_ports
191+
run: |
192+
./flash.sh cdc_dual_ports.elf
193+
while (! ([ -e /dev/ttyACM1 ] && [ -e /dev/ttyACM2 ])) && [ $SECONDS -le 5 ]; do :; done
194+
test -e /dev/ttyACM1 && echo "ttyACM1 exists"
195+
test -e /dev/ttyACM2 && echo "ttyACM2 exists"
196+
197+
- name: Test cdc_msc
198+
run: |
199+
./flash.sh cdc_msc.elf
200+
readme='/media/pi/TinyUSB MSC/README.TXT'
201+
while (! ([ -e /dev/ttyACM1 ] && [ -f "$readme" ])) && [ $SECONDS -le 5 ]; do :; done
202+
test -e /dev/ttyACM1 && echo "ttyACM1 exists"
203+
test -f "$readme" && echo "$readme exists"
204+
cat "$readme"
205+
206+
- name: Test dfu
207+
run: |
208+
./flash.sh dfu.elf
209+
while (! (dfu-util -l | grep "Found DFU")) && [ $SECONDS -le 5 ]; do :; done
210+
dfu-util -d cafe -a 0 -U dfu0
211+
dfu-util -d cafe -a 1 -U dfu1
212+
grep "TinyUSB DFU! - Partition 0" dfu0
213+
grep "TinyUSB DFU! - Partition 1" dfu1
214+
215+
- name: Test dfu_runtime
216+
run: |
217+
./flash.sh dfu_runtime.elf
218+
while (! (dfu-util -l | grep "Found Runtime")) && [ $SECONDS -le 5 ]; do :; done
219+
220+
# - name: Test hid_boot_interface
221+
# run: |
222+
# ./flash.sh hid_boot_interface.elf
223+
# while (! (dfu-util -l | grep "Found Runtime")) && [ $SECONDS -le 5 ]; do :; done
224+

.github/workflows/build_esp.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ jobs:
2323

2424
steps:
2525
- name: Setup Python
26-
uses: actions/setup-python@v2
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: '3.x'
2729

2830
- name: Pull ESP-IDF docker
2931
run: docker pull espressif/idf:latest
@@ -43,7 +45,8 @@ jobs:
4345
- name: Linker Map
4446
run: |
4547
pip install linkermap/
46-
for ex in `ls -d examples/device/*/`; do \
47-
find ${ex} -maxdepth 3 -name *.map -print -quit | \
48-
xargs -I % sh -c 'echo "::group::%"; linkermap -v %; echo "::endgroup::"'; \
48+
# find -quit to only print linkermap of 1 board per example
49+
for ex in `ls -d examples/device/*/`
50+
do
51+
find ${ex} -maxdepth 3 -name *.map -print -quit | xargs -I % sh -c 'echo "::group::%"; linkermap -v %; echo "::endgroup::"'
4952
done

.github/workflows/build_msp430.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- 'msp430'
1919
steps:
2020
- name: Setup Python
21-
uses: actions/setup-python@v2
21+
uses: actions/setup-python@v4
2222

2323
- name: Checkout TinyUSB
2424
uses: actions/checkout@v3
@@ -61,7 +61,8 @@ jobs:
6161
- name: Linker Map
6262
run: |
6363
pip install linkermap/
64-
for ex in `ls -d examples/device/*/`; do \
65-
find ${ex} -name *.map -print -quit | \
66-
xargs -I % sh -c 'echo "::group::%"; linkermap -v %; echo "::endgroup::"'; \
64+
# find -quit to only print linkermap of 1 board per example
65+
for ex in `ls -d examples/device/*/`
66+
do
67+
find ${ex} -name *.map -print -quit | xargs -I % sh -c 'echo "::group::%"; linkermap -v %; echo "::endgroup::"'
6768
done

.github/workflows/build_renesas.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ jobs:
1818
- 'rx'
1919
steps:
2020
- name: Setup Python
21-
uses: actions/setup-python@v2
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: '3.x'
2224

2325
- name: Checkout TinyUSB
2426
uses: actions/checkout@v3
@@ -62,7 +64,8 @@ jobs:
6264
- name: Linker Map
6365
run: |
6466
pip install linkermap/
65-
for ex in `ls -d examples/device/*/`; do \
66-
find ${ex} -name *.map -print -quit | \
67-
xargs -I % sh -c 'echo "::group::%"; linkermap -v %; echo "::endgroup::"'; \
67+
# find -quit to only print linkermap of 1 board per example
68+
for ex in `ls -d examples/device/*/`
69+
do
70+
find ${ex} -name *.map -print -quit | xargs -I % sh -c 'echo "::group::%"; linkermap -v %; echo "::endgroup::"'
6871
done

.github/workflows/build_riscv.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ jobs:
1919
- 'gd32vf103'
2020
steps:
2121
- name: Setup Python
22-
uses: actions/setup-python@v2
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: '3.x'
2325

2426
- name: Checkout TinyUSB
2527
uses: actions/checkout@v3
@@ -62,7 +64,8 @@ jobs:
6264
- name: Linker Map
6365
run: |
6466
pip install linkermap/
65-
for ex in `ls -d examples/device/*/`; do \
66-
find ${ex} -name *.map -print -quit | \
67-
xargs -I % sh -c 'echo "::group::%"; linkermap -v %; echo "::endgroup::"'; \
67+
# find -quit to only print linkermap of 1 board per example
68+
for ex in `ls -d examples/device/*/`
69+
do
70+
find ${ex} -name *.map -print -quit | xargs -I % sh -c 'echo "::group::%"; linkermap -v %; echo "::endgroup::"'
6871
done

0 commit comments

Comments
 (0)