Skip to content

Commit ed7cc28

Browse files
committed
ci: fix comment content
move ci script location Signed-off-by: Jingru Wang <jingru@synopsys.com>
1 parent bf32fc5 commit ed7cc28

File tree

4 files changed

+11
-40
lines changed

4 files changed

+11
-40
lines changed

.travis.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,7 @@ env:
1414
"context": "travis-ci/$NAME",
1515
"target_url": "https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID"
1616
}\nDATA'
17-
18-
COMMENT=none
19-
COMMENTS=$'curl -so/dev/null --user "$EMBARC_BOT" --request POST
20-
https://api.github.com/repos/$TRAVIS_REPO_SLUG/issues/$TRAVIS_PULL_REQUEST/comments
21-
--data @- << DATA\n{
22-
"body": "$COMMENT"
23-
}\nDATA'
17+
2418
- TOOLCHAIN_VER="2020.09"
2519
- OSP_ROOT="."
2620
- EXAMPLES="example/baremetal,example/freertos"
@@ -39,7 +33,7 @@ before_install:
3933
# setup git config
4034
- git config --global user.name "embARC Automated Bot"
4135
- git config --global user.email "jingru@synopsys.com"
42-
- bash .ci/before_install.sh
36+
- bash ./scripts/.ci/before_install.sh
4337

4438
after_success:
4539
- bash -c "$STATUS" success "Local $NAME testing has passed"
@@ -48,7 +42,7 @@ after_failure:
4842
- bash -c "$STATUS" failure "Local $NAME testing has failed"
4943

5044
script:
51-
- bash .ci/script.sh
45+
- bash ./scripts/.ci/script.sh
5246

5347
matrix:
5448
include:
File renamed without changes.

.ci/script.sh renamed to scripts/.ci/script.sh

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,6 @@ die() {
77
exit 1
88
}
99

10-
_get_repo_revision() {
11-
if [[ -d $1 ]]; then
12-
cd $1
13-
repo_hash_commit=$(git rev-parse HEAD)
14-
echo -n ${repo_hash_commit}
15-
cd $OLDPWD
16-
else
17-
echo "[Error] $1 doesn't exist"
18-
fi
19-
}
20-
2110
prepare_env() {
2211
out_dir="${_DIR}/out"
2312
logs_dir="${_DIR}/logs"
@@ -30,7 +19,7 @@ prepare_env() {
3019

3120
[ "${TRAVIS}" == "true" ] && {
3221
if [ "${TOOLCHAIN}" == "gnu" ] ; then
33-
python .ci/toolchain.py -v $TOOLCHAIN_VER -c $TOOLCHAIN_CACHE_FOLDER || die
22+
python scripts/.ci/toolchain.py -v $TOOLCHAIN_VER -c $TOOLCHAIN_CACHE_FOLDER || die
3423
if [ -d $TOOLCHAIN_CACHE_FOLDER ] ; then
3524
if [ -d $TOOLCHAIN_CACHE_FOLDER/$TOOLCHAIN_VER ] ; then
3625
ARC_DEV_TOOL_ROOT="${TOOLCHAIN_CACHE_FOLDER}/${TOOLCHAIN_VER}"
@@ -63,31 +52,19 @@ run_test() {
6352
export PYTHONUNBUFFERED=1
6453
{
6554
hostname
66-
python ./scripts/test.py --platform $BOARD --toolchain $TOOLCHAIN $target_flags --build-only --report-dir logs_dir || {
67-
if [[ $? == 124 ]]; then
68-
echo "twister timeout"
69-
fi
70-
true
71-
}
55+
python ./scripts/test.py --platform $BOARD --toolchain $TOOLCHAIN $target_flags --build-only --report-dir $logs_dir || true
7256
} 2>&1 | tee -a $test_log
7357
}
7458

7559
parse_logs() {
7660
# get rid of MAC \r and change it to UNIX \n
7761
sed -i 's/\r/\n/g' $test_log
78-
# use sed remove ANSI color codes. \x1B is the escape special character, \[ is the second character of the escape sequence, [0-9] is the color value(s) regex
79-
sed -i -r 's/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g' $test_log
80-
failed=$(cat $test_log | sed -n 's/^.*, \([0-9]\+\) .*failed.*$/\1 /p')
81-
embarc_osp_repo_commit=$(_get_repo_revision ${_DIR})
82-
COMMENT=""
83-
if ! [[ $failed == 0 ]]; then
84-
comment_url="https://api.github.com/repos/$TRAVIS_REPO_SLUG/commits/$embarc_osp_repo_commit/comments"
85-
for line in $(grep "build status:" $test_log | sed -E 's/^.* (.*) failed.*$/\1/'); do
86-
COMMENT="$COMMENT<br>$line"
87-
done
88-
curl --user "$EMBARC_BOT" --request POST https://api.github.com/repos/$TRAVIS_REPO_SLUG/commits/$embarc_osp_repo_commit/comments \
89-
--data '{"body":"'${COMMENT}'"}'
90-
fi
62+
63+
METRICS=$(cat $test_log | grep "test configurations passed" | sed -n 's/^.*-\(.*\)*$/\1/p')
64+
COMMENT="$BOARD ${BD_VER:-} test results: $METRICS"
65+
66+
curl --user "$EMBARC_BOT" --request POST https://api.github.com/repos/$TRAVIS_REPO_SLUG/commits/$TRAVIS_COMMIT/comments \
67+
--data '{"body":"'"${COMMENT}"'"}'
9168
}
9269

9370
main() {
File renamed without changes.

0 commit comments

Comments
 (0)