Skip to content

Commit

Permalink
Merge branch 'master' into feature/iotdk_fix
Browse files Browse the repository at this point in the history
Signed-off-by: Wayne Ren <[email protected]>
  • Loading branch information
Wayne Ren committed Oct 8, 2018
2 parents 90925cc + 2976404 commit c7aba6d
Show file tree
Hide file tree
Showing 8 changed files with 379 additions and 31 deletions.
1 change: 1 addition & 0 deletions .ci/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ fi
pip install PrettyTable || die
pip install colorama || die
pip install configparser || die
pip install requests || die
}
52 changes: 50 additions & 2 deletions .ci/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import os
import sys
import requests
from prettytable import PrettyTable
from colorama import Fore, Back, Style
from configparser import ConfigParser
Expand Down Expand Up @@ -374,14 +375,38 @@ def get_expected_result(expected_file, app_path, board, bd_ver):
return result


def send_pull_request_comment(columns, results):
job = os.environ.get("NAME")
pr_number = os.environ.get("TRAVIS_PULL_REQUEST")
if all([job, pr_number]):
comment_job = "## " + job + "\n"
if len(results)>0:
head = "|".join(columns) + "\n"
table_format = "|".join(["---"]*len(columns)) + "\n"
table_head =head +table_format
comments = ""
comment = ""
for result in results:
for k in result:
comment += (k.replace(Fore.RED, "")).replace("\n", "<br>") +" |"
comment = comment.rstrip("|") + "\n"
comments += comment
comment_on_pull_request(comment_job + table_head + comments)
else:
print("WARNING:Only send pull request comment in travis ci!")

pass


def show_results(results, expected=None):
columns = ['TOOLCHAIN', 'APP', "TOOLCHAIN_VER", 'CONF', 'PASS']
columns = ["TOOLCHAIN_VER", 'TOOLCHAIN', 'APP', 'CONF', 'PASS']
failed_pt = PrettyTable(columns)
failed_results = []
success_results = []
expected_results = None
success_pt = PrettyTable(columns)
expected_pt = PrettyTable(columns)

for result in results:
status = result.pop("status")
if status != 0:
Expand All @@ -398,6 +423,7 @@ def show_results(results, expected=None):

if expected is not None:
expected_results = failed_results
send_pull_request_comment(columns, expected_results)
for result in expected_results:
if len(result) > 0:
expected_pt.add_row(result)
Expand All @@ -413,6 +439,8 @@ def show_results(results, expected=None):
success_pt.add_row(result)
print Fore.GREEN + "Successfull results"
print success_pt


print Style.RESET_ALL
sys.stdout.flush()

Expand All @@ -427,6 +455,7 @@ def show_results(results, expected=None):

print Fore.RED + "Failed result:"
print failed_pt

print Style.RESET_ALL
sys.stdout.flush()

Expand Down Expand Up @@ -529,14 +558,31 @@ def build_makefiles_project(config):
diff_expected_differents[app_path] = copy.deepcopy(expected_different[app_path])

print "There are {} projects, and they are compiled for {} times".format(app_count, count)
results_list = build_result_combine_tail(apps_results)
results_list = copy.deepcopy(build_result_combine_tail(apps_results))
show_results(results_list)
expected_differents_list = build_result_combine_tail(diff_expected_differents)
show_results(expected_differents_list, expected=True)

return applications_failed, diff_expected_differents


def comment_on_pull_request(comment):
pr_number = os.environ.get("TRAVIS_PULL_REQUEST")
slug = os.environ.get("TRAVIS_REPO_SLUG")
token = os.environ.get("GH_TOKEN")
request_config = [pr_number, slug, token, comment]
for i in range(len(request_config)):
if request_config[i] == "false":
request_config[i] = False
if all(request_config):
url = 'https://api.github.com/repos/{slug}/issues/{number}/comments'.format(
slug=slug, number=pr_number)
response = requests.post(url, data=json.dumps({'body': comment}),
headers={'Authorization': 'token ' + token})
print(">>>>Travis send pull request comment to {}, repsonse status code {}.".format(url, response.status_code))
return response.json()


def get_options_parser():
configs = dict()
toolchainlist = ["gnu", "mw"]
Expand Down Expand Up @@ -590,4 +636,6 @@ def get_options_parser():
else:
print "these applications failed with some configuration: "
print expected_differents.keys()
comment = "applications failed with some configuration: \n" + "\n".join(expected_differents.keys())
comment_on_pull_request(comment)
sys.exit(1)
7 changes: 7 additions & 0 deletions .ci/deploy_doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ make html &> build_html.log || { tail -n 100 build_html.log ; die "Build sphinx
# Check if this is a pull request
if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then
echo "Don't push built docs to gh-pages for pull request "

make linkcheck -k 2>&1
COMMENT_CONTENT=$(sed 's/$/&<br>/g' build/linkcheck/output.txt)
COMMENT_HEAD="# Sphinx link check result \n***********************\n<pre>"
COMMENT_TAIL="</pre>"
COMMENT="${COMMENT_HEAD}${COMMENT_CONTENT}${COMMENT_TAIL}"
bash -c "$COMMENTS"
exit 0
fi

Expand Down
1 change: 0 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache"
OSP_ROOT: "."
TOOLCHAIN: "gnu"
CUR_CORE: "none"
TOOLCHAIN_VER: "2017.09"
EXPECTED: ".ci/expected.ini"
PARALLEL: ""
Expand Down
9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ env:
"context": "travis-ci/$NAME",
"target_url": "https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID"
}\nDATA'
COMMENT=none
COMMENTS=$'curl -so/dev/null --user "$EMBARC_BOT" --request POST
https://api.github.com/repos/$TRAVIS_REPO_SLUG/issues/$TRAVIS_PULL_REQUEST/comments
--data @- << DATA\n{
"body": "$COMMENT"
}\nDATA'
cache:
pip: true
Expand All @@ -28,7 +35,7 @@ branches:

before_install:
- bash .ci/before_install.sh
# setup git config
# setup git config
- git config --global user.name "embARC Automated Bot"
- git config --global user.email "[email protected]"

Expand Down
13 changes: 13 additions & 0 deletions middleware/u8glib/csrc/u8g.h
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ uint8_t u8g_com_msp430_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
uint8_t u8g_com_raspberrypi_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); /* u8g_com_rasperrypi_hw_spi.c */
uint8_t u8g_com_raspberrypi_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); /* u8g_com_raspberrypi_ssd_i2c.c */

uint8_t u8g_com_embarc_ssd_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
uint8_t u8g_com_embarc_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);


Expand All @@ -703,6 +704,7 @@ uint8_t u8g_com_embarc_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
U8G_COM_T6963
U8G_COM_FAST_PARALLEL
U8G_COM_SSD_I2C
U8G_COM_SSD_SPI
U8G_COM_UC_I2C
defined(__18CXX) || defined(__PIC32MX)
Expand Down Expand Up @@ -856,6 +858,17 @@ defined(__18CXX) || defined(__PIC32MX)
#endif
#endif

/* ==== HW SPI, embARC ====*/
#if defined(PLATFORM_EMBARC)
#define U8G_COM_SSD_SPI u8g_com_embarc_ssd_spi_fn

#ifndef U8G_COM_SSD_SPI
#define U8G_COM_SSD_SPI u8g_com_null_fn
#endif

#endif


#ifndef U8G_COM_UC_I2C
#if defined(__AVR__)
/* AVR variant can use the arduino version at the moment */
Expand Down
Loading

0 comments on commit c7aba6d

Please sign in to comment.