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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
|
#!/bin/bash
clear
echo "|"
echo "| Pre-release checks."
echo "|"
echo
#############################################################
#
# Run tests.
#
function check_test_status {
echo
echo -n "Are all tests passing? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo -n " Run all tests now? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please run: make test\n";
exit 1
else
echo " Running tests...";
make test
check_test_status
fi
fi
}
#############################################################
#
# Run test for C++ const correctness.
#
function check_test_const {
echo
echo -n "Is the const test passing? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo -n " Run test now? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please run: make test_const\n";
exit 1
else
echo " Running test...";
make test_const
check_test_const
fi
fi
}
#############################################################
#
# Run spellcheck.
#
function check_spellcheck {
echo
echo -n "Is the spellcheck ok? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo -n " Run spellcheck now? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please run: make spellcheck\n";
exit 1
else
echo " Running spellcheck...";
make spellcheck
check_spellcheck
fi
fi
}
#############################################################
#
# Check Changes file is up to date.
#
function check_changefile {
clear
echo "Latest change in Changes file: "
perl -ne '$rev++ if /^##/; exit if $rev > 2; print " | $_"' Changes.txt
echo
echo -n "Is the Changes file updated? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please update the Change file to proceed.\n";
exit 1
fi
}
#############################################################
#
# Check the versions are up to date.
#
function check_versions {
clear
echo
echo "Latest file versions: "
echo
awk '/s.version / {print "\t" FILENAME "\t" $1 "\t" $3}' libxlsxwriter.podspec
awk '/ LXW/ {print "\t" FILENAME "\t" $2 "\t" $3}' include/xlsxwriter.h
echo
echo -n "Are the versions up to date? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo -n " Update versions? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please update the versions to proceed.\n";
exit 1
else
echo " Updating versions...";
perl -i dev/release/update_revision.pl include/xlsxwriter.h libxlsxwriter.podspec
check_versions
fi
fi
}
#############################################################
#
# Check that the docs build cleanly.
#
function check_docs {
# clear
echo
echo -n "Do the docs build cleanly? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo -n " Build docs now? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please run: make docs\n";
exit 1
else
echo " Building docs...";
make docs
check_docs
fi
fi
}
#############################################################
#
# Generate the cocoapods umbrella file.
#
function gen_umbrella_file {
echo
echo -n "Is the umbrella file up to date? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo -n " Update umbrella file now? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please update cocoapods/libxlsxwriter-umbrella.h\n";
exit 1
else
echo " Updating file...";
perl dev/release/gen_umbrella_file.pl > cocoapods/libxlsxwriter-umbrella.h
fi
fi
}
#############################################################
#
# Check the cocoapods spec file.
#
function check_pod_spec {
echo
echo -n "Is the coacoapod file ok? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo -n " Run lint now? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please run: pod spec lint libxlsxwriter.podspec\n";
exit 1
else
echo " Running lint...";
pod spec lint libxlsxwriter.podspec --use-libraries
check_pod_spec
fi
fi
}
#############################################################
#
# Update the pod repo. This can take some time.
#
function update_pod_repo {
echo
echo -n "Is the pod repo updated? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo -n " Update now? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please run: pod spec lint libxlsxwriter.podspec\n";
exit 1
else
echo " Running update...";
cd ~/.cocoapods/repos/master
git pull --ff-only
cd -
update_pod_repo
fi
fi
}
#############################################################
#
# Run release checks.
#
function check_git_status {
clear
echo "Git status: "
git status | awk '{print " | ", $0}'
echo "Git log: "
git log -1 | awk '{print " | ", $0}'
echo "Git latest tag: "
git tag -l -n1 | tail -1 | awk '{print " | ", $0}'
echo
echo -n "Is the git status okay? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please fix git status.\n";
echo -e "\ngit add -u";
git tag -l -n1 | tail -1 | perl -lane 'printf "git commit -m \"Prep for release %s\"\ngit tag \"%s\"\n\n", $F[4], $F[0]' | perl dev/release/update_revision.pl
exit 1
fi
}
check_test_status
clear
check_test_const
clear
check_spellcheck
clear
check_docs
check_changefile
clear
gen_umbrella_file
check_pod_spec
clear
update_pod_repo
check_versions
check_git_status
#############################################################
#
# All checks complete.
#
clear
echo
echo "Everything is configured.";
echo
echo -n "Confirm release: [y/N]: ";
read RESPONSE
if [ "$RESPONSE" == "y" ]; then
exit 0
else
exit 1
fi
|