Skip to content

Commit 5f40538

Browse files
Cruz Monrreal IICruz Monrreal II
authored andcommitted
Re-enabled PR status reporting.
Added external bash file to source functions from
1 parent f9f9b60 commit 5f40538

File tree

2 files changed

+57
-8
lines changed

2 files changed

+57
-8
lines changed

.travis.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,37 @@ language: sh
1818
os: linux
1919
dist: xenial
2020

21+
2122
cache:
2223
pip: true
2324
directories:
2425
- $HOME/.cache/apt
2526
- $HOME/gcc-arm-none-eabi-6-2017-q2-update
2627

28+
2729
before_install:
30+
- source tools/test/travis-ci/functions.sh
31+
- set_status "pending" "Test started."
32+
2833
# Make sure pipefail
29-
- set -o pipefail
34+
#- set -o pipefail
3035
# Setup apt to cache
31-
- mkdir -p $HOME/.cache/apt/partial
32-
- sudo rm -rf /var/cache/apt/archives
33-
- sudo ln -s $HOME/.cache/apt /var/cache/apt/archives
36+
#- mkdir -p $HOME/.cache/apt/partial
37+
#- sudo rm -rf /var/cache/apt/archives
38+
#- sudo ln -s $HOME/.cache/apt /var/cache/apt/archives
3439
# Setup ppa to make sure arm-none-eabi-gcc is correct version
35-
- sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
36-
- sudo add-apt-repository -y ppa:deadsnakes/ppa
40+
#- sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
41+
#- sudo add-apt-repository -y ppa:deadsnakes/ppa
3742
# 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
38-
- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 762E3157
43+
#- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 762E3157
3944
# Loop until update succeeds (timeouts can occur)
40-
- travis_retry $(! sudo apt-get update 2>&1 |grep Failed)
45+
#- travis_retry $(! sudo apt-get update 2>&1 |grep Failed)
46+
47+
after_success:
48+
- set_status "success" "Success!"
49+
50+
after_failure:
51+
-set_status "failure" "Test failed."
4152

4253

4354
matrix:

tools/test/travis-ci/functions.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash -euf
2+
#
3+
# Copyright (c) 2013-2018 Arm Limited. All rights reserved.
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the License); you may
8+
# not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
15+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
19+
set -o pipefail
20+
21+
info() { echo "I: ${1}"; }
22+
die() { echo "E: ${1}" 1>&2; exit ${2:-1}; }
23+
24+
set_status()
25+
{
26+
local _name=${NAME}
27+
local _payload=$(<<< "
28+
{
29+
'state': '${1}',
30+
'description': '${2}',
31+
'context': 'travis-ci/${_name}',
32+
'target_url': 'https://travis-ci.org/${TRAVIS_REPO_SLUG}/jobs/${TRAVIS_JOB_ID}'
33+
}" tr '"' '"')
34+
35+
curl --silent --output /dev/null --user "${MBED_BOT}" --request POST \
36+
"https://api.github.com/repos/${TRAVIS_REPO_SLUG}/statuses/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT}" \
37+
--data @- <<< "${payload}"
38+
}

0 commit comments

Comments
 (0)