From 0c58b5dd8420c8e41dc1e98cb4fcb1109db30651 Mon Sep 17 00:00:00 2001 From: Tim Zhang Date: Mon, 25 Jan 2021 16:15:46 +0800 Subject: [PATCH 1/2] Add Makefile So we can use make to build, check and test Signed-off-by: Tim Zhang --- Makefile | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..89fe2a5 --- /dev/null +++ b/Makefile @@ -0,0 +1,37 @@ +all: debug fmt test + +# +# Build +# + +.PHONY: debug +debug: + RUSTFLAGS="--deny warnings" cargo build + +.PHONY: release +release: + cargo build --release + +.PHONY: build +build: debug + +# +# Tests and linters +# + +.PHONY: test +test: + cargo test -- --color always --nocapture + +.PHONY: check +check: fmt clippy + + +.PHONY: fmt +fmt: + cargo fmt --all -- --check + +.PHONY: clippy +clippy: + cargo clippy --all-targets --all-features -- -D warnings + From 88a45d4922d26a8979a0294fa047be00a53f0bf0 Mon Sep 17 00:00:00 2001 From: Tim Zhang Date: Mon, 25 Jan 2021 16:17:03 +0800 Subject: [PATCH 2/2] Migrate the CI from travis-ci to Github Actions Because travis-ci.org will be shutting down. Signed-off-by: Tim Zhang --- .github/workflows/bvt.yaml | 26 ++++++++++++++++++++++++++ .travis.yml | 31 ------------------------------- 2 files changed, 26 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/bvt.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/bvt.yaml b/.github/workflows/bvt.yaml new file mode 100644 index 0000000..9471fc0 --- /dev/null +++ b/.github/workflows/bvt.yaml @@ -0,0 +1,26 @@ +name: BVT +on: [pull_request] +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Build + run: make debug + + fmt: + name: Format Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: rustup component add rustfmt + - run: make fmt + test: + name: Run Unit Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: make test + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 298cd6a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) 2018 Levente Kurusa -# Copyright (c) 2020 Ant Group -# -# SPDX-License-Identifier: Apache-2.0 -# - -dist: bionic -os: linux -language: rust -cache: cargo - -arch: - - amd64 - - arm64 - -install: - - rustup component add rustfmt - -script: - - RUSTFLAGS="--deny warnings" cargo build - - if [ "$TRAVIS_CPU_ARCH" == "amd64" ]; then cargo test -- --color always --nocapture ; fi - - cargo fmt -- --check - -rust: - - 1.44.1 - - nightly - -jobs: - allow_failures: - - rust: nightly - fast_finish: true