test.yaml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. name: test
  2. on:
  3. push:
  4. pull_request:
  5. workflow_dispatch:
  6. inputs:
  7. gtest_filter:
  8. description: 'Google Test filter'
  9. test_linux:
  10. description: 'Test on Linux'
  11. type: boolean
  12. default: true
  13. test_macos:
  14. description: 'Test on MacOS'
  15. type: boolean
  16. default: true
  17. test_windows:
  18. description: 'Test on Windows'
  19. type: boolean
  20. default: true
  21. env:
  22. GTEST_FILTER: ${{ github.event.inputs.gtest_filter || '*' }}
  23. jobs:
  24. ubuntu:
  25. runs-on: ubuntu-latest
  26. if: >
  27. (github.event_name == 'push') ||
  28. (github.event_name == 'pull_request' &&
  29. github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) ||
  30. (github.event_name == 'workflow_dispatch' && github.event.inputs.test_linux == 'true')
  31. steps:
  32. - name: checkout
  33. uses: actions/checkout@v4
  34. - name: install libraries
  35. run: sudo apt-get update && sudo apt-get install -y libbrotli-dev libcurl4-openssl-dev
  36. - name: build and run tests
  37. run: cd test && make
  38. - name: run fuzz test target
  39. run: cd test && make fuzz_test
  40. macos:
  41. runs-on: macos-latest
  42. if: >
  43. (github.event_name == 'push') ||
  44. (github.event_name == 'pull_request' &&
  45. github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) ||
  46. (github.event_name == 'workflow_dispatch' && github.event.inputs.test_macos == 'true')
  47. steps:
  48. - name: checkout
  49. uses: actions/checkout@v4
  50. - name: build and run tests
  51. run: cd test && make
  52. - name: run fuzz test target
  53. run: cd test && make fuzz_test
  54. windows:
  55. runs-on: windows-latest
  56. if: >
  57. (github.event_name == 'push') ||
  58. (github.event_name == 'pull_request' &&
  59. github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) ||
  60. (github.event_name == 'workflow_dispatch' && github.event.inputs.test_windows == 'true')
  61. steps:
  62. - name: Prepare Git for Checkout on Windows
  63. run: |
  64. git config --global core.autocrlf false
  65. git config --global core.eol lf
  66. - name: Checkout
  67. uses: actions/checkout@v4
  68. - name: Export GitHub Actions cache environment variables
  69. uses: actions/github-script@v7
  70. with:
  71. script: |
  72. core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
  73. core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
  74. - name: Setup msbuild on windows
  75. uses: microsoft/setup-msbuild@v2
  76. - name: Install libraries
  77. run: |
  78. vcpkg install gtest curl zlib brotli
  79. choco install openssl
  80. - name: Configure CMake with SSL
  81. run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake -DHTTPLIB_TEST=ON -DHTTPLIB_REQUIRE_OPENSSL=ON -DHTTPLIB_REQUIRE_ZLIB=ON -DHTTPLIB_REQUIRE_BROTLI=ON
  82. - name: Build with with SSL
  83. run: cmake --build build --config Release
  84. - name: Run tests with SSL
  85. run: ctest --output-on-failure --test-dir build -C Release
  86. - name: Configure CMake without SSL
  87. run: cmake -B build-no-ssl -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake -DHTTPLIB_TEST=ON -DHTTPLIB_REQUIRE_OPENSSL=OFF -DHTTPLIB_REQUIRE_ZLIB=ON -DHTTPLIB_REQUIRE_BROTLI=ON
  88. - name: Build without SSL
  89. run: cmake --build build-no-ssl --config Release
  90. - name: Run tests without SSL
  91. run: ctest --output-on-failure --test-dir build-no-ssl -C Release
  92. env:
  93. VCPKG_ROOT: "C:/vcpkg"
  94. VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"