ci: work around for GitHub Actions Cygwin sed issue
authorVincent Fu <vincent.fu@samsung.com>
Wed, 26 Apr 2023 22:04:34 +0000 (22:04 +0000)
committerVincent Fu <vincent.fu@samsung.com>
Thu, 27 Apr 2023 16:03:42 +0000 (12:03 -0400)
commit8b60e320760fae4859c269e543dadd41c875e8ec
tree3c2e631f2caf289b8415a38a1267e1d0f8d9487a
parent89d088800832668acdf9c28bca9f0818065e5abe
ci: work around for GitHub Actions Cygwin sed issue

gcc and other compilers create dependency files that are included in
the Makefile for builds subsequent to the first build after a clean
checkout.

Dependency files produced by gcc look like this:

parse.o: parse.c config-host.h compiler/compiler.h parse.h flist.h \
 debug.h lib/types.h log.h lib/output_buffer.h options.h optgroup.h \
 minmax.h lib/ieee754.h lib/pow2.h lib/types.h

The Makefile rule for .o files manipulates the gcc dependencies file to
look like this:

parse.o: parse.c config-host.h compiler/compiler.h parse.h flist.h \
 debug.h lib/types.h log.h lib/output_buffer.h options.h optgroup.h \
 minmax.h lib/ieee754.h lib/pow2.h lib/types.h
parse.c:
config-host.h:
compiler/compiler.h:
parse.h:
flist.h:
debug.h:
lib/types.h:
log.h:
lib/output_buffer.h:
options.h:
optgroup.h:
minmax.h:
lib/ieee754.h:
lib/pow2.h:
lib/types.h:

For some reason the GitHub Actions Windows Cygwin sed does not execute
-e 's/\\$$//' properly to remove the backslashes at the end of each
line. On this platform the dependencies file after processing looks
like:

parse.o: parse.c config-host.h compiler/compiler.h parse.h flist.h \
 debug.h lib/types.h log.h lib/output_buffer.h options.h optgroup.h \
 minmax.h lib/ieee754.h lib/pow2.h lib/types.h
parse.c:
config-host.h:
compiler/compiler.h:
parse.h:
flist.h:
\:
debug.h:
lib/types.h:
log.h:
lib/output_buffer.h:
options.h:
optgroup.h:
\:
minmax.h:
lib/ieee754.h:
lib/pow2.h:
lib/types.h:

Once these dependency files are created subsequent invocations of make
(i.e., 'make test') produce Makefile parsing errors like:

parse.d:9: *** missing separator.  Stop.

All of this works fine on GitHub Actions msys2 and AppVeyor's Cygwin and
msys2.

Work around this problem by deleting the dependencies files before
running the tests.

For more details describing the processing of dependency files see
https://scottmcpeak.com/autodepend/autodepend.html

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
.github/workflows/ci.yml