test.yaml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. name: test
  2. on: [push, pull_request]
  3. jobs:
  4. build:
  5. runs-on: ${{ matrix.os }}
  6. strategy:
  7. matrix:
  8. os: [macOS-latest, ubuntu-latest, windows-latest]
  9. steps:
  10. - name: prepare git for checkout on windows
  11. if: matrix.os == 'windows-latest'
  12. run: |
  13. git config --global core.autocrlf false
  14. git config --global core.eol lf
  15. - name: checkout
  16. uses: actions/checkout@v2
  17. - name: install brotli library on ubuntu
  18. if: matrix.os == 'ubuntu-latest'
  19. run: sudo apt update && sudo apt-get install -y libbrotli-dev
  20. - name: install brotli library on macOS
  21. if: matrix.os == 'macOS-latest'
  22. run: brew install brotli
  23. - name: make
  24. if: matrix.os != 'windows-latest'
  25. run: cd test && make -j2
  26. - name: check fuzz test target
  27. if: matrix.os == 'ubuntu-latest'
  28. run: cd test && make -f Makefile.fuzz_test
  29. - name: setup msbuild on windows
  30. if: matrix.os == 'windows-latest'
  31. uses: microsoft/[email protected]
  32. - name: make-windows
  33. if: matrix.os == 'windows-latest'
  34. run: |
  35. cd test
  36. msbuild.exe test.sln /verbosity:minimal /t:Build "/p:Configuration=Release;Platform=x64"
  37. x64\Release\test.exe
  38. meson-build:
  39. runs-on: ${{ matrix.os }}
  40. strategy:
  41. matrix:
  42. os: [macos-latest, ubuntu-latest, windows-latest]
  43. steps:
  44. - name: Prepare Git for checkout on Windows
  45. if: matrix.os == 'windows-latest'
  46. run: |
  47. git config --global core.autocrlf false
  48. git config --global core.eol lf
  49. - uses: actions/checkout@v2
  50. - name: Install dependencies on Linux
  51. if: matrix.os == 'ubuntu-latest'
  52. run: sudo apt-get -qq update && sudo apt-get -qq install meson libssl-dev zlib1g-dev libbrotli-dev libgtest-dev
  53. - name: Install dependencies on MacOS
  54. if: matrix.os == 'macos-latest'
  55. run: brew install meson openssl brotli googletest
  56. - name: Setup MSVC on Windows
  57. if: matrix.os == 'windows-latest'
  58. uses: ilammy/msvc-dev-cmd@v1
  59. # It is necessary to remove MinGW and StrawberryPerl as they both provide
  60. # GCC. This causes issues because CMake prefers to use MSVC, while Meson
  61. # uses GCC, if found, causing linking errors.
  62. - name: Install dependencies on Windows
  63. if: matrix.os == 'windows-latest'
  64. run: |
  65. choco uninstall mingw strawberryperl --yes --all-versions --remove-dependencies --skip-autouninstaller --no-color
  66. Remove-Item -Path C:\Strawberry -Recurse
  67. choco install pkgconfiglite --yes --skip-virus-check --no-color
  68. pip install meson ninja
  69. Invoke-WebRequest -Uri https://github.com/google/googletest/archive/refs/heads/master.zip -OutFile googletest-master.zip
  70. Expand-Archive -Path googletest-master.zip
  71. cd googletest-master\googletest-master
  72. cmake -S . -B build -DINSTALL_GTEST=ON -DBUILD_GMOCK=OFF -Dgtest_hide_internal_symbols=ON -DCMAKE_INSTALL_PREFIX=C:/googletest
  73. cmake --build build --config=Release
  74. cmake --install build --config=Release
  75. cd ..\..
  76. - name: Build and test
  77. run: |
  78. meson setup build -Dcpp-httplib_test=true -Dpkg_config_path=C:\googletest\lib\pkgconfig -Db_vscrt=static_from_buildtype
  79. meson test --no-stdsplit --print-errorlogs -C build