test-ly-files: Don't run the tests if $GITLAB_CI = true
[sunny256-utils.git] / Lib / std / ly / test-ly-files
blob3039a13985eb5fb0f33be69d1f383be8c63677ff
1 #!/usr/bin/env bash
3 #=======================================================================
4 # test-ly-files
5 # File ID: 57712470-0790-11e6-9cac-fefdb24f8e10
7 # Test build of LilyPond template files
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #=======================================================================
13 progname=test-ly-files
14 VERSION=0.3.0
16 ARGS="$(getopt -o "\
21 " -l "\
22 all,\
23 help,\
24 quiet,\
25 verbose,\
26 version,\
27 " -n "$progname" -- "$@")"
28 test "$?" = "0" || exit 1
29 eval set -- "$ARGS"
31 opt_all=0
32 opt_help=0
33 opt_quiet=0
34 opt_verbose=0
35 while :; do
36 case "$1" in
37 -a|--all) opt_all=1; shift ;;
38 -h|--help) opt_help=1; shift ;;
39 -q|--quiet) opt_quiet=$(($opt_quiet + 1)); shift ;;
40 -v|--verbose) opt_verbose=$(($opt_verbose + 1)); shift ;;
41 --version) echo $progname $VERSION; exit 0 ;;
42 --) shift; break ;;
43 *) echo $progname: Internal error >&2; exit 1 ;;
44 esac
45 done
46 opt_verbose=$(($opt_verbose - $opt_quiet))
48 if test "$opt_help" = "1"; then
49 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
50 cat <<END
52 Test build of LilyPond template files
54 Usage: $progname [options]
56 Options:
58 -a, --all
59 Also run "tm" to check the MIDI and "evince" to check the PDF.
60 -h, --help
61 Show this help.
62 -q, --quiet
63 Be more quiet. Can be repeated to increase silence.
64 -v, --verbose
65 Increase level of verbosity. Can be repeated.
66 --version
67 Print version information.
69 END
70 exit 0
73 if test "$GITLAB_CI" = "true"; then
74 echo Lilypond does not exist here in Gitlab CI, skipping tests >&2
75 exit 0
78 rm -f STDprojnameDTS.{ly,midi,pdf,wav}
80 for f in *.ly; do
81 echo
82 echo === $f
83 ln -fns $f STDprojnameDTS.ly
84 make touch
85 make || exit 1
86 make STDprojnameDTS.wav
87 test -f STDprojnameDTS.wav || {
88 echo $progname: STDprojnameDTS.wav does not exist >&2
89 exit 1
91 if test "$opt_all" = "1"; then
92 tm STDprojnameDTS.midi
93 evince STDprojnameDTS.pdf
95 done