Show More
@@ -1,68 +1,74 b'' | |||||
1 | #!/bin/bash |
|
1 | #!/bin/bash | |
2 | # Validate the specified commits against test suite and other checks. |
|
2 | # Validate the specified commits against test suite and other checks. | |
3 |
|
3 | |||
4 | if [ -n "$VIRTUAL_ENV" ]; then |
|
4 | if [ -n "$VIRTUAL_ENV" ]; then | |
5 | echo "Please run this script from outside a virtualenv." |
|
5 | echo "Please run this script from outside a virtualenv." | |
6 | exit 1 |
|
6 | exit 1 | |
7 | fi |
|
7 | fi | |
8 |
|
8 | |||
9 | if ! hg update --check -q .; then |
|
9 | if ! hg update --check -q .; then | |
10 | echo "Working dir is not clean, please commit/revert changes first." |
|
10 | echo "Working dir is not clean, please commit/revert changes first." | |
11 | exit 1 |
|
11 | exit 1 | |
12 | fi |
|
12 | fi | |
13 |
|
13 | |||
|
14 | revset=$1 | |||
|
15 | if [ -z "$revset" ]; then | |||
|
16 | echo "Warning: no revisions specified, checking draft changes up to the current one." | |||
|
17 | revset='draft() and ancestors(.)' | |||
|
18 | fi | |||
|
19 | ||||
14 | venv=$(mktemp -d kallithea-validatecommits-env-XXXXXX) |
|
20 | venv=$(mktemp -d kallithea-validatecommits-env-XXXXXX) | |
15 | resultfile=$(mktemp kallithea-validatecommits-result-XXXXXX) |
|
21 | resultfile=$(mktemp kallithea-validatecommits-result-XXXXXX) | |
16 | echo > "$resultfile" |
|
22 | echo > "$resultfile" | |
17 |
|
23 | |||
18 | cleanup() |
|
24 | cleanup() | |
19 | { |
|
25 | { | |
20 | rm -rf /tmp/kallithea-test* |
|
26 | rm -rf /tmp/kallithea-test* | |
21 | rm -rf "$venv" |
|
27 | rm -rf "$venv" | |
22 | } |
|
28 | } | |
23 | finish() |
|
29 | finish() | |
24 | { |
|
30 | { | |
25 | cleanup |
|
31 | cleanup | |
26 | # print (possibly intermediate) results |
|
32 | # print (possibly intermediate) results | |
27 | cat "$resultfile" |
|
33 | cat "$resultfile" | |
28 | rm "$resultfile" |
|
34 | rm "$resultfile" | |
29 | } |
|
35 | } | |
30 | trap finish EXIT |
|
36 | trap finish EXIT | |
31 |
|
37 | |||
32 |
for rev in $(hg log -r "$ |
|
38 | for rev in $(hg log -r "$revset" -T '{node}\n'); do | |
33 | hg log -r "$rev" |
|
39 | hg log -r "$rev" | |
34 | hg update "$rev" |
|
40 | hg update "$rev" | |
35 |
|
41 | |||
36 | cleanup |
|
42 | cleanup | |
37 | python3 -m venv "$venv" |
|
43 | python3 -m venv "$venv" | |
38 | source "$venv/bin/activate" |
|
44 | source "$venv/bin/activate" | |
39 | pip install --upgrade pip setuptools |
|
45 | pip install --upgrade pip setuptools | |
40 | pip install -e . -r dev_requirements.txt python-ldap python-pam |
|
46 | pip install -e . -r dev_requirements.txt python-ldap python-pam | |
41 |
|
47 | |||
42 | # run-all-cleanup |
|
48 | # run-all-cleanup | |
43 | if ! scripts/run-all-cleanup ; then |
|
49 | if ! scripts/run-all-cleanup ; then | |
44 | echo "run-all-cleanup encountered errors!" |
|
50 | echo "run-all-cleanup encountered errors!" | |
45 | result="NOK" |
|
51 | result="NOK" | |
46 | else |
|
52 | else | |
47 | if ! hg update --check -q .; then |
|
53 | if ! hg update --check -q .; then | |
48 | echo "run-all-cleanup did not give clean results!" |
|
54 | echo "run-all-cleanup did not give clean results!" | |
49 | result="NOK" |
|
55 | result="NOK" | |
50 | hg diff |
|
56 | hg diff | |
51 | hg revert -a |
|
57 | hg revert -a | |
52 | else |
|
58 | else | |
53 | result=" OK" |
|
59 | result=" OK" | |
54 | fi |
|
60 | fi | |
55 | fi |
|
61 | fi | |
56 | echo "$result: $rev (run-all-cleanup)" >> "$resultfile" |
|
62 | echo "$result: $rev (run-all-cleanup)" >> "$resultfile" | |
57 |
|
63 | |||
58 | # pytest |
|
64 | # pytest | |
59 | if py.test; then |
|
65 | if py.test; then | |
60 | result=" OK" |
|
66 | result=" OK" | |
61 | else |
|
67 | else | |
62 | result="NOK" |
|
68 | result="NOK" | |
63 | fi |
|
69 | fi | |
64 | echo "$result: $rev (pytest)" >> "$resultfile" |
|
70 | echo "$result: $rev (pytest)" >> "$resultfile" | |
65 |
|
71 | |||
66 | deactivate |
|
72 | deactivate | |
67 | echo |
|
73 | echo | |
68 | done |
|
74 | done |
General Comments 0
You need to be logged in to leave comments.
Login now