forked from tttapa/Control-Surface
-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (81 loc) · 4.3 KB
/
examples.yaml
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
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"