Skip to content

Commit be8b6ed

Browse files
committed
more flexible version of PDC. Allows pre and post operations and cache cleans
1 parent d96b97a commit be8b6ed

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

pdc.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,56 @@
99
#
1010
# If you want to customize it or adapt the checks, just add or remove it from/ to the ACTIONS
1111

12+
# Preparation steps run before the first action is executed
13+
# Typically we clear here the python cache to prevent dirty
14+
# test results from cached python programs.
15+
PRE_GLOBAL=("clear_pycache")
16+
17+
# Postprocessing steps run after the last ACTION has finished
18+
POST_GLOBAL=()
19+
20+
# Preprocessing steps run before each action is executed
21+
PRE_ACT=()
22+
23+
# Postprocessing steps run after each action is executed
24+
POST_ACT=()
1225

1326
ACTIONS=("cargo build" "cargo build --release" "cargo fmt --all" "cargo clippy --all -- -Dwarnings" "cargo test --all" "cargo run --release -- -m test -v" "cd tests" "pytest" "cd ..")
1427

1528
# Usually, there should be no need to adapt the remaining file, when adding or removing actions.
1629

30+
# clears the python cache or RustPython
31+
clear_pycache() { find . -name __pycache__ -type d -exec rm -r {} \; ; }
1732

1833
RUSTPYTHONPATH=Lib
1934
export RUSTPYTHONPATH
2035

2136
ACT_RES=0
2237
FAILS=()
2338

39+
for pre in "${PRE_GLOBAL[@]}"; do
40+
$pre
41+
done
42+
2443
for act in "${ACTIONS[@]}"; do
44+
45+
for pre in "${PRE_ACTION[@]}"; do
46+
$pre
47+
done
48+
2549
$act
2650
if ! [ $? -eq 0 ]; then
2751
ACT_RES=1
2852
FAILS+=("${act}")
2953
fi
54+
55+
for pst in "${POST_ACTION[@]}"; do
56+
$pst
57+
done
58+
done
59+
60+
for pst in "${OST_GLOBAL[@]}"; do
61+
$pst
3062
done
3163

3264
echo

0 commit comments

Comments
 (0)