forked from plone/plone.restapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-no-uncommitted-doc-changes.in
37 lines (32 loc) · 1.28 KB
/
test-no-uncommitted-doc-changes.in
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
#!/bin/bash
#
# CI test that should fail if there are uncommitted changes to the directory
# containing the request/response dumps
#
# (To be executed after running tests in test_documentation.py)
DUMPS_DIR="src/plone/restapi/tests/http-examples/"
function red {
RED=$(tput setaf 1)
RESET=$(tput sgr0)
echo "$RED $1 $RESET"
}
if [ "$PLONE_VERSION" = "4.3.x" ] || [ "$PLONE_VERSION" = "5.0.x" ] || [ "$PLONE_VERSION" = "5.2.x" ]; then
# request/response dumps have known differences for Plone 5
# => skip, we can't have the Plone 5 build fail because of those
echo "Skipping checks for undocumented changes for Plone 4 and 5.0.x"
exit 0
fi
changes=$(git diff --ignore-space-at-eol --exit-code $DUMPS_DIR)
if [ $? -ne 0 ]; then
red "ERROR: There are modified files in $DUMPS_DIR after running test_documentation.py!"
red
red "That means your changeset introduced API changes that cause a different behavior"
red "than what is currently documented, and docs probably need to be updated."
red
red "Please review the changes below, and"
red "1) verify that those behavior changes are actually *intended*"
red "2) if they are, add and commit them using git and include them with your changeset"
red
git diff --exit-code $DUMPS_DIR
exit 1
fi