From 8ce83bf2bdff39d79dfc6ade52070533045e3d89 Mon Sep 17 00:00:00 2001 From: seuzw <930zhaowei@163.com> Date: Wed, 3 Aug 2022 16:07:15 +0800 Subject: [PATCH] add ci to re2-rust project --- Cargo.toml | 4 ++++ ci/00-pre.sh | 11 +++++++++++ ci/01-base.sh | 24 ++++++++++++++++++++++++ ci/02-examples.sh | 3 +++ ci/README.md | 9 +++++++++ re2/Cargo.toml | 24 ++++++++++++++++++++++++ re2/re2.rs | 1 + 7 files changed, 76 insertions(+) create mode 100644 Cargo.toml create mode 100755 ci/00-pre.sh create mode 100755 ci/01-base.sh create mode 100755 ci/02-examples.sh create mode 100644 ci/README.md create mode 100644 re2/Cargo.toml create mode 100644 re2/re2.rs diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..86162aa --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,4 @@ +[workspace] +members = [ + "re2", +] diff --git a/ci/00-pre.sh b/ci/00-pre.sh new file mode 100755 index 0000000..e5b0c7f --- /dev/null +++ b/ci/00-pre.sh @@ -0,0 +1,11 @@ +#!/bin/bash +sudo yum clean all +sudo yum install -y gcc openssl-libs + +#git操作加速并安装rust工具链 +git config --global url."https://github.91chi.fun/https://github.com/".insteadOf "https://github.com/" +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustlang.sh +sh rustlang.sh -y + +source ~/.bashrc + diff --git a/ci/01-base.sh b/ci/01-base.sh new file mode 100755 index 0000000..5b3bdd5 --- /dev/null +++ b/ci/01-base.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +#开始执行检查 +cargo fmt --all -- --check -v +cargo clean + +cargo clippy --all-targets --all-features --tests --benches -- -v +cargo clean + +cargo check +cargo clean + +bins=$(sed -n '/[[bin]]/ {n;p}' Cargo.toml | sed 's/\"//g' | sed 's/name = //g') +for rust_bin in $bins +do +echo $rust_bin +cargo rustc --bin $rust_bin -- -D warnings -v +done + +cargo build --release -v + +RUST_BACKTRACE=1 cargo test --all -- --nocapture + +cargo doc --all --no-deps diff --git a/ci/02-examples.sh b/ci/02-examples.sh new file mode 100755 index 0000000..01286b0 --- /dev/null +++ b/ci/02-examples.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +#RUST_BACKTRACE=1 cargo run --example signals diff --git a/ci/README.md b/ci/README.md new file mode 100644 index 0000000..a8e6dca --- /dev/null +++ b/ci/README.md @@ -0,0 +1,9 @@ +# 此处为门禁测试脚本 + +## 1. 00-pre.sh为环境准备脚本,在门禁的最开始执行. + +## 2. [0-9]开头的脚本, 以字典序依次串行执行. 可自行添加或修改对应脚本. + +- 脚本以两位数字开头,.sh结尾, 按字典序排列 +- 每个脚本对应一个完整的测试用例,负责环境的准备和清理 +- 脚本一旦出现非0返回值就会报错退出 \ No newline at end of file diff --git a/re2/Cargo.toml b/re2/Cargo.toml new file mode 100644 index 0000000..dcd72cf --- /dev/null +++ b/re2/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "re2" +version = "0.1.0" +authors = ["seuzw <930zhaowei@163.com>"] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lib] +crate-type = ["lib"] +path = "re2.rs" +name = "re2" + +toml = "0.5.8" +serde_derive = "1.0.130" +serde = "1.0.130" +log = "0.4" +log4rs = "1.0" +thiserror = "1.0" +anyhow = "1.0" +http = "0.2.6" +procfs = "0.12.0" +nix = "0.23.0" +pathdiff = "0.2.1" diff --git a/re2/re2.rs b/re2/re2.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/re2/re2.rs @@ -0,0 +1 @@ + -- Gitee