Merge branch 'master' of ../Arduino-Helpers #195
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Examples | |
on: push | |
jobs: | |
compile-examples: | |
name: Examples | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
board: [AVR, Nano 33 BLE, Pi Pico, Pi Pico W, Nano 33 IoT, UNO R4, ESP32, ESP32-S3, ESP8266, AVR USB, Mega, Leonardo, Due, Nano Every, Teensy 3.x, Teensy 4.1] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Cache Arduino CLI | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.local/bin | |
key: ${{ runner.os }}-local-bin-v2 | |
- name: Cache Arduino Cores and Libraries | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.arduino15 | |
~/Arduino/libraries | |
key: ${{ runner.os }}-arduino-v3-${{ github.sha }} | |
restore-keys: ${{ runner.os }}-arduino-v3- | |
- name: Cache Compiled Arduino Cores and Sketches | |
uses: actions/cache@v3 | |
with: | |
path: | | |
/tmp/arduino-sketch-* | |
/tmp/core-* | |
key: ${{ runner.os }}-arduino-compiled-v3-${{ matrix.board }}-${{ github.sha }} | |
restore-keys: ${{ runner.os }}-arduino-compiled-v3-${{ matrix.board }}- | |
- name: Update $PATH | |
run: echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Install Arduino CLI | |
run: | | |
mkdir -p "$HOME/.local/bin" | |
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR="$HOME/.local/bin" sh | |
mkdir -p "$HOME/.arduino15" | |
cp "$GITHUB_WORKSPACE/tools/arduino-cli.yaml" "$HOME/.arduino15" | |
arduino-cli core update-index | |
- name: Install Arduino Boards | |
run: | | |
arduino-cli core install arduino:avr arduino:mbed_nano arduino:mbed_rp2040 arduino:samd esp32:esp32 esp8266:esp8266 arduino:sam arduino:megaavr arduino:renesas_uno teensy:avr rp2040:rp2040 | |
arduino-cli core upgrade | |
arduino-cli cache clean | |
version=$(arduino-cli core list | grep 'teensy:avr' | awk '{print $2}') && { sed -i 's/^recipe.hooks.postbuild/# recipe.hooks.postbuild/g' $HOME/.arduino15/packages/teensy/hardware/avr/$version/platform.txt ||:; } | |
- name: Install Arduino Libraries | |
run: | | |
mkdir -p "$HOME/Arduino/libraries" && cd "$_" | |
[ -d Adafruit-GFX-Library ] || git clone https://github.com/adafruit/Adafruit-GFX-Library.git --depth=1 & | |
[ -d Adafruit_SSD1306 ] || git clone https://github.com/adafruit/Adafruit_SSD1306.git --depth=1 & | |
[ -d Adafruit_BusIO ] || git clone https://github.com/adafruit/Adafruit_BusIO.git --depth=1 & | |
[ -d FastLED ] || git clone https://github.com/FastLED/FastLED.git --depth=1 & | |
[ -d MIDIUSB ] || git clone https://github.com/arduino-libraries/MIDIUSB.git --depth=1 & | |
[ -d Audio ] || git clone https://github.com/PaulStoffregen/Audio.git --depth=1 & | |
[ -d ArduinoBLE ] || git clone https://github.com/arduino-libraries/ArduinoBLE.git --depth=1 & | |
[ -d Arduino-AppleMIDI-Library ] || git clone https://github.com/lathoub/Arduino-AppleMIDI-Library.git --depth=1 --branch v3.2.0 & | |
[ -d arduino_midi_library ] || git clone https://github.com/FortySevenEffects/arduino_midi_library.git --depth=1 & | |
ln -snf "$GITHUB_WORKSPACE" "$HOME/Arduino/libraries/" | |
cp "$GITHUB_WORKSPACE/examples/3. MIDI Interfaces/AppleMIDI/WiFi-Credentials.example.h" "$GITHUB_WORKSPACE/examples/3. MIDI Interfaces/AppleMIDI/WiFi-Credentials.h" | |
- name: Cache Python Packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.venv | |
key: ${{ runner.os }}-python-venv-v2-${{ github.sha }} | |
restore-keys: ${{ runner.os }}-python-venv-v2- | |
- name: Install Python Packages | |
run: | | |
[ -d "$HOME/.venv" ] || python3 -m venv "$HOME/.venv" | |
source "$HOME/.venv/bin/activate" | |
python3 -m pip install -U pyyaml pyserial | |
- name: Compile Examples | |
run: | | |
source "$HOME/.venv/bin/activate" | |
python3 "$GITHUB_WORKSPACE/tools/arduino-example-builder.py" "${{ matrix.board }}" --examples_dir "$GITHUB_WORKSPACE/examples" |