Skip to content

Commit

Permalink
chore: adjust skip script (ant-design#46027)
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ authored Nov 22, 2023
1 parent 110e1b3 commit 36768c4
Showing 1 changed file with 88 additions and 32 deletions.
120 changes: 88 additions & 32 deletions scripts/test-all.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,49 @@
#!/bin/sh
#!/bin/bash

echo "[TEST ALL] test changelog"
echo "[TEST ALL] test changelog" > ~test-all.txt
tsx ./scripts/check-version-md.ts
# Full skip argms
# npm run test-all -- --skip-changelog --skip-commit --skip-lint --skip-build --skip-dekko --skip-dist --skip-es --skip-lib --skip-test --skip-node

echo "[TEST ALL] check-commit"
echo "[TEST ALL] check-commit" > ~test-all.txt
npm run check-commit
# Check exist argument
has_arg() {
local term="$1"
local start=0

echo "[TEST ALL] lint"
echo "[TEST ALL] lint" > ~test-all.txt
npm run lint
for arg in "$@"; do
if [ $start -gt 0 ] && [ "$arg" == "$term" ]; then
return 0 # Return 0 if argument exist
fi

if [ "$1" != "--skip-build" ]; then
start=$((start+1))
done

return 1 # Return 1 if argument not exist
}

if ! has_arg '--skip-changelog' "$@"; then
echo "[TEST ALL] test changelog"
echo "[TEST ALL] test changelog" > ~test-all.txt
tsx ./scripts/check-version-md.ts
else
echo "[TEST ALL] test changelog...skip"
fi

if ! has_arg '--skip-commit' "$@"; then
echo "[TEST ALL] check-commit"
echo "[TEST ALL] check-commit" > ~test-all.txt
npm run check-commit
else
echo "[TEST ALL] check-commit...skip"
fi

if ! has_arg '--skip-lint' "$@"; then
echo "[TEST ALL] lint"
echo "[TEST ALL] lint" > ~test-all.txt
npm run lint
else
echo "[TEST ALL] lint...skip"
fi

if ! has_arg '--skip-build' "$@"; then
echo "[TEST ALL] dist"
echo "[TEST ALL] dist" > ~test-all.txt
npm run dist
Expand All @@ -21,32 +52,57 @@ if [ "$1" != "--skip-build" ]; then
echo "[TEST ALL] compile" > ~test-all.txt
npm run compile
else
echo "Skip build..."
echo "[TEST ALL] build...skip"
fi

echo "[TEST ALL] dekko dist"
echo "[TEST ALL] dekko dist" > ~test-all.txt
node ./tests/dekko/dist.test.js
if ! has_arg '--skip-dekko' "$@"; then
echo "[TEST ALL] dekko dist"
echo "[TEST ALL] dekko dist" > ~test-all.txt
node ./tests/dekko/dist.test.js

echo "[TEST ALL] dist test"
echo "[TEST ALL] dist test" > ~test-all.txt
LIB_DIR=dist npm test
echo "[TEST ALL] dekko lib"
echo "[TEST ALL] dekko lib" > ~test-all.txt
node ./tests/dekko/lib.test.js
else
echo "[TEST ALL] dekko test...skip"
fi

echo "[TEST ALL] dekko lib"
echo "[TEST ALL] dekko lib" > ~test-all.txt
if ! has_arg '--skip-dist' "$@"; then
echo "[TEST ALL] dist test"
echo "[TEST ALL] dist test" > ~test-all.txt
LIB_DIR=dist npm test -- --bail
else
echo "[TEST ALL] dist test...skip"
fi

echo "[TEST ALL] test es"
echo "[TEST ALL] test es" > ~test-all.txt
LIB_DIR=es npm test
if ! has_arg '--skip-es' "$@"; then
echo "[TEST ALL] test es"
echo "[TEST ALL] test es" > ~test-all.txt
LIB_DIR=es npm test -- --bail
else
echo "[TEST ALL] test es...skip"
fi

echo "[TEST ALL] test lib"
echo "[TEST ALL] test lib" > ~test-all.txt
LIB_DIR=lib npm test
if ! has_arg '--skip-lib' "$@"; then
echo "[TEST ALL] test lib"
echo "[TEST ALL] test lib" > ~test-all.txt
LIB_DIR=lib npm test -- --bail
else
echo "[TEST ALL] test lib...skip"
fi

echo "[TEST ALL] test"
echo "[TEST ALL] test" > ~test-all.txt
npm test
if ! has_arg '--skip-test' "$@"; then
echo "[TEST ALL] test"
echo "[TEST ALL] test" > ~test-all.txt
npm test -- --bail
else
echo "[TEST ALL] test...skip"
fi

echo "[TEST ALL] test node"
echo "[TEST ALL] test node" > ~test-all.txt
npm run test-node
if ! has_arg '--skip-node' "$@"; then
echo "[TEST ALL] test node"
echo "[TEST ALL] test node" > ~test-all.txt
npm run test-node -- --bail
else
echo "[TEST ALL] test node...skip"
fi

0 comments on commit 36768c4

Please sign in to comment.