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)
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

index ebe7b58a73433251c81476aff0a616068a5cf99a..06e03ce3e6f1332b59fefaad8c098953d4688048 100644 (file)
@@ -111,6 +111,10 @@ jobs:
       with:
         name: ${{ matrix.build }}-installer
         path: os\windows\*.msi
+    - name: Remove dependency files to resolve Makefile Cygwin sed issue (Windows)
+      if: ${{ startsWith(matrix.build, 'windows-cygwin') }}
+      run: rm *.d */*.d */*/*.d
+      shell: bash
     - name: Smoke test
       run:  ${{matrix.shell}} ./ci/actions-smoke-test.sh
     - name: Full test