Skip to content

Cleanup

Cleanup #1

Workflow file for this run

name: Examples
on: push
jobs:
compile-examples:
name: Examples
runs-on: ubuntu-20.04
strategy:
matrix:
board: [AVR, Nano 33 BLE, Pi Pico, Nano 33 IoT, ESP32, ESP8266, AVR USB, Mega, Leonardo, Due, Nano Every, Teensy 3.x, Teensy 4.1]
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Cache Arduino CLI
uses: actions/[email protected]
with:
path: |
~/.local/bin
key: ${{ runner.os }}-local-bin-v2
- name: Cache Arduino Cores and Libraries
uses: actions/[email protected]
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/[email protected]
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"
which arduino-cli || { 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 teensy:avr
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 ||:; }
version=$(arduino-cli core list | grep 'arduino:mbed_nano' | awk '{print $2}') && { patch "$HOME/.arduino15/packages/arduino/hardware/mbed_nano/$version/cores/arduino/Arduino.h" -i "$GITHUB_WORKSPACE/scripts/patches/ARDUINO_LIB_DISCOVERY_PHASE.patch" ||:; }
- 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 Arduino-AppleMIDI-Library ] || git clone https://github.com/lathoub/Arduino-AppleMIDI-Library.git --depth=1 --branch v3.1.2 &
[ -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/[email protected]
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"