From 2031b16ba106dda275fe0d7116a3429279ee8e02 Mon Sep 17 00:00:00 2001 From: Jingru Date: Mon, 29 Jul 2019 11:34:50 +0800 Subject: [PATCH 01/12] travis: Add nsim, iotdk, hsdk and emsdp to travis.yml Signed-off-by: Jingru --- .travis.yml | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 75e46a62..0803f42b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: python -python: 2.7 +python: 3.6 sudo: required dist: trusty @@ -16,6 +16,7 @@ env: "target_url": "https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID" }\nDATA' - EXPECTED=".ci/expected.ini" + - TOOLCHAIN_VER="latest" cache: pip: true @@ -24,10 +25,17 @@ cache: - .cache/toolchain before_install: - - bash .ci/before_install.sh # setup git - git config --global user.name "${U_NAME}" - git config --global user.email "${U_EMAIL}" + - > + if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then + diff=$(git diff FETCH_HEAD master .ci) + if [ "$diff" == "" ]; then + git checkout remotes/origin/master -- .ci + fi + fi + - bash .ci/before_install.sh after_success: - bash -c "$STATUS" success "Local $NAME testing has passed" @@ -40,21 +48,30 @@ script: matrix: include: - - env: NAME="emsk-11-gnu_201709" OSP_ROOT="." BOARD="emsk" TOOLCHAIN="gnu" BD_VER="11" TOOLCHAIN_VER="2017.09" EXAMPLES="embarc_applications" + - env: NAME="emsk-11-gnu_latest" OSP_ROOT="." BOARD="emsk" TOOLCHAIN="gnu" BD_VER="11" EXAMPLES="embarc_applications" + os: linux + compiler: gcc + + - env: NAME="emsk-22-gnu_latest" OSP_ROOT="." BOARD="emsk" TOOLCHAIN="gnu" BD_VER="22" EXAMPLES="embarc_applications" os: linux compiler: gcc - - env: NAME="emsk-11-gnu_201803" OSP_ROOT="." BOARD="emsk" TOOLCHAIN="gnu" BD_VER="11" TOOLCHAIN_VER="2018.03" EXAMPLES="embarc_applications" + + - env: NAME="emsk-23-gnu_latest" OSP_ROOT="." BOARD="emsk" TOOLCHAIN="gnu" BD_VER="23" PARALLEL=8 EXAMPLES="embarc_applications" os: linux compiler: gcc - - env: NAME="emsk-22-gnu_201709" OSP_ROOT="." BOARD="emsk" TOOLCHAIN="gnu" BD_VER="22" TOOLCHAIN_VER="2017.09" EXAMPLES="embarc_applications" + + - env: NAME="hsdk-gnu-latest" TOOLCHAIN="gnu" BOARD="hsdk" EXAMPLES="embarc_applications" os: linux compiler: gcc - - env: NAME="emsk-22-gnu_201803" OSP_ROOT="." BOARD="emsk" TOOLCHAIN="gnu" BD_VER="22" TOOLCHAIN_VER="2018.03" EXAMPLES="embarc_applications" + + - env: NAME="iotdk-gnu-latest" TOOLCHAIN="gnu" BOARD="iotdk" EXAMPLES="embarc_applications" os: linux compiler: gcc - - env: NAME="emsk-23-gnu_201709" OSP_ROOT="." BOARD="emsk" TOOLCHAIN="gnu" BD_VER="23" TOOLCHAIN_VER="2017.09" EXAMPLES="embarc_applications" + + - env: NAME="nsim-gnu-latest" TOOLCHAIN="gnu" BOARD="nsim" EXAMPLES="embarc_applications" os: linux compiler: gcc - - env: NAME="emsk-23-gnu_201803" OSP_ROOT="." BOARD="emsk" TOOLCHAIN="gnu" BD_VER="23" TOOLCHAIN_VER="2018.03" EXAMPLES="embarc_applications" + + - env: NAME="emsdp-gnu-latest" TOOLCHAIN="gnu" BOARD="emsdp" EXAMPLES="embarc_applications" os: linux - compiler: gcc + compiler: gcc \ No newline at end of file From 5826e47200b05e480523c9c58557de7e36861752 Mon Sep 17 00:00:00 2001 From: Jingru Date: Mon, 29 Jul 2019 11:42:26 +0800 Subject: [PATCH 02/12] travis: Add OSP_ROOT when build with CI Signed-off-by: Jingru --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0803f42b..e3b7b3eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,18 +60,18 @@ matrix: os: linux compiler: gcc - - env: NAME="hsdk-gnu-latest" TOOLCHAIN="gnu" BOARD="hsdk" EXAMPLES="embarc_applications" + - env: NAME="hsdk-gnu-latest" OSP_ROOT="." TOOLCHAIN="gnu" BOARD="hsdk" EXAMPLES="embarc_applications" os: linux compiler: gcc - - env: NAME="iotdk-gnu-latest" TOOLCHAIN="gnu" BOARD="iotdk" EXAMPLES="embarc_applications" + - env: NAME="iotdk-gnu-latest" OSP_ROOT="." TOOLCHAIN="gnu" BOARD="iotdk" EXAMPLES="embarc_applications" os: linux compiler: gcc - - env: NAME="nsim-gnu-latest" TOOLCHAIN="gnu" BOARD="nsim" EXAMPLES="embarc_applications" + - env: NAME="nsim-gnu-latest" OSP_ROOT="." TOOLCHAIN="gnu" BOARD="nsim" EXAMPLES="embarc_applications" os: linux compiler: gcc - - env: NAME="emsdp-gnu-latest" TOOLCHAIN="gnu" BOARD="emsdp" EXAMPLES="embarc_applications" + - env: NAME="emsdp-gnu-latest" OSP_ROOT="." TOOLCHAIN="gnu" BOARD="emsdp" EXAMPLES="embarc_applications" os: linux compiler: gcc \ No newline at end of file From 6975da4106cfae7ac82089ca4c4e4c97cb0fd936 Mon Sep 17 00:00:00 2001 From: Jingru Date: Mon, 29 Jul 2019 11:45:40 +0800 Subject: [PATCH 03/12] travis: Set global variable TOOLCHAIN=gnu Signed-off-by: Jingru --- .travis.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index e3b7b3eb..fe22ef57 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ env: "target_url": "https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID" }\nDATA' - EXPECTED=".ci/expected.ini" + - TOOLCHAIN="gnu" - TOOLCHAIN_VER="latest" cache: @@ -48,30 +49,30 @@ script: matrix: include: - - env: NAME="emsk-11-gnu_latest" OSP_ROOT="." BOARD="emsk" TOOLCHAIN="gnu" BD_VER="11" EXAMPLES="embarc_applications" + - env: NAME="emsk-11-gnu_latest" OSP_ROOT="." BOARD="emsk" BD_VER="11" EXAMPLES="embarc_applications" os: linux compiler: gcc - - env: NAME="emsk-22-gnu_latest" OSP_ROOT="." BOARD="emsk" TOOLCHAIN="gnu" BD_VER="22" EXAMPLES="embarc_applications" + - env: NAME="emsk-22-gnu_latest" OSP_ROOT="." BOARD="emsk" BD_VER="22" EXAMPLES="embarc_applications" os: linux compiler: gcc - - env: NAME="emsk-23-gnu_latest" OSP_ROOT="." BOARD="emsk" TOOLCHAIN="gnu" BD_VER="23" PARALLEL=8 EXAMPLES="embarc_applications" + - env: NAME="emsk-23-gnu_latest" OSP_ROOT="." BOARD="emsk" BD_VER="23" PARALLEL=8 EXAMPLES="embarc_applications" os: linux compiler: gcc - - env: NAME="hsdk-gnu-latest" OSP_ROOT="." TOOLCHAIN="gnu" BOARD="hsdk" EXAMPLES="embarc_applications" + - env: NAME="hsdk-gnu-latest" OSP_ROOT="." BOARD="hsdk" EXAMPLES="embarc_applications" os: linux compiler: gcc - - env: NAME="iotdk-gnu-latest" OSP_ROOT="." TOOLCHAIN="gnu" BOARD="iotdk" EXAMPLES="embarc_applications" + - env: NAME="iotdk-gnu-latest" OSP_ROOT="." BOARD="iotdk" EXAMPLES="embarc_applications" os: linux compiler: gcc - - env: NAME="nsim-gnu-latest" OSP_ROOT="." TOOLCHAIN="gnu" BOARD="nsim" EXAMPLES="embarc_applications" + - env: NAME="nsim-gnu-latest" OSP_ROOT="." BOARD="nsim" EXAMPLES="embarc_applications" os: linux compiler: gcc - - env: NAME="emsdp-gnu-latest" OSP_ROOT="." TOOLCHAIN="gnu" BOARD="emsdp" EXAMPLES="embarc_applications" + - env: NAME="emsdp-gnu-latest" OSP_ROOT="." BOARD="emsdp" EXAMPLES="embarc_applications" os: linux compiler: gcc \ No newline at end of file From 83d4b183a6f74e61c185f90594c08163ab23085d Mon Sep 17 00:00:00 2001 From: Jingru Date: Mon, 29 Jul 2019 14:47:29 +0800 Subject: [PATCH 04/12] travis: Only build updated applications when pull request Signed-off-by: Jingru --- .ci/expected.ini | 88 ++++++++++++++++++++++++++++++++++++++++++++++++ .ci/script.sh | 16 ++++++++- .travis.yml | 15 +++++---- 3 files changed, 111 insertions(+), 8 deletions(-) diff --git a/.ci/expected.ini b/.ci/expected.ini index 0b8772fd..9943aa1c 100644 --- a/.ci/expected.ini +++ b/.ci/expected.ini @@ -1,3 +1,91 @@ +[embarc_applications/ibaby_smarthome_multinode/src/wearable_node] +emsdp= +nsim= +iotdk= + +[embarc_applications/ibaby_smarthome_multinode/src/lamp_node] +emsdp= +nsim= +iotdk= +hsdk= + +[embarc_applications/aws_iot_smarthome/src] +emsdp= +nsim= +iotdk= + +[embarc_applications/arc_design_contest/2018/HUST_iRhythm] +emsdp= +nsim= +iotdk= +hsdk= + [embarc_applications/arc_design_contest/2018/XDU_Master-Sign-Language/arc] +emsdp= +nsim= +iotdk= +hsdk= +emsdk=22,23 + +[embarc_applications/arc_design_contest/2018/Smart_Power_Saving_System_of_3D_Remote_Interaction/ARC] +emsdp= +nsim= +iotdk= +hsdk= + +[embarc_applications/arc_design_contest/2018/HUST_inverted_pendulum/src] +emsdp= +nsim= +iotdk= +hsdk= + +[embarc_applications/arc_design_contest/2018/NCTU_Smart_Pillow/src] +emsdp= +nsim= +iotdk= + +[embarc_applications/arc_design_contest/2018/XDU_Autofollowing_suitcase/src] +emsdp= +nsim= +iotdk= + +[embarc_applications/aws_iot_smarthome_secureshield/src] +emsdp= +nsim= +iotdk= +hsdk= emsk=22,23 +[embarc_applications/ilight_smartdevice/src] +emsdp= +nsim= +iotdk= + +[embarc_applications/aws_iot_smarthome_multinode/src/frontDoor] +emsdp= +nsim= +iotdk= + +[embarc_applications/aws_iot_smarthome_multinode/src/kitchen] +emsdp= +nsim= +iotdk= + +[embarc_applications/aws_iot_smarthome_multinode/src/livingRoom] +emsdp= +nsim= +iotdk= + +[embarc_applications/ot_smarthome_multinode/src/frontDoor] +emsdp= +nsim= +iotdk= +hsdk= +emsk=23 + +[embarc_applications/ot_smarthome_multinode/src/livingRoom] +emsdp= +nsim= +iotdk= +hsdk= +emsk=23 diff --git a/.ci/script.sh b/.ci/script.sh index 4802885f..fbefc6b3 100644 --- a/.ci/script.sh +++ b/.ci/script.sh @@ -57,6 +57,20 @@ else ccac -v || die "MWDT toolchain is not installed correctly" fi +# Get the modified applications +if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then + diff_examples=$(git diff --name-only --diff-filter=a FETCH_HEAD..master \ + | ( grep '.\(Makefile\|makefile\|c\|h\)$' || true ) \ + | while read file; do + echo "${EXAMPLES}/$(dirname ${file})" + done \ + | uniq ) + + if [ ! "$diff_examples" = "" ]; then + function join { local IFS="$1"; shift; echo "$*"; } + EXAMPLES=$(join , ${diff_example[@]}) + fi +fi { bash apply_embARC_patch.sh || die @@ -64,7 +78,7 @@ fi EXPECTED="../${EXPECTED}" cd .ci || die { - BUILD_OPTS="OSP_ROOT=${OSP_ROOT} TOOLCHAIN=${TOOLCHAIN} BOARD=${BOARD} BD_VER=${BD_VER} CUR_CORE=${CUR_CORE} GNU_VER=${GNU_VER} EXAMPLES=${EXAMPLES} EXPECTED=${EXPECTED}" + BUILD_OPTS="OSP_ROOT=${OSP_ROOT} TOOLCHAIN=${TOOLCHAIN} BOARD=${BOARD} BD_VER=${BD_VER} CUR_CORE=${CUR_CORE} TOOLCHAIN_VER=${TOOLCHAIN_VER} EXAMPLES=${EXAMPLES} EXPECTED=${EXPECTED}" python build.py ${BUILD_OPTS} || die } diff --git a/.travis.yml b/.travis.yml index fe22ef57..43707435 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,7 @@ env: - EXPECTED=".ci/expected.ini" - TOOLCHAIN="gnu" - TOOLCHAIN_VER="latest" + - EXAMPLES="embarc_applications" cache: pip: true @@ -49,30 +50,30 @@ script: matrix: include: - - env: NAME="emsk-11-gnu_latest" OSP_ROOT="." BOARD="emsk" BD_VER="11" EXAMPLES="embarc_applications" + - env: NAME="emsk-11-gnu_latest" OSP_ROOT="." BOARD="emsk" BD_VER="11" os: linux compiler: gcc - - env: NAME="emsk-22-gnu_latest" OSP_ROOT="." BOARD="emsk" BD_VER="22" EXAMPLES="embarc_applications" + - env: NAME="emsk-22-gnu_latest" OSP_ROOT="." BOARD="emsk" BD_VER="22" os: linux compiler: gcc - - env: NAME="emsk-23-gnu_latest" OSP_ROOT="." BOARD="emsk" BD_VER="23" PARALLEL=8 EXAMPLES="embarc_applications" + - env: NAME="emsk-23-arcem7d-gnu_latest" OSP_ROOT="." BOARD="emsk" BD_VER="23" CUR_CORE="arcem7d" os: linux compiler: gcc - - env: NAME="hsdk-gnu-latest" OSP_ROOT="." BOARD="hsdk" EXAMPLES="embarc_applications" + - env: NAME="hsdk-gnu-latest" OSP_ROOT="." BOARD="hsdk" os: linux compiler: gcc - - env: NAME="iotdk-gnu-latest" OSP_ROOT="." BOARD="iotdk" EXAMPLES="embarc_applications" + - env: NAME="iotdk-gnu-latest" OSP_ROOT="." BOARD="iotdk" os: linux compiler: gcc - - env: NAME="nsim-gnu-latest" OSP_ROOT="." BOARD="nsim" EXAMPLES="embarc_applications" + - env: NAME="nsim-gnu-latest" OSP_ROOT="." BOARD="nsim" os: linux compiler: gcc - - env: NAME="emsdp-gnu-latest" OSP_ROOT="." BOARD="emsdp" EXAMPLES="embarc_applications" + - env: NAME="emsdp-gnu-latest" OSP_ROOT="." BOARD="emsdp" os: linux compiler: gcc \ No newline at end of file From 0bbbc33533b19dad6fc1df6ae824aad30aac5043 Mon Sep 17 00:00:00 2001 From: Jingru Date: Tue, 30 Jul 2019 11:18:11 +0800 Subject: [PATCH 05/12] travis: Modify expected.ini Signed-off-by: Jingru --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 43707435..99428965 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,6 +62,10 @@ matrix: os: linux compiler: gcc + - env: NAME="emsk-23-arcem7d-gnu_latest" OSP_ROOT="." BOARD="emsk" BD_VER="23" CUR_CORE="arcem9d" + os: linux + compiler: gcc + - env: NAME="hsdk-gnu-latest" OSP_ROOT="." BOARD="hsdk" os: linux compiler: gcc From af93501f5e0a141b71feb34f5c0787a7f4e259f0 Mon Sep 17 00:00:00 2001 From: Jingru Date: Wed, 31 Jul 2019 17:23:10 +0800 Subject: [PATCH 06/12] travis: modify error Signed-off-by: Jingru --- .ci/expected.ini | 6 ++-- .ci/script.sh | 29 +++++++++---------- .travis.yml | 6 ++-- .../src/frontDoor/mbedtls-config.h | 4 +-- .../src/livingRoom/mbedtls-config.h | 4 +-- 5 files changed, 24 insertions(+), 25 deletions(-) diff --git a/.ci/expected.ini b/.ci/expected.ini index 9943aa1c..39a6aae7 100644 --- a/.ci/expected.ini +++ b/.ci/expected.ini @@ -25,7 +25,7 @@ emsdp= nsim= iotdk= hsdk= -emsdk=22,23 +emsk= [embarc_applications/arc_design_contest/2018/Smart_Power_Saving_System_of_3D_Remote_Interaction/ARC] emsdp= @@ -81,11 +81,11 @@ emsdp= nsim= iotdk= hsdk= -emsk=23 +emsk= [embarc_applications/ot_smarthome_multinode/src/livingRoom] emsdp= nsim= iotdk= hsdk= -emsk=23 +emsk= diff --git a/.ci/script.sh b/.ci/script.sh index fbefc6b3..dafd2dcf 100644 --- a/.ci/script.sh +++ b/.ci/script.sh @@ -13,6 +13,20 @@ if [ "${TOOLCHAIN}" == "gnu" ]; then else ARC_DEV_TOOL_ROOT="${ARC_DEV_MW_ROOT}/mwdt_${TOOLCHAIN_VER}/linux/ARC" fi +# Get the modified applications +# if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then +# diff_examples=$(git diff --name-only --diff-filter=a FETCH_HEAD..master \ +# | ( grep '.\(Makefile\|makefile\|c\|h\)$' || true ) \ +# | while read file; do +# echo "$(basename ${TRAVIS_PULL_REQUEST_SLUG})/$(dirname ${file})" +# done \ +# | uniq ) + +# if [ ! "$diff_examples" = "" ]; then +# function join { local IFS="$1"; shift; echo "$*"; } +# EXAMPLES=$(join , ${diff_example[@]}) +# fi +# fi U_NAME=${U_NAME:=embARC_Bot} U_EMAIL=${U_EMAIL:=info@embARC.org} @@ -57,21 +71,6 @@ else ccac -v || die "MWDT toolchain is not installed correctly" fi -# Get the modified applications -if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - diff_examples=$(git diff --name-only --diff-filter=a FETCH_HEAD..master \ - | ( grep '.\(Makefile\|makefile\|c\|h\)$' || true ) \ - | while read file; do - echo "${EXAMPLES}/$(dirname ${file})" - done \ - | uniq ) - - if [ ! "$diff_examples" = "" ]; then - function join { local IFS="$1"; shift; echo "$*"; } - EXAMPLES=$(join , ${diff_example[@]}) - fi -fi - { bash apply_embARC_patch.sh || die diff --git a/.travis.yml b/.travis.yml index 99428965..5c957acd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ env: - EXPECTED=".ci/expected.ini" - TOOLCHAIN="gnu" - TOOLCHAIN_VER="latest" - - EXAMPLES="embarc_applications" + - EXAMPLES=$(basename ${TRAVIS_REPO_SLUG}) cache: pip: true @@ -58,11 +58,11 @@ matrix: os: linux compiler: gcc - - env: NAME="emsk-23-arcem7d-gnu_latest" OSP_ROOT="." BOARD="emsk" BD_VER="23" CUR_CORE="arcem7d" + - env: NAME="emsk-23-gnu_latest" OSP_ROOT="." BOARD="emsk" BD_VER="23" EXAMPLES="embarc_applications/ilight_smartdevice,embarc_applications/ibaby_smarthome_multinode,embarc_applications/aws_iot_smarthome,embarc_applications/aws_iot_smarthome_multinode,embarc_applications/aws_iot_smarthome_secureshield" os: linux compiler: gcc - - env: NAME="emsk-23-arcem7d-gnu_latest" OSP_ROOT="." BOARD="emsk" BD_VER="23" CUR_CORE="arcem9d" + - env: NAME="emsk-23-gnu_latest" OSP_ROOT="." BOARD="emsk" BD_VER="23" EXAMPLES="embarc_applications/arc_design_contest,embarc_applications/ot_smarthome_multinode" os: linux compiler: gcc diff --git a/ot_smarthome_multinode/src/frontDoor/mbedtls-config.h b/ot_smarthome_multinode/src/frontDoor/mbedtls-config.h index 0b9693bd..3f01025d 100644 --- a/ot_smarthome_multinode/src/frontDoor/mbedtls-config.h +++ b/ot_smarthome_multinode/src/frontDoor/mbedtls-config.h @@ -189,7 +189,7 @@ __inline int windows_kernel_snprintf(char * s, size_t n, const char * format, .. //#define MBEDTLS_PLATFORM_TIME_ALT //#define MBEDTLS_PLATFORM_FPRINTF_ALT //#define MBEDTLS_PLATFORM_PRINTF_ALT -//#define MBEDTLS_PLATFORM_SNPRINTF_ALT +#define MBEDTLS_PLATFORM_SNPRINTF_ALT //#define MBEDTLS_PLATFORM_NV_SEED_ALT /** @@ -2557,7 +2557,7 @@ __inline int windows_kernel_snprintf(char * s, size_t n, const char * format, .. //#define MBEDTLS_PLATFORM_STD_FPRINTF fprintf /**< Default fprintf to use, can be undefined */ //#define MBEDTLS_PLATFORM_STD_PRINTF printf /**< Default printf to use, can be undefined */ /* Note: your snprintf must correclty zero-terminate the buffer! */ -//#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */ +#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */ //#define MBEDTLS_PLATFORM_STD_EXIT_SUCCESS 0 /**< Default exit value to use, can be undefined */ //#define MBEDTLS_PLATFORM_STD_EXIT_FAILURE 1 /**< Default exit value to use, can be undefined */ //#define MBEDTLS_PLATFORM_STD_NV_SEED_READ mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */ diff --git a/ot_smarthome_multinode/src/livingRoom/mbedtls-config.h b/ot_smarthome_multinode/src/livingRoom/mbedtls-config.h index 0b9693bd..3f01025d 100644 --- a/ot_smarthome_multinode/src/livingRoom/mbedtls-config.h +++ b/ot_smarthome_multinode/src/livingRoom/mbedtls-config.h @@ -189,7 +189,7 @@ __inline int windows_kernel_snprintf(char * s, size_t n, const char * format, .. //#define MBEDTLS_PLATFORM_TIME_ALT //#define MBEDTLS_PLATFORM_FPRINTF_ALT //#define MBEDTLS_PLATFORM_PRINTF_ALT -//#define MBEDTLS_PLATFORM_SNPRINTF_ALT +#define MBEDTLS_PLATFORM_SNPRINTF_ALT //#define MBEDTLS_PLATFORM_NV_SEED_ALT /** @@ -2557,7 +2557,7 @@ __inline int windows_kernel_snprintf(char * s, size_t n, const char * format, .. //#define MBEDTLS_PLATFORM_STD_FPRINTF fprintf /**< Default fprintf to use, can be undefined */ //#define MBEDTLS_PLATFORM_STD_PRINTF printf /**< Default printf to use, can be undefined */ /* Note: your snprintf must correclty zero-terminate the buffer! */ -//#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */ +#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */ //#define MBEDTLS_PLATFORM_STD_EXIT_SUCCESS 0 /**< Default exit value to use, can be undefined */ //#define MBEDTLS_PLATFORM_STD_EXIT_FAILURE 1 /**< Default exit value to use, can be undefined */ //#define MBEDTLS_PLATFORM_STD_NV_SEED_READ mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */ From 985a626d5edd96c5cbf01729fed55de92b01fcde Mon Sep 17 00:00:00 2001 From: Jingru Date: Thu, 1 Aug 2019 10:42:00 +0800 Subject: [PATCH 07/12] travis: use python script to find modify_example Signed-off-by: Jingru --- .ci/expected.ini | 4 +-- .ci/get_examples.py | 84 +++++++++++++++++++++++++++++++++++++++++++++ .ci/script.sh | 16 ++------- .travis.yml | 4 +-- 4 files changed, 91 insertions(+), 17 deletions(-) create mode 100644 .ci/get_examples.py diff --git a/.ci/expected.ini b/.ci/expected.ini index 39a6aae7..22144b15 100644 --- a/.ci/expected.ini +++ b/.ci/expected.ini @@ -81,11 +81,11 @@ emsdp= nsim= iotdk= hsdk= -emsk= +emsk=22,23 [embarc_applications/ot_smarthome_multinode/src/livingRoom] emsdp= nsim= iotdk= hsdk= -emsk= +emsk=22,23 diff --git a/.ci/get_examples.py b/.ci/get_examples.py new file mode 100644 index 00000000..5457873f --- /dev/null +++ b/.ci/get_examples.py @@ -0,0 +1,84 @@ +import git +from embarc_tools.utils import cd, getcwd +from embarc_tools.settings import MAKEFILENAMES + +import os +import sh +import logging +import argparse + +def parse_args(): + parser = argparse.ArgumentParser( + description="Generate a sanitycheck argument for for tests " + " that have changed") + parser.add_argument("--root", help= default=getcwd(), + help="Specify the repo root directory") + parser.add_argument('--commit_start', default=None, + help="Commit range start point") + parser.add_argument('--commit_end', default=None, + help="Commit range end point") + parser.add_argument('--only_failed', default=None, + help="Commit range end point") + return parser.parse_args() + + +def find_embarc_appl(root): + cur_path = root + cur_dir = os.apth.dirname(root) + while cur_path != cur_dir: + for item in os.listdir(cur_dir): + if item in MAKEFILENAMES: + return cur_dir + cur_path = cur_dir + cur_dir = os.apth.dirname(cur_path) + + +def get_modified_examples(root, tree0, tree1): + repo = git.Repo(root) + diff_cmd = ["--name-only"] + diff_cmd.append("{}..{}".format(tree0, tree1)) + examples_changed = list() + update = repo.git.diff(diff_cmd).split("\n") + for item in update: + example_root = find_embarc_appl(item) + if example_root: + examples_changed.append(example_root) + return examples_changed + + +def get_last_failed(file=None): + if file: + job = file + else: + job = os.environ.get("CI_JOB_NAME") + if not job: + job = os.environ.get("NAME") + if not job: + job = os.environ.get("STAGE_NAME") + if job: + + branch = os.environ.get("TRAVIS_BRANCH") + home = os.environ.get("HOME") + cache = "{}/.cache/result".format(home) + last_failed_cache = os.path.join(cache, job, "failed_results.json") + if os.path.exists(last_failed_cache): + last_failed_appls = json.load(last_failed).keys() + return last_failed_appls + +def main(): + args = parse_args() + # if not (args.commit_start and args.commit_end): + # exit(1) + if args.commit_start and args.commit_end: + + examples_changed = get_modified_examples(args.root, + args.commit_start, args.commit_end) + if examples_changed: + print("%s" %(",".join(examples_changed))) + if only_failed: + last_failed_appls = get_last_failed() + if last_failed_appls: + print("%s" %(",".join(last_failed_appls))) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/.ci/script.sh b/.ci/script.sh index dafd2dcf..09f5aac0 100644 --- a/.ci/script.sh +++ b/.ci/script.sh @@ -13,20 +13,10 @@ if [ "${TOOLCHAIN}" == "gnu" ]; then else ARC_DEV_TOOL_ROOT="${ARC_DEV_MW_ROOT}/mwdt_${TOOLCHAIN_VER}/linux/ARC" fi -# Get the modified applications -# if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then -# diff_examples=$(git diff --name-only --diff-filter=a FETCH_HEAD..master \ -# | ( grep '.\(Makefile\|makefile\|c\|h\)$' || true ) \ -# | while read file; do -# echo "$(basename ${TRAVIS_PULL_REQUEST_SLUG})/$(dirname ${file})" -# done \ -# | uniq ) -# if [ ! "$diff_examples" = "" ]; then -# function join { local IFS="$1"; shift; echo "$*"; } -# EXAMPLES=$(join , ${diff_example[@]}) -# fi -# fi +if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then + EXAMPLES=$(.ci/get_examples.py --root ${HOME}--commit_start FETCH_HEAD --commit_end master) +fi U_NAME=${U_NAME:=embARC_Bot} U_EMAIL=${U_EMAIL:=info@embARC.org} diff --git a/.travis.yml b/.travis.yml index 5c957acd..a6edba66 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,8 +23,8 @@ env: cache: pip: true directories: - - .cache/result - - .cache/toolchain + - $HOME/.cache/result + - $HOME/.cache/toolchain before_install: # setup git From 7998a8b9958ff5462712f52698749828fd67d0e0 Mon Sep 17 00:00:00 2001 From: Jingru Date: Wed, 14 Aug 2019 11:47:05 +0800 Subject: [PATCH 08/12] travis: check code style when pull request Signed-off-by: Jingru --- .ci/before_install.sh | 2 + .ci/code_check.sh | 24 ++++++++++ .ci/expected.ini | 34 +------------ .ci/script.sh | 109 ++++++++++++++++++++++-------------------- .travis.yml | 12 ++--- 5 files changed, 88 insertions(+), 93 deletions(-) create mode 100644 .ci/code_check.sh diff --git a/.ci/before_install.sh b/.ci/before_install.sh index bc89ca13..39c144d6 100644 --- a/.ci/before_install.sh +++ b/.ci/before_install.sh @@ -25,4 +25,6 @@ fi pip install configparser || die pip install requests || die pip install XlsxWriter || die + pip install cpplint || die + pip install flake8 || die } diff --git a/.ci/code_check.sh b/.ci/code_check.sh new file mode 100644 index 00000000..9eb13902 --- /dev/null +++ b/.ci/code_check.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +die() +{ + echo " *** ERROR: " $* + exit 1 +} + +# When pull request, check code style +if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then + c_style_check=$(git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \ + | ( grep '.\(c\|cpp\|h\|hpp\)$' || true ) \ + | while read file; do cpplint "${file}"; done) + python_style_check=$(git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \ + | ( grep '.\(py\)$' || true ) \ + | while read file; do flake8 "${file}"; done) + + COMMENT_HEAD="## Code Style Check Result \n***********************\n
"
+    COMMENT_TAIL="
" + COMMENT="${COMMENT_HEAD}${c_style_check}\n${python_style_check}${COMMENT_TAIL}" + bash -c "$COMMENTS" + exit 0 +fi +exit 0 diff --git a/.ci/expected.ini b/.ci/expected.ini index 22144b15..d742edf6 100644 --- a/.ci/expected.ini +++ b/.ci/expected.ini @@ -1,91 +1,59 @@ [embarc_applications/ibaby_smarthome_multinode/src/wearable_node] -emsdp= -nsim= iotdk= [embarc_applications/ibaby_smarthome_multinode/src/lamp_node] -emsdp= -nsim= iotdk= hsdk= [embarc_applications/aws_iot_smarthome/src] -emsdp= -nsim= iotdk= [embarc_applications/arc_design_contest/2018/HUST_iRhythm] -emsdp= -nsim= iotdk= hsdk= [embarc_applications/arc_design_contest/2018/XDU_Master-Sign-Language/arc] -emsdp= -nsim= iotdk= hsdk= -emsk= +emsk=22,23 [embarc_applications/arc_design_contest/2018/Smart_Power_Saving_System_of_3D_Remote_Interaction/ARC] -emsdp= -nsim= iotdk= hsdk= [embarc_applications/arc_design_contest/2018/HUST_inverted_pendulum/src] -emsdp= -nsim= iotdk= hsdk= [embarc_applications/arc_design_contest/2018/NCTU_Smart_Pillow/src] -emsdp= -nsim= iotdk= [embarc_applications/arc_design_contest/2018/XDU_Autofollowing_suitcase/src] -emsdp= -nsim= iotdk= [embarc_applications/aws_iot_smarthome_secureshield/src] -emsdp= -nsim= iotdk= hsdk= emsk=22,23 [embarc_applications/ilight_smartdevice/src] -emsdp= -nsim= iotdk= [embarc_applications/aws_iot_smarthome_multinode/src/frontDoor] -emsdp= -nsim= iotdk= [embarc_applications/aws_iot_smarthome_multinode/src/kitchen] -emsdp= -nsim= iotdk= [embarc_applications/aws_iot_smarthome_multinode/src/livingRoom] -emsdp= -nsim= iotdk= [embarc_applications/ot_smarthome_multinode/src/frontDoor] -emsdp= -nsim= iotdk= hsdk= emsk=22,23 [embarc_applications/ot_smarthome_multinode/src/livingRoom] -emsdp= -nsim= iotdk= hsdk= emsk=22,23 diff --git a/.ci/script.sh b/.ci/script.sh index 09f5aac0..287bba13 100644 --- a/.ci/script.sh +++ b/.ci/script.sh @@ -3,72 +3,77 @@ die() { exit 1 } - -TOOLCHAIN_CACHE_FOLDER=".cache/toolchain" -ARC_DEV_GNU_ROOT="/u/arcgnu_verif/gnu_builds" -ARC_DEV_MW_ROOT="/u/relauto/.TOOLS_ROOT/ToolsCommon/MWDT_eng/" - -if [ "${TOOLCHAIN}" == "gnu" ]; then - ARC_DEV_TOOL_ROOT="${ARC_DEV_GNU_ROOT}/${TOOLCHAIN_VER}/elf32_le_linux" +if [ "$NAME" == "code-style-check" ]; then + ls + bash .ci/code_check.sh || die else - ARC_DEV_TOOL_ROOT="${ARC_DEV_MW_ROOT}/mwdt_${TOOLCHAIN_VER}/linux/ARC" -fi + TOOLCHAIN_CACHE_FOLDER=".cache/toolchain" + ARC_DEV_GNU_ROOT="/u/arcgnu_verif/gnu_builds" + ARC_DEV_MW_ROOT="/u/relauto/.TOOLS_ROOT/ToolsCommon/MWDT_eng/" -if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - EXAMPLES=$(.ci/get_examples.py --root ${HOME}--commit_start FETCH_HEAD --commit_end master) -fi + if [ "${TOOLCHAIN}" == "gnu" ]; then + ARC_DEV_TOOL_ROOT="${ARC_DEV_GNU_ROOT}/${TOOLCHAIN_VER}/elf32_le_linux" + else + ARC_DEV_TOOL_ROOT="${ARC_DEV_MW_ROOT}/mwdt_${TOOLCHAIN_VER}/linux/ARC" + fi -U_NAME=${U_NAME:=embARC_Bot} -U_EMAIL=${U_EMAIL:=info@embARC.org} -echo $U_NAME, $U_EMAIL -git config --global user.name "${U_NAME}" -git config --global user.email "${U_EMAIL}" -git checkout -- . || die -git archive --format zip -o applications.zip --prefix embarc_applications/ HEAD || die + if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then + EXAMPLES=$(.ci/get_examples.py --root ${HOME}--commit_start FETCH_HEAD --commit_end master) + fi -embARC_OSP_REPO=${embARC_OSP_REPO:="https://github.com/foss-for-synopsys-dwc-arc-processors/embarc_osp.git"} + U_NAME=${U_NAME:=embARC_Bot} + U_EMAIL=${U_EMAIL:=info@embARC.org} + echo $U_NAME, $U_EMAIL + git config --global user.name "${U_NAME}" + git config --global user.email "${U_EMAIL}" + git checkout -- . || die + git archive --format zip -o applications.zip --prefix embarc_applications/ HEAD || die -git clone ${embARC_OSP_REPO} embarc_osp -cd embarc_osp || die -unzip ../applications.zip>/dev/null 2>&1 || die + embARC_OSP_REPO=${embARC_OSP_REPO:="https://github.com/foss-for-synopsys-dwc-arc-processors/embarc_osp.git"} -[ "$TRAVIS" == "true" ] && { - if [ "${TOOLCHAIN}" == "gnu" ] ; then - python .ci/toolchain.py -v $TOOLCHAIN_VER -c $TOOLCHAIN_CACHE_FOLDER || die - if [ -d $TOOLCHAIN_CACHE_FOLDER ] ;then - if [ -d $TOOLCHAIN_CACHE_FOLDER/$TOOLCHAIN_VER ] ; then - ARC_DEV_TOOL_ROOT="${TOOLCHAIN_CACHE_FOLDER}/${TOOLCHAIN_VER}" + git clone ${embARC_OSP_REPO} embarc_osp + cd embarc_osp || die + unzip ../applications.zip>/dev/null 2>&1 || die + + [ "$TRAVIS" == "true" ] && { + if [ "${TOOLCHAIN}" == "gnu" ] ; then + python .ci/toolchain.py -v $TOOLCHAIN_VER -c $TOOLCHAIN_CACHE_FOLDER || die + if [ -d $TOOLCHAIN_CACHE_FOLDER ] ;then + if [ -d $TOOLCHAIN_CACHE_FOLDER/$TOOLCHAIN_VER ] ; then + ARC_DEV_TOOL_ROOT="${TOOLCHAIN_CACHE_FOLDER}/${TOOLCHAIN_VER}" + fi fi + else + die "Toolchain not supported in travis ci" fi + } + + if [ -d $ARC_DEV_TOOL_ROOT ] ; then + bash .ci/linux_env_set_arc.sh -t $TOOLCHAIN -r $ARC_DEV_TOOL_ROOT || die + [ ! -e "arctool.env" ] && die "arctool.env doesn't exist" + source arctool.env || die + rm -rf arctool.env || die else - die "Toolchain not supported in travis ci" + die "The toolchain path ${ARC_DEV_TOOL_ROOT} does not exist " fi -} -if [ -d $ARC_DEV_TOOL_ROOT ] ; then - bash .ci/linux_env_set_arc.sh -t $TOOLCHAIN -r $ARC_DEV_TOOL_ROOT || die - [ ! -e "arctool.env" ] && die "arctool.env doesn't exist" - source arctool.env || die - rm -rf arctool.env || die -else - die "The toolchain path ${ARC_DEV_TOOL_ROOT} does not exist " -fi + if [ "${TOOLCHAIN}" == "gnu" ] ; then + arc-elf32-gcc -v || die "ARC GNU toolchain is not installed correctly" + else + ccac -v || die "MWDT toolchain is not installed correctly" + fi -if [ "${TOOLCHAIN}" == "gnu" ] ; then - arc-elf32-gcc -v || die "ARC GNU toolchain is not installed correctly" -else - ccac -v || die "MWDT toolchain is not installed correctly" -fi + { + bash apply_embARC_patch.sh || die -{ - bash apply_embARC_patch.sh || die + EXPECTED="../${EXPECTED}" + cd .ci || die + { + BUILD_OPTS="OSP_ROOT=${OSP_ROOT} TOOLCHAIN=${TOOLCHAIN} BOARD=${BOARD} BD_VER=${BD_VER} CUR_CORE=${CUR_CORE} TOOLCHAIN_VER=${TOOLCHAIN_VER} EXAMPLES=${EXAMPLES} EXPECTED=${EXPECTED}" + python build.py ${BUILD_OPTS} || die + } - EXPECTED="../${EXPECTED}" - cd .ci || die - { - BUILD_OPTS="OSP_ROOT=${OSP_ROOT} TOOLCHAIN=${TOOLCHAIN} BOARD=${BOARD} BD_VER=${BD_VER} CUR_CORE=${CUR_CORE} TOOLCHAIN_VER=${TOOLCHAIN_VER} EXAMPLES=${EXAMPLES} EXPECTED=${EXPECTED}" - python build.py ${BUILD_OPTS} || die } +fi -} diff --git a/.travis.yml b/.travis.yml index a6edba66..0ece5040 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,6 +50,10 @@ script: matrix: include: + - env: NAME="code-style-check" + os: linux + compiler: gcc + - env: NAME="emsk-11-gnu_latest" OSP_ROOT="." BOARD="emsk" BD_VER="11" os: linux compiler: gcc @@ -73,11 +77,3 @@ matrix: - env: NAME="iotdk-gnu-latest" OSP_ROOT="." BOARD="iotdk" os: linux compiler: gcc - - - env: NAME="nsim-gnu-latest" OSP_ROOT="." BOARD="nsim" - os: linux - compiler: gcc - - - env: NAME="emsdp-gnu-latest" OSP_ROOT="." BOARD="emsdp" - os: linux - compiler: gcc \ No newline at end of file From 6b6074e2e6a690648821a328945361d327c5d1ab Mon Sep 17 00:00:00 2001 From: Jingru Date: Wed, 14 Aug 2019 14:28:01 +0800 Subject: [PATCH 09/12] travis: test to get modified examples Signed-off-by: Jingru --- .ci/before_install.sh | 1 + .ci/code_check.sh | 25 +++++++++++++++---------- .ci/expected.ini | 2 +- .ci/get_examples.py | 35 +++++++++++++++++------------------ .ci/script.sh | 6 ++++-- .travis.yml | 7 +++++++ 6 files changed, 45 insertions(+), 31 deletions(-) diff --git a/.ci/before_install.sh b/.ci/before_install.sh index 39c144d6..e0d13bb8 100644 --- a/.ci/before_install.sh +++ b/.ci/before_install.sh @@ -27,4 +27,5 @@ fi pip install XlsxWriter || die pip install cpplint || die pip install flake8 || die + pip install sh || die } diff --git a/.ci/code_check.sh b/.ci/code_check.sh index 9eb13902..90f95e9a 100644 --- a/.ci/code_check.sh +++ b/.ci/code_check.sh @@ -7,18 +7,23 @@ die() } # When pull request, check code style -if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then - c_style_check=$(git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \ - | ( grep '.\(c\|cpp\|h\|hpp\)$' || true ) \ - | while read file; do cpplint "${file}"; done) - python_style_check=$(git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \ - | ( grep '.\(py\)$' || true ) \ - | while read file; do flake8 "${file}"; done) +if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then + git diff --name-only --diff-filter=d FETCH_HEAD..master \ + | ( grep '.\(c\|cpp\|h\|hpp\)$' || true ) \ + | while read file; do cpplint "${file}" >> result.log 2>&1; done + - COMMENT_HEAD="## Code Style Check Result \n***********************\n
"
+    git diff --name-only --diff-filter=d FETCH_HEAD..master \
+        | ( grep '.\(py\)$' || true ) \
+        | while read file; do flake8 "${file}" >> result.log 2>&1; done
+
+
+    COMMENT_CONTENT=$(sed 's/$/&
/g' build/result.log) + COMMENT_HEAD="# Sphinx link check result \n***********************\n
"
     COMMENT_TAIL="
" - COMMENT="${COMMENT_HEAD}${c_style_check}\n${python_style_check}${COMMENT_TAIL}" + COMMENT="${COMMENT_HEAD}${COMMENT_CONTENT}${COMMENT_TAIL}" bash -c "$COMMENTS" exit 0 + fi -exit 0 + diff --git a/.ci/expected.ini b/.ci/expected.ini index d742edf6..afbda141 100644 --- a/.ci/expected.ini +++ b/.ci/expected.ini @@ -34,7 +34,7 @@ iotdk= [embarc_applications/aws_iot_smarthome_secureshield/src] iotdk= hsdk= -emsk=22,23 +emsk= [embarc_applications/ilight_smartdevice/src] iotdk= diff --git a/.ci/get_examples.py b/.ci/get_examples.py index 5457873f..b7a46271 100644 --- a/.ci/get_examples.py +++ b/.ci/get_examples.py @@ -1,48 +1,52 @@ +import os +import json +import argparse import git from embarc_tools.utils import cd, getcwd from embarc_tools.settings import MAKEFILENAMES -import os -import sh -import logging -import argparse def parse_args(): parser = argparse.ArgumentParser( description="Generate a sanitycheck argument for for tests " " that have changed") - parser.add_argument("--root", help= default=getcwd(), + parser.add_argument("--root", default=getcwd(), help="Specify the repo root directory") parser.add_argument('--commit_start', default=None, help="Commit range start point") parser.add_argument('--commit_end', default=None, help="Commit range end point") - parser.add_argument('--only_failed', default=None, + parser.add_argument('--only_failed', action="store_true", help="Commit range end point") return parser.parse_args() def find_embarc_appl(root): cur_path = root - cur_dir = os.apth.dirname(root) + cur_dir = os.path.dirname(root) while cur_path != cur_dir: for item in os.listdir(cur_dir): if item in MAKEFILENAMES: return cur_dir cur_path = cur_dir - cur_dir = os.apth.dirname(cur_path) + cur_dir = os.path.dirname(cur_path) def get_modified_examples(root, tree0, tree1): + root = os.path.abspath(root) + dirname = os.path.basename(root) repo = git.Repo(root) diff_cmd = ["--name-only"] diff_cmd.append("{}..{}".format(tree0, tree1)) examples_changed = list() update = repo.git.diff(diff_cmd).split("\n") for item in update: - example_root = find_embarc_appl(item) - if example_root: - examples_changed.append(example_root) + if not item.startswith("."): + item_path = os.path.join(root, item) + example_root = find_embarc_appl(item_path) + if example_root: + example_root = example_root.replace(root, dirname) + examples_changed.append(example_root) return examples_changed @@ -56,26 +60,21 @@ def get_last_failed(file=None): if not job: job = os.environ.get("STAGE_NAME") if job: - - branch = os.environ.get("TRAVIS_BRANCH") home = os.environ.get("HOME") cache = "{}/.cache/result".format(home) last_failed_cache = os.path.join(cache, job, "failed_results.json") if os.path.exists(last_failed_cache): - last_failed_appls = json.load(last_failed).keys() + last_failed_appls = json.load(last_failed_cache).keys() return last_failed_appls def main(): args = parse_args() - # if not (args.commit_start and args.commit_end): - # exit(1) if args.commit_start and args.commit_end: - examples_changed = get_modified_examples(args.root, args.commit_start, args.commit_end) if examples_changed: print("%s" %(",".join(examples_changed))) - if only_failed: + if args.only_failed: last_failed_appls = get_last_failed() if last_failed_appls: print("%s" %(",".join(last_failed_appls))) diff --git a/.ci/script.sh b/.ci/script.sh index 287bba13..9ae74ae0 100644 --- a/.ci/script.sh +++ b/.ci/script.sh @@ -4,7 +4,6 @@ die() { } if [ "$NAME" == "code-style-check" ]; then - ls bash .ci/code_check.sh || die else TOOLCHAIN_CACHE_FOLDER=".cache/toolchain" @@ -18,7 +17,10 @@ else fi if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - EXAMPLES=$(.ci/get_examples.py --root ${HOME}--commit_start FETCH_HEAD --commit_end master) + modified_example=$(python .ci/get_examples.py --root . --commit_start FETCH_HEAD --commit_end master) + if [ "$modified_example" ]; then + EXAMPLES="$modified_example" + fi fi U_NAME=${U_NAME:=embARC_Bot} diff --git a/.travis.yml b/.travis.yml index 0ece5040..3498e3c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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' - EXPECTED=".ci/expected.ini" - TOOLCHAIN="gnu" - TOOLCHAIN_VER="latest" From 91cd9c7baf91476a5fa1205cb1c6618bb8119cfc Mon Sep 17 00:00:00 2001 From: Jingru Date: Fri, 16 Aug 2019 10:41:52 +0800 Subject: [PATCH 10/12] travis: modify code_check.sh Signed-off-by: Jingru --- .ci/code_check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/code_check.sh b/.ci/code_check.sh index 90f95e9a..a79cc006 100644 --- a/.ci/code_check.sh +++ b/.ci/code_check.sh @@ -18,7 +18,7 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then | while read file; do flake8 "${file}" >> result.log 2>&1; done - COMMENT_CONTENT=$(sed 's/$/&
/g' build/result.log) + COMMENT_CONTENT=$(sed 's/$/&
/g' result.log) COMMENT_HEAD="# Sphinx link check result \n***********************\n
"
     COMMENT_TAIL="
" COMMENT="${COMMENT_HEAD}${COMMENT_CONTENT}${COMMENT_TAIL}" From 9dea5351452bfed589c0074ef967b2717e0da9c6 Mon Sep 17 00:00:00 2001 From: Jingru Date: Fri, 16 Aug 2019 10:52:12 +0800 Subject: [PATCH 11/12] travis: modify code_check.sh Signed-off-by: Jingru --- .ci/code_check.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/.ci/code_check.sh b/.ci/code_check.sh index a79cc006..bd4ba106 100644 --- a/.ci/code_check.sh +++ b/.ci/code_check.sh @@ -23,7 +23,4 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then COMMENT_TAIL="
" COMMENT="${COMMENT_HEAD}${COMMENT_CONTENT}${COMMENT_TAIL}" bash -c "$COMMENTS" - exit 0 - fi - From 68bcf1899b136f5b27619605f6841bf2947e3c42 Mon Sep 17 00:00:00 2001 From: Jingru Date: Tue, 20 Aug 2019 17:53:52 +0800 Subject: [PATCH 12/12] travis: modify comment head Signed-off-by: Jingru --- .ci/code_check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/code_check.sh b/.ci/code_check.sh index bd4ba106..7946728c 100644 --- a/.ci/code_check.sh +++ b/.ci/code_check.sh @@ -19,7 +19,7 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then COMMENT_CONTENT=$(sed 's/$/&
/g' result.log) - COMMENT_HEAD="# Sphinx link check result \n***********************\n
"
+    COMMENT_HEAD="# Code style check result \n***********************\n
"
     COMMENT_TAIL="
" COMMENT="${COMMENT_HEAD}${COMMENT_CONTENT}${COMMENT_TAIL}" bash -c "$COMMENTS"