9d76107647d809ae4b299d7e6fecf02d45407532
[osm/RO.git] / devops-stages / stage-test.sh
1 #!/bin/bash
2
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12 # implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 echo "Launching tox"
17 tox --parallel=auto
18
19 echo "Checking the presence of release notes ..."
20
21 nb_rn=$(git diff --diff-filter=A --name-only HEAD~1 |grep "releasenotes\/notes" |wc -l)
22 if [ "${nb_rn}" -lt 1 ]; then
23 echo "The commit needs release notes"
24 echo "Run the following command to generate release notes: tox -e release_notes '<release_note_title>'"
25 echo "Please read README.md for more details"
26 exit 1
27 elif [ "${nb_rn}" -gt 1 ]; then
28 echo "Only one release notes file should be added in a commit"
29 exit 1
30 fi
31
32 echo "OK. Release notes present in commit"
33