Re-enabled PR status reporting.

Added external bash file to source functions from
pull/9844/head
Cruz Monrreal II 2019-03-07 13:20:43 -06:00
parent f9f9b60d7e
commit 5f40538c59
2 changed files with 57 additions and 8 deletions

View File

@ -18,26 +18,37 @@ language: sh
os: linux
dist: xenial
cache:
pip: true
directories:
- $HOME/.cache/apt
- $HOME/gcc-arm-none-eabi-6-2017-q2-update
before_install:
- source tools/test/travis-ci/functions.sh
- set_status "pending" "Test started."
# Make sure pipefail
- set -o pipefail
#- set -o pipefail
# Setup apt to cache
- mkdir -p $HOME/.cache/apt/partial
- sudo rm -rf /var/cache/apt/archives
- sudo ln -s $HOME/.cache/apt /var/cache/apt/archives
#- mkdir -p $HOME/.cache/apt/partial
#- sudo rm -rf /var/cache/apt/archives
#- sudo ln -s $HOME/.cache/apt /var/cache/apt/archives
# Setup ppa to make sure arm-none-eabi-gcc is correct version
- sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
- sudo add-apt-repository -y ppa:deadsnakes/ppa
#- sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
#- sudo add-apt-repository -y ppa:deadsnakes/ppa
# workaround for https://travis-ci.community/t/then-sudo-apt-get-update-failed-public-key-is-not-available-no-pubkey-6b05f25d762e3157-in-ubuntu-xenial/1728
- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 762E3157
#- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 762E3157
# Loop until update succeeds (timeouts can occur)
- travis_retry $(! sudo apt-get update 2>&1 |grep Failed)
#- travis_retry $(! sudo apt-get update 2>&1 |grep Failed)
after_success:
- set_status "success" "Success!"
after_failure:
-set_status "failure" "Test failed."
matrix:

View File

@ -0,0 +1,38 @@
#!/bin/bash -euf
#
# Copyright (c) 2013-2018 Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the License); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o pipefail
info() { echo "I: ${1}"; }
die() { echo "E: ${1}" 1>&2; exit ${2:-1}; }
set_status()
{
local _name=${NAME}
local _payload=$(<<< "
{
'state': '${1}',
'description': '${2}',
'context': 'travis-ci/${_name}',
'target_url': 'https://travis-ci.org/${TRAVIS_REPO_SLUG}/jobs/${TRAVIS_JOB_ID}'
}" tr '"' '"')
curl --silent --output /dev/null --user "${MBED_BOT}" --request POST \
"https://api.github.com/repos/${TRAVIS_REPO_SLUG}/statuses/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT}" \
--data @- <<< "${payload}"
}