Skip to content

Commit fd4f7bb

Browse files
Add TinyUSB examples to CI (#163)
1 parent 77eae66 commit fd4f7bb

File tree

6 files changed

+86
-14
lines changed

6 files changed

+86
-14
lines changed

.github/workflows/pull-request.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99

1010
jobs:
1111

12+
# Me no spell so good
1213
code-spell:
1314
name: Check spelling
1415
runs-on: ubuntu-latest
@@ -25,13 +26,13 @@ jobs:
2526
skip: ./pico-extras,./ArduinoCore-API,./libraries/SdFat,./libraries/Adafruit_TinyUSB_Arduino,./libraries/LittleFS/lib,./tools/pyserial,./pico-sdk,./.github,./docs/i2s.rst
2627
ignore_words_list: ser,DOUT
2728

28-
29+
# Build all examples on linux (core and Arduino IDE)
2930
build-linux:
3031
name: Build ${{ matrix.chunk }}
3132
runs-on: ubuntu-latest
3233
strategy:
3334
matrix:
34-
chunk: [0, 1, 2, 3, 4, 5, 6, 7]
35+
chunk: [0, 1, 2, 3]
3536
steps:
3637
- uses: actions/checkout@v2
3738
with:
@@ -50,7 +51,7 @@ jobs:
5051
TRAVIS_BUILD_DIR: ${{ github.workspace }}
5152
TRAVIS_TAG: ${{ github.ref }}
5253
BUILD_PARITY: custom
53-
mod: 8
54+
mod: 4
5455
rem: ${{ matrix.chunk }}
5556
run: |
5657
cd pico-sdk
@@ -60,6 +61,35 @@ jobs:
6061
cd ..
6162
bash ./tests/build.sh
6263
64+
# Build TinyUSB examples, requires custom build command line
65+
build-tinyusb:
66+
name: Build TinyUSB Examples
67+
runs-on: ubuntu-latest
68+
steps:
69+
- uses: actions/checkout@v2
70+
with:
71+
submodules: true
72+
- uses: actions/setup-python@v2
73+
with:
74+
python-version: '3.x'
75+
- name: Cache Linux toolchain
76+
id: cache-linux
77+
uses: actions/cache@v2
78+
with:
79+
path: ./tools/dist
80+
key: ${{ runner.os }}-${{ hashFiles('package/package_pico_index.template.json', 'tests/common.sh') }}
81+
- name: Build Sketches
82+
env:
83+
TRAVIS_BUILD_DIR: ${{ github.workspace }}
84+
TRAVIS_TAG: ${{ github.ref }}
85+
BUILD_PARITY: custom
86+
run: |
87+
cd pico-sdk
88+
git submodule update --init
89+
cd ../pico-extras
90+
git submodule update --init
91+
cd ..
92+
bash ./tests/build-tinyusb.sh
6393
6494
# Single build under Windows to ensure the Win toolchain is good.
6595
build-windows:

tests/build-tinyusb.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
3+
cache_dir=$(mktemp -d)
4+
5+
source "$TRAVIS_BUILD_DIR"/tests/common.sh
6+
7+
install_arduino nodebug
8+
9+
# Replace the skip function to only build TinyUSB tests
10+
function skip_ino()
11+
{
12+
local ino=$1
13+
local skiplist=""
14+
echo $ino | grep -q Adafruit_TinyUSB_Arduino
15+
if [ $? -eq 0 ]; then
16+
# Add items to the following list with "\n" netween them to skip running. No spaces, tabs, etc. allowed
17+
read -d '' skiplist << EOL || true
18+
/mouse_external_flash/
19+
/hid_keyboard/
20+
/msc_external_flash/
21+
/msc_external_flash_sdcard/
22+
/msc_sdfat/
23+
/msc_sd/
24+
/midi_pizza_box_dj/
25+
/hid_composite_joy_featherwing/
26+
EOL
27+
echo $ino | grep -q -F "$skiplist"
28+
echo $(( 1 - $? ))
29+
else
30+
echo 1
31+
fi
32+
}
33+
build_sketches_with_arduino 1 0 "--usbstack tinyusb"
34+
35+
rm -rf "$cache_dir"
36+

tests/build.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ elif [ "$BUILD_PARITY" = "odd" ]; then
1616
fi
1717

1818
install_arduino nodebug
19-
build_sketches_with_arduino "$mod" "$rem"
19+
build_sketches_with_arduino "$mod" "$rem" ""
2020

2121
rm -rf "$cache_dir"
22-

tests/common.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ function build_sketches()
6565
local build_dir=build.tmp
6666
local build_mod=$4
6767
local build_rem=$5
68+
6869
mkdir -p $build_dir
6970
local build_cmd="python3 tools/build.py -b generic -v -w all -v -k --build_cache $cache_dir -p ./$build_dir $build_arg "
7071
if [ "$WINDOWS" = "1" ]; then
@@ -149,8 +150,13 @@ function install_libraries()
149150
pushd $HOME/Arduino/libraries
150151

151152
# install ArduinoJson library
152-
{ test -r ArduinoJson-v6.11.0.zip || curl --output ArduinoJson-v6.11.0.zip -L https://github.com/bblanchon/ArduinoJson/releases/download/v6.11.0/ArduinoJson-v6.11.0.zip; } && unzip -q ArduinoJson-v6.11.0.zip
153-
153+
{ test -r ArduinoJson-v6.11.0.zip || curl -sS --output ArduinoJson-v6.11.0.zip -L https://github.com/bblanchon/ArduinoJson/releases/download/v6.11.0/ArduinoJson-v6.11.0.zip; } && unzip -qo ArduinoJson-v6.11.0.zip
154+
{ test -r Adafruit_SPIFlash-3.4.1.zip || curl -sS --output Adafruit_SPIFlash-3.4.1.zip -L https://github.com/adafruit/Adafruit_SPIFlash/archive/refs/tags/3.4.1.zip; } && unzip -qo Adafruit_SPIFlash-3.4.1.zip
155+
{ test -r Adafruit_Seesaw-1.4.3.zip || curl -sS --output Adafruit_Seesaw-1.4.3.zip -L https://github.com/adafruit/Adafruit_Seesaw/archive/refs/tags/1.4.3.zip; } && unzip -qo Adafruit_Seesaw-1.4.3.zip
156+
{ test -r Adafruit_BusIO-1.7.3.zip || curl -sS --output Adafruit_BusIO-1.7.3.zip -L https://github.com/adafruit/Adafruit_BusIO/archive/refs/tags/1.7.3.zip; } && unzip -qo Adafruit_BusIO-1.7.3.zip
157+
{ test -r Adafruit_CircuitPlayground-1.11.3.zip || curl -sS --output Adafruit_CircuitPlayground-1.11.3.zip -L https://github.com/adafruit/Adafruit_CircuitPlayground/archive/refs/tags/1.11.3.zip; } && unzip -qo Adafruit_CircuitPlayground-1.11.3.zip
158+
{ test -r Adafruit_NeoPixel-1.8.1.zip || curl -sS --output Adafruit_NeoPixel-1.8.1.zip -L https://github.com/adafruit/Adafruit_NeoPixel/archive/refs/tags/1.8.1.zip; } && unzip -qo Adafruit_NeoPixel-1.8.1.zip
159+
{ test -r Arduino_MIDI_Library-5.0.2.zip || curl -sS --output Arduino_MIDI_Library-5.0.2.zip -L https://github.com/FortySevenEffects/arduino_midi_library/archive/refs/tags/5.0.2.zip; } && unzip -qo Arduino_MIDI_Library-5.0.2.zip
154160
popd
155161
}
156162

@@ -236,11 +242,12 @@ function build_sketches_with_arduino()
236242
{
237243
local build_mod=$1
238244
local build_rem=$2
245+
local build_extra=$3
239246

240247
# Compile sketches
241248
echo -e "travis_fold:start:sketch_test"
242-
build_sketches $HOME/arduino_ide $HOME/arduino_ide/examples "-l $HOME/Arduino/libraries" $build_mod $build_rem
243-
build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR/libraries "-l $HOME/Arduino/libraries" $build_mod $build_rem
249+
build_sketches $HOME/arduino_ide $HOME/arduino_ide/examples "-l $HOME/Arduino/libraries ${build_extra}" $build_mod $build_rem
250+
build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR/libraries "-l $HOME/Arduino/libraries ${build_extra}" $build_mod $build_rem
244251
echo -e "travis_fold:end:sketch_test"
245252

246253
# Generate size report

tests/run_CI_locally.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ while true; do
5353
cat << EOF
5454
Which build?
5555
1. main
56-
2. main + IPv6
56+
2. tinyusb
5757
4. debug even
5858
5. debug odd
5959
6. platformio
@@ -67,7 +67,7 @@ EOF
6767
BUILD_TYPE=""
6868
case "$answer" in
6969
1) BUILD_TYPE=build;;
70-
2) BUILD_TYPE=build6;;
70+
2) BUILD_TYPE=build_tinyusb;;
7171
4) BUILD_TYPE=debug_even;;
7272
5) BUILD_TYPE=debug_odd;;
7373
6) BUILD_TYPE=platformio;;
@@ -99,8 +99,8 @@ elif [ "$BUILD_TYPE" = "debug_even" ]; then
9999
elif [ "$BUILD_TYPE" = "debug_odd" ]; then
100100
BUILD_PARITY=odd tests/debug.sh
101101

102-
elif [ "$BUILD_TYPE" = "build6" ]; then
103-
tests/build6.sh
102+
elif [ "$BUILD_TYPE" = "build_tinyusb" ]; then
103+
tests/build-tinyusb.sh
104104
elif [ "$BUILD_TYPE" = "build6_even" ]; then
105105
BUILD_PARITY=even tests/build6.sh
106106
elif [ "$BUILD_TYPE" = "build6_odd" ]; then

0 commit comments

Comments
 (0)