From 048322aa39c7f183194becb9fad374b49e33a603 Mon Sep 17 00:00:00 2001 From: Apache Mynewt Bot Date: Thu, 6 Feb 2020 09:33:23 -0300 Subject: [PATCH] Add module update CI --- .travis.yml | 13 ++++++++ update_modules.sh | 84 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 .travis.yml create mode 100755 update_modules.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..3066ec37 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +language: go +go: +- '1.13' +git: + depth: false +before_install: +- export GOPATH=$HOME/gopath +script: +- cp update_modules.sh $HOME +- "$HOME/update_modules.sh" +env: + global: + secure: p06m+f+nGdq92hO4J/PZJCPAKmKIlrqXdx7qBAGiNgAmUor46alZz85oqief9MEtBKVvBqGXkPTLVQY4Qpqp90pO8FcE6EsT4B/461sLL7aHdj+RD8x9rlL3KB1qggQrCx4Q+DZgCg0lFeNW55ViDQkT/PwYvJJ4a6HBoMeyLmHWipHLXJB4h8GYK/FCtK2s7Lb/HOAg+pUQu9iS8dTt4TjmzrIjkF6MHoxkUHs/AOKcKlZtSp2TiT18b2Gu1UYPyoZyCIe6Z8HZssQ1lTES0aN0ObS89/IWWvH/YKf8XkRDt8zBEpx4Slcv4aa96BCRlZZ8/xlb/hAXYoB7tGkbLSHhup4UQbe3wZ/sdhlffJBG9BaKjPsDFzXAztFzQIWd9Mj7/16b2oisq39H9H9vL7j3/S7wtfAopkyWrjr98k3WHSWEWgRI5+qBtCajDERpeeUuq/5CG8VOEkMCokklija/ZPoEJEs5ekwObvPARCSfcFW5QdnOhijf8Wz8nPWSoZ65YbhiZk/DTBvbahDjR8IxcfudYI5/oxAyAAVmji4bPOP03cCAwwQ7Z4TKvtrLeUNj8K37wtT6MWunVNprSinUCx2alAEK7H58Ed7I7RxDTENbs/Y13sF6AhlGqO1kDO7Xj7wRGXqo28msAcrV96QPwavSKW0oay8PtN3W6D4= diff --git a/update_modules.sh b/update_modules.sh new file mode 100755 index 00000000..ad1d1827 --- /dev/null +++ b/update_modules.sh @@ -0,0 +1,84 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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 +# +# http://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. + +BRANCH="update-modules" + +pushd $TRAVIS_BUILD_DIR + +#debug +pwd +ls + +# remove any update-modules branch +git branch -D "${BRANCH}" 2>/dev/null + +git remote add upstream https://github.com/apache/mynewt-mcumgr-cli +[[ $? -ne 0 ]] && exit 1 + +git fetch upstream +[[ $? -ne 0 ]] && exit 1 + +# must be running on master to find modules that were updated! +git reset --hard upstream/master + +is_mod=0 +modules=() +while read line; do + if [[ "${line}" == "require (" ]]; then + is_mod=1 + elif [[ $is_mod -eq 1 && "${line}" == ")" ]]; then + is_mod=0 + break + elif [[ $is_mod -eq 1 ]]; then + module="$(echo ${line} | cut -d' ' -f1)" + modules[${#modules[*]}]=$module + fi +done