From 1284a91d296825a0428dc85cb34378b103cb8636 Mon Sep 17 00:00:00 2001 From: driftluo Date: Fri, 30 Aug 2024 12:03:53 +0800 Subject: [PATCH] test: add check relax ordering on ci --- devtools/ci/check-relaxed.sh | 28 ++++++++++++++++++++++++++++ devtools/ci/ci_main.sh | 1 + 2 files changed, 29 insertions(+) create mode 100644 devtools/ci/check-relaxed.sh diff --git a/devtools/ci/check-relaxed.sh b/devtools/ci/check-relaxed.sh new file mode 100644 index 00000000000..470fc1e85d4 --- /dev/null +++ b/devtools/ci/check-relaxed.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +set -euo pipefail + +case "$OSTYPE" in + darwin*) + if ! type gsed &>/dev/null || ! type ggrep &>/dev/null; then + echo "GNU sed and grep not found! You can install via Homebrew" >&2 + echo >&2 + echo " brew install grep gnu-sed" >&2 + exit 1 + fi + + SED=gsed + GREP=ggrep + ;; + *) + SED=sed + GREP=grep + ;; +esac + +find ./ -not -path '*/target/*' -type f -name "*.rs" | xargs grep -H "Relaxed" + +if [ $? -eq 0 ]; then + echo "find use Relaxed on code, please check" + exit 1 +fi diff --git a/devtools/ci/ci_main.sh b/devtools/ci/ci_main.sh index f3ff03a86bb..33242b30359 100755 --- a/devtools/ci/ci_main.sh +++ b/devtools/ci/ci_main.sh @@ -60,6 +60,7 @@ case $GITHUB_WORKFLOW in make check-dirty-rpc-doc make check-dirty-hashes-toml devtools/ci/check-cyclic-dependencies.py + devtools/ci/check-relaxed.sh ;; ci_aarch64_build*) echo "ci_aarch64_build"