From d8c53927738d9664633ccfdca8634057b50d989f Mon Sep 17 00:00:00 2001 From: kangping Date: Tue, 25 Jan 2022 13:44:38 +0800 Subject: [PATCH] [testing] replace travis CI tests with Github Action flows --- .../workflows/build.yml | 28 ++++++++++++---- .travis/script.sh | 32 ------------------- script/bootstrap.sh | 13 +++----- .../google/openthread/LoggerInitializer.java | 5 +-- 4 files changed, 30 insertions(+), 48 deletions(-) rename .travis/before_install.sh => .github/workflows/build.yml (74%) mode change 100755 => 100644 delete mode 100755 .travis/script.sh diff --git a/.travis/before_install.sh b/.github/workflows/build.yml old mode 100755 new mode 100644 similarity index 74% rename from .travis/before_install.sh rename to .github/workflows/build.yml index 12c146c..bf1cf62 --- a/.travis/before_install.sh +++ b/.github/workflows/build.yml @@ -1,4 +1,3 @@ -#!/bin/bash # # Copyright (c) 2020, The OpenThread Registrar Authors. # All rights reserved. @@ -27,10 +26,27 @@ # POSSIBILITY OF SUCH DAMAGE. # -set -e +name: Build -if [ "${TRAVIS_OS_NAME}" == "linux" ]; then - sudo /sbin/sysctl -w net.ipv6.conf.lo.disable_ipv6=0 -fi +on: [push, pull_request] -./script/bootstrap.sh +jobs: + + cancel-previous-runs: + runs-on: ubuntu-latest + steps: + - uses: rokroskar/workflow-run-cleanup-action@master + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + if: "github.ref != 'refs/heads/main'" + + package-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Bootstrap + run: script/bootstrap.sh + - name: Package + run: mvn package -Dmaven.test.skip=true + - name: Test + run: mvn test diff --git a/.travis/script.sh b/.travis/script.sh deleted file mode 100755 index 7aa5015..0000000 --- a/.travis/script.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2019, The OpenThread Registrar 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 - -mvn package diff --git a/script/bootstrap.sh b/script/bootstrap.sh index 552adee..3d7a6e0 100755 --- a/script/bootstrap.sh +++ b/script/bootstrap.sh @@ -29,8 +29,6 @@ set -e -ACE_REPO=https://bitbucket.org/marco-tiloca-sics/ace-java - ## Test if we has the given command. ## Args: $1, the command. has_command() { @@ -62,13 +60,12 @@ install_toolchain() { } install_ace() { - if [ ! -d ace ]; then - git clone $ACE_REPO ace - fi - cd ace - mvn -DskipTests install + cd /tmp + if [ ! -f ace ]; then + wget --inet4-only https://bitbucket.org/wgtdkp/ace-java/downloads/ace-0.0.1-SNAPSHOT-be8c6ee9.jar + mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile=ace-0.0.1-SNAPSHOT-be8c6ee9.jar + fi cd - - rm -rf ace } install_toolchain diff --git a/src/main/java/com/google/openthread/LoggerInitializer.java b/src/main/java/com/google/openthread/LoggerInitializer.java index 0d4bab7..e22ea7d 100644 --- a/src/main/java/com/google/openthread/LoggerInitializer.java +++ b/src/main/java/com/google/openthread/LoggerInitializer.java @@ -30,6 +30,7 @@ import ch.qos.logback.classic.Level; import ch.qos.logback.classic.Logger; +import org.apache.logging.log4j.core.config.Configurator; import org.slf4j.LoggerFactory; public class LoggerInitializer { @@ -40,10 +41,10 @@ public class LoggerInitializer { public static void Init(boolean verbose) { if (verbose) { ((Logger) LoggerFactory.getLogger(CALIFORNIUM)).setLevel(Level.DEBUG); - org.apache.log4j.Logger.getLogger(OPENTHREAD).setLevel(org.apache.log4j.Level.DEBUG); + Configurator.setLevel(OPENTHREAD, org.apache.logging.log4j.Level.DEBUG); } else { ((Logger) LoggerFactory.getLogger(CALIFORNIUM)).setLevel(Level.INFO); - org.apache.log4j.Logger.getLogger(OPENTHREAD).setLevel(org.apache.log4j.Level.INFO); + Configurator.setLevel(OPENTHREAD, org.apache.logging.log4j.Level.INFO); } } }