-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·76 lines (59 loc) · 1.3 KB
/
Copy pathtest.sh
File metadata and controls
executable file
·76 lines (59 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh
set -e
stamp() {
date -r .greencently/junit5 '+%s' 2>/dev/null || echo 0
}
scenario_count=0
scenario() {
tests="$1"
color="$2"
scenario_count=$(expr 1 + ${scenario_count})
stringy=""
if [ "${color}" = red ]; then
stringy="non-empty"
fi
printf "%s" "scenario ${scenario_count}: tests '${tests}', color '${color}'"
../../gradlew -PsetNonEmptyToFailTestOne="${stringy}" clean test --tests "${tests}" >/dev/null 2>&1 || true
}
die() {
echo "$@"
exit 55
}
assert() {
assertion="$1"
printf "%s" ", assertion '${assertion}': "
if eval "${assertion}"; then
echo OK
else
die FAILED
fi
}
build_like_github_actions_would() {
sequence=$(
grep gradlew .github/workflows/main-build.yml \
| sed \
-e 's|.*\./gradlew ||' \
-e 's|-Pversion=.*}} ||' \
-e 's|^publishTo.*|publishToMavenLocal|' \
| tr '\n' ' '
)
./gradlew ${sequence}
}
main() {
build_like_github_actions_would
cd example-projects/junit5-gradle
scenario '*' red
assert '[ 0 -eq $(stamp) ]'
scenario '*' green; new=$(stamp)
assert '[ 0 -lt ${new} ]'
scenario '*' green; newer=$(stamp)
assert '[ ${new} -lt ${newer} ]'
scenario 'ExampleTests.one' green
assert '[ 0 -eq $(stamp) ]'
scenario '*' green
assert '[ 0 -lt $(stamp) ]'
scenario '*' red
assert '[ 0 -eq $(stamp) ]'
}
main "$@"
exit $?