GitHub Actions testing on Ubuntu, Mac, & Windows

Updates to fix issues in the CMake install instructions.

Updates the README.md to indicate that CMake is now preferred

Adds a GitHub Actions badge, Discord badge, and logo to the README.md.

CMake:

- Renamed ENABLE_DOCS to ENABLE_MAN_PAGES.

- Fixed build issue when milter isn't enabled on Linux. Changed the
default to build milter on non-macOS, non-Windows operating systems.

- Fix LD_LIBRARY_PATH for tests including on macOS where LD_LIBRARY_PATH
  and DYLD_LIBRARY_PATH must be manually propagated to subprocesses.

- Use UNKNOWN IMPORTED library instead of INTERFACE IMPORTED library for
  pdcurses, but still use INTERFACE IMPORTED for ncurses.
  UNKNOWN IMPORTED appears to be required so that we can use
  $<TARGET_FILE_DIR:Curses::curses> to collected the pdcurses library at
  install time on Windows.

- When building with vcpkg on Windows, CMake will automatically install
  your app local dependencies (aka the DLL runtime dependencies).
  Meanwhile, file(GET_RUNTIME_DEPENDENCIES ...) doesn't appear to work
  correctly with vcpkg packages. The solution is to use a custom target
  that has CMake perform a local install to the unit_tests directory
  when using vcpkg.
  This is in fact far easier than using GET_RUNTIME_DEPENDENCIES in the
  unit_tests for assembling the test environment but we can't use this
  method for the non-vcpkg install because it won't collect
  checkDynamic.dll for us because we don't install our tests.
  We also can't link with the static check.lib because the static
  check.lib has pthreads symbols linked in and will conflict with our
  pthread.dll.

  TL;DR: We'll continue to use file(GET_RUNTIME_DEPENDENCIES ...) for
  assembling the test enviornment on non-vcpkg builds, and use the local
  install method for vcpkg builds.

testcase.py: Wrapped a Pathlib.unlink() call in exception handling as
the missing_ok optional parameter requires a Python version too new for
common use.

Remove localtime_r from win32 compat lib.
localtime_r may be present in libcheck when building with vcpkg and
while making it a static function would also solve the issue, using
localtime_s instead like we do everywhere else should work just fine.

check_clamd: Limited the max # of connections for the stress test on Mac
to 850, to address issues found testing on macos-latest on GitHub Actions.
This commit is contained in:
Micah Snyder 2020-11-18 21:19:27 -08:00
parent 034cc77058
commit c81968d3a7
13 changed files with 807 additions and 460 deletions

View file

@ -1,79 +1,82 @@
# Generate documentation (man pages, doxygen, etc.)
#
# man pages
#
# .1 files
configure_file(man/clamscan.1.in man/clamscan.1)
configure_file(man/freshclam.1.in man/freshclam.1)
configure_file(man/sigtool.1.in man/sigtool.1)
configure_file(man/clamdscan.1.in man/clamdscan.1)
configure_file(man/clamconf.1.in man/clamconf.1)
configure_file(man/clamdtop.1.in man/clamdtop.1)
configure_file(man/clamsubmit.1.in man/clamsubmit.1)
configure_file(man/clambc.1.in man/clambc.1)
# .5 files
configure_file(man/clamd.conf.5.in man/clamd.conf.5)
configure_file(man/clamav-milter.conf.5.in man/clamav-milter.conf.5)
configure_file(man/freshclam.conf.5.in man/freshclam.conf.5)
# .8 files
configure_file(man/clamd.8.in man/clamd.8)
configure_file(man/clamav-milter.8.in man/clamav-milter.8)
if(C_LINUX)
configure_file(man/clamonacc.8.in man/clamonacc.8)
endif()
if(ENABLE_MAN_PAGES)
#
# man pages
#
# .1 files
configure_file(man/clamscan.1.in man/clamscan.1)
configure_file(man/freshclam.1.in man/freshclam.1)
configure_file(man/sigtool.1.in man/sigtool.1)
configure_file(man/clamdscan.1.in man/clamdscan.1)
configure_file(man/clamconf.1.in man/clamconf.1)
configure_file(man/clamdtop.1.in man/clamdtop.1)
configure_file(man/clamsubmit.1.in man/clamsubmit.1)
configure_file(man/clambc.1.in man/clambc.1)
# .5 files
configure_file(man/clamd.conf.5.in man/clamd.conf.5)
configure_file(man/clamav-milter.conf.5.in man/clamav-milter.conf.5)
configure_file(man/freshclam.conf.5.in man/freshclam.conf.5)
# .8 files
configure_file(man/clamd.8.in man/clamd.8)
configure_file(man/clamav-milter.8.in man/clamav-milter.8)
if(C_LINUX)
configure_file(man/clamonacc.8.in man/clamonacc.8)
endif()
set(MAN1_FILES
man/clamscan.1
man/freshclam.1
man/sigtool.1
man/clamdscan.1
man/clamconf.1
man/clamdtop.1
man/clamsubmit.1
man/clambc.1)
foreach(m IN LISTS MAN1_FILES)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${m}
DESTINATION
${CMAKE_INSTALL_PREFIX}/share/man/man1)
endforeach()
set(MAN1_FILES
man/clamscan.1
man/freshclam.1
man/sigtool.1
man/clamdscan.1
man/clamconf.1
man/clamdtop.1
man/clamsubmit.1
man/clambc.1)
foreach(m IN LISTS MAN1_FILES)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${m}
DESTINATION
${CMAKE_INSTALL_PREFIX}/share/man/man1)
endforeach()
set(MAN5_FILES
man/clamd.conf.5
man/clamav-milter.conf.5
man/freshclam.conf.5)
foreach(m IN LISTS MAN5_FILES)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${m}
DESTINATION
${CMAKE_INSTALL_PREFIX}/share/man/man5)
endforeach()
set(MAN5_FILES
man/clamd.conf.5
man/clamav-milter.conf.5
man/freshclam.conf.5)
foreach(m IN LISTS MAN5_FILES)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${m}
DESTINATION
${CMAKE_INSTALL_PREFIX}/share/man/man5)
endforeach()
set(MAN8_FILES
man/clamd.8
man/clamav-milter.8)
foreach(m IN LISTS MAN8_FILES)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${m}
DESTINATION
${CMAKE_INSTALL_PREFIX}/share/man/man8)
endforeach()
set(MAN8_FILES
man/clamd.8
man/clamav-milter.8)
foreach(m IN LISTS MAN8_FILES)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${m}
DESTINATION
${CMAKE_INSTALL_PREFIX}/share/man/man8)
endforeach()
if(C_LINUX)
# Also install Linux-only manpage
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/man/clamonacc.8
DESTINATION
${CMAKE_INSTALL_PREFIX}/share/man/man8)
if(C_LINUX)
# Also install Linux-only manpage
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/man/clamonacc.8
DESTINATION
${CMAKE_INSTALL_PREFIX}/share/man/man8)
endif()
endif()
if(ENABLE_DOXYGEN)
#
# clamav.h doxygen docs
# clamav.h and libfreshclam.h doxygen docs
#
find_package(Doxygen REQUIRED)
@ -91,8 +94,7 @@ if(ENABLE_DOXYGEN)
doxygen_add_docs(doxygen
${CMAKE_SOURCE_DIR}/libclamav/clamav.h
${CMAKE_SOURCE_DIR}/libfreshclam/libfreshclam.h
COMMENT "Generate html documentation"
)
COMMENT "Generate html documentation")
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
DESTINATION ${CMAKE_INSTALL_DOCDIR}