From 4553a339bacf72e818781b6f8d961bdb8f60b5e6 Mon Sep 17 00:00:00 2001 From: Wu Xiaotian Date: Fri, 1 Mar 2019 16:43:57 +0800 Subject: [ci] Use status notification --- .travis.yml | 48 ++++++++++++------------------------------------ 1 file changed, 12 insertions(+), 36 deletions(-) diff --git a/.travis.yml b/.travis.yml index 80152e3f..6c54fe17 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,8 @@ branches: before_install: - curl -Ls -o docker-build https://github.com/mate-desktop/mate-dev-scripts/raw/travis/travis/docker-build - - chmod +x docker-build + - curl -Ls -o gen-index https://github.com/mate-desktop/mate-dev-scripts/raw/travis/travis/gen-index.sh + - chmod +x docker-build gen-index install: - sudo apt-get install -y python3-pip python3-setuptools @@ -36,15 +37,21 @@ deploy: after_success: - 'if [[ "$TRAVIS_SECURE_ENV_VARS" == "true" && "$TRAVIS_PULL_REQUEST" != "false" && ${DISTRO} =~ ^fedora.*$ ]]; then - COMMENT="[Notification]: Clang Analyzer results of $TRAVIS_COMMIT at https://mate-desktop.github.io/${TRAVIS_REPO_SLUG#*/}/"; - curl -H "Authorization: token $GITHUB_TOKEN" -X POST -d "{\"body\": \"$COMMENT\"}" "https://api.github.com/repos/${TRAVIS_REPO_SLUG}/issues/${TRAVIS_PULL_REQUEST}/comments" >/dev/null; - fi' + REPO_SLUG_ARRAY=(${TRAVIS_REPO_SLUG//\// }); + REPO_NAME=${REPO_SLUG_ARRAY[1]}; + URL="https://${REPO_NAME}.mate-desktop.dev"; + COMMENT="Code analysis completed"; + curl -H "Authorization: token $GITHUB_TOKEN" -X POST + -d "{\"state\": \"success\", \"description\": \"$COMMENT\", \"context\":\"scan-build\", \"target_url\": \"$URL\"}" + https://api.github.com/repos/${TRAVIS_REPO_SLUG}/statuses/${TRAVIS_PULL_REQUEST_SHA}; + fi' env: - DISTRO="archlinux/base" - DISTRO="debian:sid" - DISTRO="fedora:29" - DISTRO="ubuntu:18.10" + ########################################################## # THE FOLLOWING LINES IS USED BY docker-build ########################################################## @@ -201,37 +208,6 @@ before_scripts: after_scripts: - if [ ${DISTRO_NAME} == "fedora" ];then - - cat > index.html < - - - - - - - - - - $REPO_NAME Code Analizer - - - -

- - ${OWNER_NAME}/$REPO_NAME - -

- - GitHub - - Build Status - -
- - 'Commit: $TRAVIS_COMMIT
' - - 'Compare: $TRAVIS_COMMIT_RANGE
' - - 'Branch: $TRAVIS_BRANCH
' - - 'Time: `date --rfc-3339=seconds`
' - - 'Messages:
' - -
-  -     $TRAVIS_COMMIT_MESSAGE
-  -     
- -
- - " >> index.html - - echo "" >> index.html - - echo "" >> index.html - - mv index.html html-report + - ./gen-index -i https://raw.githubusercontent.com/${OWNER_NAME}/${REPO_NAME}/master/icons/16x16/${REPO_NAME}.png - fi - make distcheck -- cgit v1.2.1