Skip to content

Commit c7aba6d

Browse files
author
Wayne Ren
committed
Merge branch 'master' into feature/iotdk_fix
Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2 parents 90925cc + 2976404 commit c7aba6d

File tree

8 files changed

+379
-31
lines changed

8 files changed

+379
-31
lines changed

.ci/before_install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ fi
2929
pip install PrettyTable || die
3030
pip install colorama || die
3131
pip install configparser || die
32+
pip install requests || die
3233
}

.ci/build.py

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import json
33
import os
44
import sys
5+
import requests
56
from prettytable import PrettyTable
67
from colorama import Fore, Back, Style
78
from configparser import ConfigParser
@@ -374,14 +375,38 @@ def get_expected_result(expected_file, app_path, board, bd_ver):
374375
return result
375376

376377

378+
def send_pull_request_comment(columns, results):
379+
job = os.environ.get("NAME")
380+
pr_number = os.environ.get("TRAVIS_PULL_REQUEST")
381+
if all([job, pr_number]):
382+
comment_job = "## " + job + "\n"
383+
if len(results)>0:
384+
head = "|".join(columns) + "\n"
385+
table_format = "|".join(["---"]*len(columns)) + "\n"
386+
table_head =head +table_format
387+
comments = ""
388+
comment = ""
389+
for result in results:
390+
for k in result:
391+
comment += (k.replace(Fore.RED, "")).replace("\n", "<br>") +" |"
392+
comment = comment.rstrip("|") + "\n"
393+
comments += comment
394+
comment_on_pull_request(comment_job + table_head + comments)
395+
else:
396+
print("WARNING:Only send pull request comment in travis ci!")
397+
398+
pass
399+
400+
377401
def show_results(results, expected=None):
378-
columns = ['TOOLCHAIN', 'APP', "TOOLCHAIN_VER", 'CONF', 'PASS']
402+
columns = ["TOOLCHAIN_VER", 'TOOLCHAIN', 'APP', 'CONF', 'PASS']
379403
failed_pt = PrettyTable(columns)
380404
failed_results = []
381405
success_results = []
382406
expected_results = None
383407
success_pt = PrettyTable(columns)
384408
expected_pt = PrettyTable(columns)
409+
385410
for result in results:
386411
status = result.pop("status")
387412
if status != 0:
@@ -398,6 +423,7 @@ def show_results(results, expected=None):
398423

399424
if expected is not None:
400425
expected_results = failed_results
426+
send_pull_request_comment(columns, expected_results)
401427
for result in expected_results:
402428
if len(result) > 0:
403429
expected_pt.add_row(result)
@@ -413,6 +439,8 @@ def show_results(results, expected=None):
413439
success_pt.add_row(result)
414440
print Fore.GREEN + "Successfull results"
415441
print success_pt
442+
443+
416444
print Style.RESET_ALL
417445
sys.stdout.flush()
418446

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

428456
print Fore.RED + "Failed result:"
429457
print failed_pt
458+
430459
print Style.RESET_ALL
431460
sys.stdout.flush()
432461

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

531560
print "There are {} projects, and they are compiled for {} times".format(app_count, count)
532-
results_list = build_result_combine_tail(apps_results)
561+
results_list = copy.deepcopy(build_result_combine_tail(apps_results))
533562
show_results(results_list)
534563
expected_differents_list = build_result_combine_tail(diff_expected_differents)
535564
show_results(expected_differents_list, expected=True)
536565

537566
return applications_failed, diff_expected_differents
538567

539568

569+
def comment_on_pull_request(comment):
570+
pr_number = os.environ.get("TRAVIS_PULL_REQUEST")
571+
slug = os.environ.get("TRAVIS_REPO_SLUG")
572+
token = os.environ.get("GH_TOKEN")
573+
request_config = [pr_number, slug, token, comment]
574+
for i in range(len(request_config)):
575+
if request_config[i] == "false":
576+
request_config[i] = False
577+
if all(request_config):
578+
url = 'https://api.github.com/repos/{slug}/issues/{number}/comments'.format(
579+
slug=slug, number=pr_number)
580+
response = requests.post(url, data=json.dumps({'body': comment}),
581+
headers={'Authorization': 'token ' + token})
582+
print(">>>>Travis send pull request comment to {}, repsonse status code {}.".format(url, response.status_code))
583+
return response.json()
584+
585+
540586
def get_options_parser():
541587
configs = dict()
542588
toolchainlist = ["gnu", "mw"]
@@ -590,4 +636,6 @@ def get_options_parser():
590636
else:
591637
print "these applications failed with some configuration: "
592638
print expected_differents.keys()
639+
comment = "applications failed with some configuration: \n" + "\n".join(expected_differents.keys())
640+
comment_on_pull_request(comment)
593641
sys.exit(1)

.ci/deploy_doc.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ make html &> build_html.log || { tail -n 100 build_html.log ; die "Build sphinx
2525
# Check if this is a pull request
2626
if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then
2727
echo "Don't push built docs to gh-pages for pull request "
28+
29+
make linkcheck -k 2>&1
30+
COMMENT_CONTENT=$(sed 's/$/&<br>/g' build/linkcheck/output.txt)
31+
COMMENT_HEAD="# Sphinx link check result \n***********************\n<pre>"
32+
COMMENT_TAIL="</pre>"
33+
COMMENT="${COMMENT_HEAD}${COMMENT_CONTENT}${COMMENT_TAIL}"
34+
bash -c "$COMMENTS"
2835
exit 0
2936
fi
3037

.gitlab-ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ variables:
44
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache"
55
OSP_ROOT: "."
66
TOOLCHAIN: "gnu"
7-
CUR_CORE: "none"
87
TOOLCHAIN_VER: "2017.09"
98
EXPECTED: ".ci/expected.ini"
109
PARALLEL: ""

.travis.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ env:
1515
"context": "travis-ci/$NAME",
1616
"target_url": "https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID"
1717
}\nDATA'
18+
19+
COMMENT=none
20+
COMMENTS=$'curl -so/dev/null --user "$EMBARC_BOT" --request POST
21+
https://api.github.com/repos/$TRAVIS_REPO_SLUG/issues/$TRAVIS_PULL_REQUEST/comments
22+
--data @- << DATA\n{
23+
"body": "$COMMENT"
24+
}\nDATA'
1825
1926
cache:
2027
pip: true
@@ -28,7 +35,7 @@ branches:
2835

2936
before_install:
3037
- bash .ci/before_install.sh
31-
# setup git config
38+
# setup git config
3239
- git config --global user.name "embARC Automated Bot"
3340
- git config --global user.email "Huaqi.Fang@synopsys.com"
3441

middleware/u8glib/csrc/u8g.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ uint8_t u8g_com_msp430_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
691691
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 */
692692
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 */
693693

694+
uint8_t u8g_com_embarc_ssd_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
694695
uint8_t u8g_com_embarc_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
695696

696697

@@ -703,6 +704,7 @@ uint8_t u8g_com_embarc_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
703704
U8G_COM_T6963
704705
U8G_COM_FAST_PARALLEL
705706
U8G_COM_SSD_I2C
707+
U8G_COM_SSD_SPI
706708
U8G_COM_UC_I2C
707709
708710
defined(__18CXX) || defined(__PIC32MX)
@@ -856,6 +858,17 @@ defined(__18CXX) || defined(__PIC32MX)
856858
#endif
857859
#endif
858860

861+
/* ==== HW SPI, embARC ====*/
862+
#if defined(PLATFORM_EMBARC)
863+
#define U8G_COM_SSD_SPI u8g_com_embarc_ssd_spi_fn
864+
865+
#ifndef U8G_COM_SSD_SPI
866+
#define U8G_COM_SSD_SPI u8g_com_null_fn
867+
#endif
868+
869+
#endif
870+
871+
859872
#ifndef U8G_COM_UC_I2C
860873
#if defined(__AVR__)
861874
/* AVR variant can use the arduino version at the moment */

0 commit comments

Comments
 (0)