Skip to content
This repository was archived by the owner on Mar 5, 2026. It is now read-only.

Commit f5b51fa

Browse files
authored
Fix travis (me-no-dev#530)
* Lets try to fix travis * fix paths * missed one path * some more fixes * try with copy? * no log? * Now fix the second sketch
1 parent bde2fce commit f5b51fa

8 files changed

Lines changed: 196 additions & 52 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.vscode
2+
.DS_Store

.travis.yml

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,17 @@
11
sudo: false
2-
language: bash
2+
3+
language: python
4+
python:
5+
- "2.7"
6+
37
os:
48
- linux
59

610
dist:
711
- xenial
812

9-
addons:
10-
apt:
11-
packages:
12-
- xvfb
13-
14-
# services:
15-
# - xvfb
16-
17-
1813
script:
19-
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
20-
# - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -screen 0 1400x900x24 -ac +extension GLX +render;
21-
- export DISPLAY=:1.0
22-
- sleep 3
23-
- ls -l /tmp/*pid
24-
25-
- wget http://downloads.arduino.cc/arduino-1.6.5-linux64.tar.xz
26-
- tar xf arduino-1.6.5-linux64.tar.xz
27-
- mv arduino-1.6.5 $HOME/arduino_ide
28-
- export PATH="$HOME/arduino_ide:$PATH"
29-
- which arduino
30-
- mkdir -p $HOME/Arduino/libraries
31-
- cp -r $TRAVIS_BUILD_DIR $HOME/Arduino/libraries/ESPAsyncWebServer
32-
- git clone https://github.com/bblanchon/ArduinoJson $HOME/Arduino/libraries/ArduinoJson
33-
- git clone https://github.com/me-no-dev/ESPAsyncTCP $HOME/Arduino/libraries/ESPAsyncTCP
34-
- cd $HOME/arduino_ide/hardware
35-
- mkdir esp8266com
36-
- cd esp8266com
37-
- git clone https://github.com/esp8266/Arduino.git esp8266
38-
- cd esp8266/tools
39-
- python get.py
40-
- source $TRAVIS_BUILD_DIR/travis/common.sh
41-
- arduino --board esp8266com:esp8266:generic --save-prefs
42-
- arduino --get-pref sketchbook.path
43-
- build_sketches arduino $HOME/Arduino/libraries/ESPAsyncWebServer esp8266
14+
- bash $TRAVIS_BUILD_DIR/travis/build.sh
4415

4516
notifications:
4617
email:
@@ -51,4 +22,4 @@ notifications:
5122
- https://webhooks.gitter.im/e/60e65d0c78ea0a920347
5223
on_success: change # options: [always|never|change] default: always
5324
on_failure: always # options: [always|never|change] default: always
54-
on_start: false # default: false
25+
on_start: never # options: [always|never|change] default: always

examples/ESP_AsyncFSBrowser/.esp31b.skip

Whitespace-only changes.

examples/ESP_AsyncFSBrowser/ESP_AsyncFSBrowser.ino

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
#include <ESP8266WiFi.h>
2-
#include <ESP8266mDNS.h>
1+
#include <WiFi.h>
2+
#include <ESPmDNS.h>
33
#include <ArduinoOTA.h>
44
#include <FS.h>
5-
#include <Hash.h>
6-
#include <ESPAsyncTCP.h>
5+
#include <SPIFFS.h>
6+
#include <AsyncTCP.h>
77
#include <ESPAsyncWebServer.h>
88
#include <SPIFFSEditor.h>
99

@@ -94,7 +94,6 @@ const char* http_password = "admin";
9494
void setup(){
9595
Serial.begin(115200);
9696
Serial.setDebugOutput(true);
97-
WiFi.hostname(hostName);
9897
WiFi.mode(WIFI_AP_STA);
9998
WiFi.softAP(hostName);
10099
WiFi.begin(ssid, password);
@@ -135,7 +134,7 @@ void setup(){
135134
});
136135
server.addHandler(&events);
137136

138-
server.addHandler(new SPIFFSEditor(http_username,http_password));
137+
server.addHandler(new SPIFFSEditor(SPIFFS, http_username,http_password));
139138

140139
server.on("/heap", HTTP_GET, [](AsyncWebServerRequest *request){
141140
request->send(200, "text/plain", String(ESP.getFreeHeap()));

examples/simple_server/simple_server.ino

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
//
77

88
#include <Arduino.h>
9-
#include <ESP8266WiFi.h>
10-
#include <Hash.h>
11-
#include <ESPAsyncTCP.h>
9+
#include <WiFi.h>
10+
#include <AsyncTCP.h>
1211
#include <ESPAsyncWebServer.h>
1312

1413
AsyncWebServer server(80);
@@ -34,8 +33,6 @@ void setup() {
3433

3534
Serial.print("IP Address: ");
3635
Serial.println(WiFi.localIP());
37-
Serial.print("Hostname: ");
38-
Serial.println(WiFi.hostname());
3936

4037
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
4138
request->send(200, "text/plain", "Hello, world");

travis/build.py

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
#
4+
# build.py — build a sketch using arduino-builder
5+
#
6+
# Wrapper script around arduino-builder which accepts some ESP8266-specific
7+
# options and translates them into FQBN
8+
#
9+
# Copyright © 2016 Ivan Grokhotkov
10+
#
11+
# Permission is hereby granted, free of charge, to any person obtaining a copy
12+
# of this software and associated documentation files (the "Software"), to deal
13+
# in the Software without restriction, including without limitation the rights
14+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15+
# copies of the Software, and to permit persons to whom the Software is
16+
# furnished to do so, subject to the following conditions:
17+
#
18+
# The above copyright notice and this permission notice shall be included in
19+
# all copies or substantial portions of the Software.
20+
#
21+
#
22+
23+
24+
from __future__ import print_function
25+
import sys
26+
import os
27+
import argparse
28+
import subprocess
29+
import tempfile
30+
import shutil
31+
32+
def compile(tmp_dir, sketch, tools_dir, hardware_dir, ide_path, f, args):
33+
cmd = ide_path + '/arduino-builder '
34+
cmd += '-compile -logger=human '
35+
cmd += '-build-path "' + tmp_dir + '" '
36+
cmd += '-tools "' + ide_path + '/tools-builder" '
37+
if args.library_path:
38+
for lib_dir in args.library_path:
39+
cmd += '-libraries "' + lib_dir + '" '
40+
cmd += '-hardware "' + ide_path + '/hardware" '
41+
if args.hardware_dir:
42+
for hw_dir in args.hardware_dir:
43+
cmd += '-hardware "' + hw_dir + '" '
44+
else:
45+
cmd += '-hardware "' + hardware_dir + '" '
46+
# Debug=Serial,DebugLevel=Core____
47+
cmd += '-fqbn=espressif:esp32:{board_name}:' \
48+
'FlashFreq={flash_freq},' \
49+
'PartitionScheme=huge_app,' \
50+
'UploadSpeed=921600'.format(**vars(args))
51+
cmd += ' '
52+
cmd += '-ide-version=10607 '
53+
cmd += '-warnings={warnings} '.format(**vars(args))
54+
if args.verbose:
55+
cmd += '-verbose '
56+
cmd += sketch
57+
58+
if args.verbose:
59+
print('Building: ' + cmd, file=f)
60+
61+
cmds = cmd.split(' ')
62+
p = subprocess.Popen(cmds, stdout=f, stderr=subprocess.STDOUT)
63+
p.wait()
64+
return p.returncode
65+
66+
def parse_args():
67+
parser = argparse.ArgumentParser(description='Sketch build helper')
68+
parser.add_argument('-v', '--verbose', help='Enable verbose output',
69+
action='store_true')
70+
parser.add_argument('-i', '--ide_path', help='Arduino IDE path')
71+
parser.add_argument('-p', '--build_path', help='Build directory')
72+
parser.add_argument('-l', '--library_path', help='Additional library path',
73+
action='append')
74+
parser.add_argument('-d', '--hardware_dir', help='Additional hardware path',
75+
action='append')
76+
parser.add_argument('-b', '--board_name', help='Board name', default='esp32')
77+
parser.add_argument('-w', '--warnings', help='Compilation warnings level',
78+
default='none', choices=['none', 'all', 'more'])
79+
parser.add_argument('-o', '--output_binary', help='File name for output binary')
80+
parser.add_argument('-k', '--keep', action='store_true',
81+
help='Don\'t delete temporary build directory')
82+
parser.add_argument('--flash_freq', help='Flash frequency', default=40,
83+
type=int, choices=[40, 80])
84+
parser.add_argument('sketch_path', help='Sketch file path')
85+
return parser.parse_args()
86+
87+
def main():
88+
args = parse_args()
89+
90+
ide_path = args.ide_path
91+
if not ide_path:
92+
ide_path = os.environ.get('ARDUINO_IDE_PATH')
93+
if not ide_path:
94+
print("Please specify Arduino IDE path via --ide_path option"
95+
"or ARDUINO_IDE_PATH environment variable.", file=sys.stderr)
96+
return 2
97+
98+
sketch_path = args.sketch_path
99+
tmp_dir = args.build_path
100+
created_tmp_dir = False
101+
if not tmp_dir:
102+
tmp_dir = tempfile.mkdtemp()
103+
created_tmp_dir = True
104+
105+
tools_dir = os.path.dirname(os.path.realpath(__file__)) + '/../tools'
106+
# this is not the correct hardware folder to add.
107+
hardware_dir = ide_path + '/hardware'
108+
109+
output_name = tmp_dir + '/' + os.path.basename(sketch_path) + '.bin'
110+
if args.verbose:
111+
print("Sketch: ", sketch_path)
112+
print("Build dir: ", tmp_dir)
113+
print("Output: ", output_name)
114+
115+
if args.verbose:
116+
f = sys.stdout
117+
else:
118+
f = open(tmp_dir + '/build.log', 'w')
119+
120+
res = compile(tmp_dir, sketch_path, tools_dir, hardware_dir, ide_path, f, args)
121+
if res != 0:
122+
return res
123+
124+
if args.output_binary is not None:
125+
shutil.copy(output_name, args.output_binary)
126+
127+
if created_tmp_dir and not args.keep:
128+
shutil.rmtree(tmp_dir, ignore_errors=True)
129+
130+
if __name__ == '__main__':
131+
sys.exit(main())

travis/build.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
echo -e "travis_fold:start:sketch_test_env_prepare"
4+
pip install pyserial
5+
wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz
6+
tar xf arduino.tar.xz
7+
mv arduino-nightly $HOME/arduino_ide
8+
mkdir -p $HOME/Arduino/libraries
9+
cd $HOME/Arduino/libraries
10+
cp -rf $TRAVIS_BUILD_DIR ESPAsyncWebServer
11+
git clone https://github.com/bblanchon/ArduinoJson
12+
git clone https://github.com/me-no-dev/AsyncTCP
13+
cd $HOME/arduino_ide/hardware
14+
mkdir espressif
15+
cd espressif
16+
git clone https://github.com/espressif/arduino-esp32.git esp32
17+
cd esp32
18+
git submodule update --init --recursive
19+
cd tools
20+
python get.py
21+
cd $TRAVIS_BUILD_DIR
22+
export PATH="$HOME/arduino_ide:$HOME/arduino_ide/hardware/espressif/esp32/tools/xtensa-esp32-elf/bin:$PATH"
23+
source travis/common.sh
24+
echo -e "travis_fold:end:sketch_test_env_prepare"
25+
26+
echo -e "travis_fold:start:sketch_test"
27+
build_sketches $HOME/arduino_ide $HOME/Arduino/libraries/ESPAsyncWebServer/examples "-l $HOME/Arduino/libraries"
28+
if [ $? -ne 0 ]; then exit 1; fi
29+
echo -e "travis_fold:end:sketch_test"

travis/common.sh

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,38 @@
22

33
function build_sketches()
44
{
5+
#set +e
56
local arduino=$1
67
local srcpath=$2
7-
local platform=$3
8+
local build_arg=$3
9+
local build_dir=build.tmp
10+
mkdir -p $build_dir
11+
local build_cmd="python travis/build.py -b esp32 -k -p $PWD/$build_dir $build_arg "
812
local sketches=$(find $srcpath -name *.ino)
13+
export ARDUINO_IDE_PATH=$arduino
914
for sketch in $sketches; do
15+
rm -rf $build_dir/*
1016
local sketchdir=$(dirname $sketch)
11-
if [[ -f "$sketchdir/.$platform.skip" ]]; then
12-
echo -e "\n\n ------------ Skipping $sketch ------------ \n\n";
17+
local sketchdirname=$(basename $sketchdir)
18+
local sketchname=$(basename $sketch)
19+
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
20+
echo "Skipping $sketch, beacause it is not the main sketch file";
21+
continue
22+
fi;
23+
if [[ -f "$sketchdir/.test.skip" ]]; then
24+
echo -e "\n ------------ Skipping $sketch ------------ \n";
1325
continue
1426
fi
15-
echo -e "\n\n ------------ Building $sketch ------------ \n\n";
16-
$arduino --verify $sketch;
27+
echo -e "\n ------------ Building $sketch ------------ \n";
28+
time ($build_cmd $sketch >$build_dir/build.log)
1729
local result=$?
1830
if [ $result -ne 0 ]; then
1931
echo "Build failed ($1)"
32+
echo "Build log:"
33+
cat $build_dir/build.log
2034
return $result
2135
fi
36+
rm $build_dir/build.log
2237
done
38+
#set -e
2339
}

0 commit comments

Comments
 (0)