From e62ad0af2f10144886b061d7f1d5cfd2a15db9ae Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Wed, 16 Dec 2020 15:18:09 -0800 Subject: [PATCH] [github-actions] add toranj under GH actions (#477) --- .github/workflows/toranj.yml | 72 +++++++++++ .travis.yml | 59 --------- .travis/after_success.sh | 75 ----------- .travis/before_install.sh | 46 ------- .travis/check-android-build | 244 ----------------------------------- .travis/deploy.prv.enc | Bin 240 -> 0 bytes .travis/deploy.pub | 1 - .travis/script.sh | 59 --------- 8 files changed, 72 insertions(+), 484 deletions(-) create mode 100644 .github/workflows/toranj.yml delete mode 100644 .travis.yml delete mode 100755 .travis/after_success.sh delete mode 100755 .travis/before_install.sh delete mode 100755 .travis/check-android-build delete mode 100644 .travis/deploy.prv.enc delete mode 100644 .travis/deploy.pub delete mode 100755 .travis/script.sh diff --git a/.github/workflows/toranj.yml b/.github/workflows/toranj.yml new file mode 100644 index 00000000..2a390a7b --- /dev/null +++ b/.github/workflows/toranj.yml @@ -0,0 +1,72 @@ +# +# Copyright (c) 2020, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +name: Toranj + +on: [push, pull_request] + +jobs: + + cancel-previous-runs: + runs-on: ubuntu-20.04 + steps: + - uses: rokroskar/workflow-run-cleanup-action@master + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + if: "github.ref != 'refs/heads/master'" + + toranj-ncp: + runs-on: ubuntu-18.04 + env: + TORANJ_RADIO : 15.4 + steps: + - uses: actions/checkout@v2 + - name: Bootstrap + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + run: | + sudo rm /etc/apt/sources.list.d/* && sudo apt-get update + sudo apt-get --no-install-recommends install -y dbus libdbus-1-dev + sudo apt-get --no-install-recommends install -y autoconf-archive + sudo apt-get --no-install-recommends install -y bsdtar + sudo apt-get --no-install-recommends install -y libtool + sudo apt-get --no-install-recommends install -y libglib2.0-dev + sudo apt-get --no-install-recommends install -y libboost-dev libboost-signals-dev + sudo apt-get --no-install-recommends install -y lcov + + - name: Build & Run + run: | + ./bootstrap.sh + ./configure + sudo make -j2 + sudo make install + + git clone --depth=1 --branch=master https://github.com/openthread/openthread.git + cd openthread + ./tests/toranj/start.sh + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4741a59b..00000000 --- a/.travis.yml +++ /dev/null @@ -1,59 +0,0 @@ -language: cpp - -addons: - apt: - packages: - - bsdtar - - libdbus-1-dev - - autoconf-archive - - libglib2.0-dev - - libboost-dev - - libboost-signals-dev - - libboost-system-dev - - libboost-chrono-dev - - libreadline-dev - - libtool - - autoconf-archive - -sudo: required - -os: - - linux - - osx - -compiler: - - gcc - - clang - -before_install: - - .travis/before_install.sh - -before_script: - - if [ "${TRAVIS_OS_NAME}" == "linux" ]; then - sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'; - fi - -script: - - .travis/script.sh - -after_success: - - ssh-agent .travis/after_success.sh - -env: - - BUILD_MAKEPATH=build BUILD_MAKEARGS="distcheck" TAR=bsdtar - - BUILD_MAKEPATH=build BUILD_MAKEARGS="distcheck" TAR=bsdtar BUILD_CONFIGFLAGS=--with-boost=internal - - BUILD_MAKEPATH=build BUILD_MAKEARGS="distcheck" TAR=bsdtar BUILD_CONFIGFLAGS=--with-boost=internal --enable-append-network-time-received-timestamp - -matrix: - allow_failures: - - os: osx # See issue #245: "Travis macOS builds are failing" - exclude: - - os: osx - compiler: gcc - include: - - env: BUILD_TARGET="toranj-test-framework" VERBOSE=1 - os: linux - compiler: gcc - - env: BUILD_TARGET="android-build" VERBOSE=1 - os: linux - dist: trusty diff --git a/.travis/after_success.sh b/.travis/after_success.sh deleted file mode 100755 index 82833165..00000000 --- a/.travis/after_success.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2016 Nest Labs, Inc. -# All rights reserved. -# -# 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 -# -# 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. -# - -PREV_PATH="`pwd`" - -die() { - echo " *** ERROR: " $* - exit 1 -} - -set -x - -prep_ssh_key() { - openssl aes-256-cbc -K "${encrypted_8f78c13496e8_key}" -iv "${encrypted_8f78c13496e8_iv}" -in .travis/deploy.prv.enc -out .travis/deploy.prv -d && - chmod 600 .travis/deploy.prv && - ssh-add .travis/deploy.prv && - git config --global user.name "Travis CI" && - git config --global user.email "noreply@travis-ci.com" -} - -AUTOCONF_BRANCH="autoconf/$TRAVIS_BRANCH" - - -if [ $TRAVIS_REPO_SLUG = "openthread/wpantund" ] \ -&& [ $TRAVIS_BRANCH = "master" ] \ -&& [ $TRAVIS_OS_NAME = "linux" ] \ -&& [ $TRAVIS_PULL_REQUEST = "false" ] \ -&& [ $BUILD_MAKEPATH = "build" ] \ -&& [ $BUILD_MAKEARGS = "distcheck" ] \ -&& prep_ssh_key # -then - git fetch --unshallow origin || git fetch origin || die - - git fetch origin scripts:scripts ${AUTOCONF_BRANCH}:${AUTOCONF_BRANCH} ${TRAVIS_BRANCH}:${TRAVIS_BRANCH} || die - - PREVREV="`git rev-parse ${AUTOCONF_BRANCH}`" - - echo "Checking for update to '${AUTOCONF_BRANCH}'..." - - git checkout scripts || die - - NO_PUSH=1 ./update-autoconf-master ${TRAVIS_BRANCH} || die - - CHANGED_LINES=`git diff "${PREVREV}".."${AUTOCONF_BRANCH}" | grep '^[-+]' | grep -v '^[-+]SOURCE_VERSION=' | wc -l` - - if [ "$CHANGED_LINES" -gt "2" ] - then - echo "Branch '${AUTOCONF_BRANCH}' is OUT OF DATE." - - git checkout "${TRAVIS_BRANCH}" || die - - git push git@github.com:${TRAVIS_REPO_SLUG}.git ${AUTOCONF_BRANCH}:${AUTOCONF_BRANCH} || die - else - echo "Branch '${AUTOCONF_BRANCH}' is still up-to-date." - fi -else - echo "Skipping update of '${AUTOCONF_BRANCH}'." -fi - -exit 0 diff --git a/.travis/before_install.sh b/.travis/before_install.sh deleted file mode 100755 index 164621ae..00000000 --- a/.travis/before_install.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2016 Nest Labs, Inc. -# All rights reserved. -# -# 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 -# -# 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. -# - -die() { - echo " *** ERROR: " $* - exit 1 -} - -set -x - -[ $TRAVIS_OS_NAME != linux ] || { - wget https://gist.github.com/darconeous/d1d9bc39e0758e45a1d7/raw/ef9b01ac378a9b2e92031c846c4f6b5f94abab53/connman-include.tar.bz2 || die - sudo tar xvjf connman-include.tar.bz2 -C / || die -} - -[ $BUILD_TARGET != android-build ] || { - sudo apt-get install -y gcc-multilib g++-multilib - ( - cd $HOME - wget https://dl.google.com/android/repository/android-ndk-r17c-linux-x86_64.zip - unzip android-ndk-r17c-linux-x86_64.zip > /dev/null - mv android-ndk-r17c ndk-bundle - ) -} - -[ $TRAVIS_OS_NAME != osx ] || { - brew install d-bus - brew install autoconf-archive - brew install libtool - brew install gnu-sed -} diff --git a/.travis/check-android-build b/.travis/check-android-build deleted file mode 100755 index b26f95c6..00000000 --- a/.travis/check-android-build +++ /dev/null @@ -1,244 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2018, The OpenThread Authors. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of the copyright holder nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -set -e -set -x - - -####################################### -# Prepare android build system -# Globals: -# None -# Arguments: -# None -# Returns: -# None -####################################### -prepare_build_system() -{ - # Android build system - BASE_COMMIT=2db32730e79cafcf13e1f898a7bee7f82b0449d6 - # This is the commit containing arm64 target - ARM64_COMMIT=4f0eb7d50c5b472be762c581eeda580a9b8ede1b - (mkdir build && cd build && git init && git pull --depth 1 https://android.googlesource.com/platform/build "${BASE_COMMIT}") - (mkdir build-arm64 && cd build-arm64 && git init && git pull --depth 1 https://android.googlesource.com/platform/build "${ARM64_COMMIT}") - cp -vr build-arm64/core/combo/TARGET_linux-arm64.mk build/core/combo - cp -vr build-arm64/core/combo/arch/arm64 build/core/combo/arch - cp -vr build-arm64/target/board/generic_arm64 build/target/board - cp -vr build-arm64/target/product/aosp_arm64.mk build/target/product - sed -i 's/vbox_x86.mk/aosp_arm64.mk/g' build/target/product/AndroidProducts.mk - sed -i 's/aosp_base_telephony/generic_no_telephony/g;/device.mk/d;/emulator.mk/d' build/target/product/aosp_arm64.mk - sed -i 's/PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O/TARGET_CRTBEGIN_DYNAMIC_O/g;s/PRIVATE_TARGET_GLOBAL_LD_DIRS/TARGET_GLOBAL_LD_DIRS/g' build/core/combo/TARGET_linux-arm64.mk - rm -rf build-arm64 - - ln -s build/core/main.mk Makefile - - # Workarounds for java checking - export ANDROID_JAVA_HOME=/usr/lib/jvm/java-8-oracle - mkdir bin - cat > bin/java < bin/javac < buildspec.mk < "${DBUS_SOURCE}/dbus/Android.mk" <-N7~2N4~QdZ30nkiaZ8#-2%m)OeGQZU&PSP{sIBk66Siq;|CsSWlc3{^U(EV~X*_i3qBj_%{V1c`AS#9rgc{^f?TJ_Y zOGB?%=_&Lo+ll~d@ooa2h1qgu22p_q`gf|hr;5>RmB31N@p_bxH#SM)>`lgj(nuho zNdX=%RIlEZ@A-f5aZaKmDW@ylQ;9;jZflllLH51YIZ$y|(|o1gW7a||kGffVzqmL~ qwwDC#d*WE6>;=6+nnM`qZrpwM6~k8aXXi0DP%IRDt9hdo4gL-PdUvz{ diff --git a/.travis/deploy.pub b/.travis/deploy.pub deleted file mode 100644 index 7c514a08..00000000 --- a/.travis/deploy.pub +++ /dev/null @@ -1 +0,0 @@ -ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEz2HAMQ1MWCP3ukYnuqbyunjIegE5dgN+5bW/YjrOsnO0iuYvh3ZsKf0gBMYdDsGXYE+nRzn9tm4tKVNwjl67w= noreply@travis-ci.org diff --git a/.travis/script.sh b/.travis/script.sh deleted file mode 100755 index 462bf03a..00000000 --- a/.travis/script.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2016 Nest Labs, Inc. -# All rights reserved. -# -# 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 -# -# 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. -# - -PREV_PATH="`pwd`" - -die() -{ - echo " *** ERROR: " $* - exit 1 -} - -set -x - -[ "$BUILD_TARGET" != "toranj-test-framework" ] || { - ./bootstrap.sh || die - ./configure || die - sudo make -j 8 || die - sudo make install || die - - git clone --depth=1 --branch=master https://github.com/openthread/openthread.git - - cd openthread - ./tests/toranj/start.sh || die - exit 0 -} - -[ "$BUILD_TARGET" != android-build ] || { - (cd .. && "${TRAVIS_BUILD_DIR}/.travis/check-android-build") || die - exit 0 -} - -[ $TRAVIS_OS_NAME != linux ] || BUILD_CONFIGFLAGS="${BUILD_CONFIGFLAGS} --with-connman" - -[ -e configure ] || ./bootstrap.sh || die - -mkdir -p "${BUILD_MAKEPATH}" || die - -cd "${BUILD_MAKEPATH}" || die - -../configure ${BUILD_CONFIGFLAGS} || die - -make ${BUILD_MAKEARGS} || die - -cd ..