Skip to content

Commit b311699

Browse files
andrewdaladyada
authored andcommitted
Allow custom installation (espressif#43)
* Allow user to customize installation * Add documentation about INSTALL_PLATFORMS
1 parent b874c11 commit b311699

File tree

2 files changed

+46
-21
lines changed

2 files changed

+46
-21
lines changed

Diff for: README.md

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ You will need to source the script in the `before_install` step of your
1616
source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh)
1717
```
1818

19+
If you only want to install and build on certain platforms, you can set the
20+
`INSTALL_PLATFORMS` envionrment variable to a comma-seperated list of platforms.
21+
1922
**Example `.travis.yml`:**
2023
```
2124
language: c

Diff for: install.sh

+43-21
Original file line numberDiff line numberDiff line change
@@ -93,33 +93,55 @@ rm -rf ~/.arduino15/packages/esp32
9393
echo -n "Current packages list:"
9494
ls ~/.arduino15/packages/
9595

96-
echo -n "ESP32: "
97-
DEPENDENCY_OUTPUT=$(arduino --install-boards esp32:esp32 2>&1)
98-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
96+
INSTALL_ESP32=$([[ $INSTALL_PLATFORMS == *"esp32"* || -z "$INSTALL_PLATFORMS" ]] && echo 1 || echo 0)
97+
INSTALL_DUE=$([[ $INSTALL_PLATFORMS == *"due"* || -z "$INSTALL_PLATFORMS" ]] && echo 1 || echo 0)
98+
INSTALL_ZERO=$([[ $INSTALL_PLATFORMS == *"zero"* || -z "$INSTALL_PLATFORMS" ]] && echo 1 || echo 0)
99+
INSTALL_ESP8266=$([[ $INSTALL_PLATFORMS == *"esp8266"* || -z "$INSTALL_PLATFORMS" ]] && echo 1 || echo 0)
100+
INSTALL_AVR=$([[ $INSTALL_PLATFORMS == *"avr"* || -z "$INSTALL_PLATFORMS" ]] && echo 1 || echo 0)
101+
INSTALL_SAMD=$([[ $INSTALL_PLATFORMS == *"samd"* || -z "$INSTALL_PLATFORMS" ]] && echo 1 || echo 0)
102+
INSTALL_NRF52=$([[ $INSTALL_PLATFORMS == *"nrf52"* || -z "$INSTALL_PLATFORMS" ]] && echo 1 || echo 0)
103+
104+
if [[ $INSTALL_ESP32 == 1 ]]; then
105+
echo -n "ESP32: "
106+
DEPENDENCY_OUTPUT=$(arduino --install-boards esp32:esp32 2>&1)
107+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
108+
fi
99109

100-
echo -n "DUE: "
101-
DEPENDENCY_OUTPUT=$(arduino --install-boards arduino:sam 2>&1)
102-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
110+
if [[ $INSTALL_DUE == 1 ]]; then
111+
echo -n "DUE: "
112+
DEPENDENCY_OUTPUT=$(arduino --install-boards arduino:sam 2>&1)
113+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
114+
fi
103115

104-
echo -n "ZERO: "
105-
DEPENDENCY_OUTPUT=$(arduino --install-boards arduino:samd 2>&1)
106-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
116+
if [[ $INSTALL_ZERO == 1 ]]; then
117+
echo -n "ZERO: "
118+
DEPENDENCY_OUTPUT=$(arduino --install-boards arduino:samd 2>&1)
119+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
120+
fi
107121

108-
echo -n "ESP8266: "
109-
DEPENDENCY_OUTPUT=$(arduino --install-boards esp8266:esp8266 2>&1)
110-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
122+
if [[ $INSTALL_ESP8266 == 1 ]]; then
123+
echo -n "ESP8266: "
124+
DEPENDENCY_OUTPUT=$(arduino --install-boards esp8266:esp8266 2>&1)
125+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
126+
fi
111127

112-
echo -n "ADAFRUIT AVR: "
113-
DEPENDENCY_OUTPUT=$(arduino --install-boards adafruit:avr 2>&1)
114-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
128+
if [[ $INSTALL_AVR == 1 ]]; then
129+
echo -n "ADAFRUIT AVR: "
130+
DEPENDENCY_OUTPUT=$(arduino --install-boards adafruit:avr 2>&1)
131+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
132+
fi
115133

116-
echo -n "ADAFRUIT SAMD: "
117-
DEPENDENCY_OUTPUT=$(arduino --install-boards adafruit:samd 2>&1)
118-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
134+
if [[ $INSTALL_SAMD == 1 ]]; then
135+
echo -n "ADAFRUIT SAMD: "
136+
DEPENDENCY_OUTPUT=$(arduino --install-boards adafruit:samd 2>&1)
137+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
138+
fi
119139

120-
echo -n "ADAFRUIT NRF5X: "
121-
DEPENDENCY_OUTPUT=$(arduino --install-boards adafruit:nrf52 2>&1)
122-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
140+
if [[ $INSTALL_NRF52 == 1 ]]; then
141+
echo -n "ADAFRUIT NRF5X: "
142+
DEPENDENCY_OUTPUT=$(arduino --install-boards adafruit:nrf52 2>&1)
143+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
144+
fi
123145

124146
# install random lib so the arduino IDE grabs a new library index
125147
# see: https://github.com/arduino/Arduino/issues/3535

0 commit comments

Comments
 (0)