1
0

test.yaml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. concurrency:
  22. group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
  23. cancel-in-progress: true
  24. env:
  25. GTEST_FILTER: ${{ github.event.inputs.gtest_filter || '*' }}
  26. jobs:
  27. style-check:
  28. runs-on: ubuntu-latest
  29. if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
  30. continue-on-error: true
  31. steps:
  32. - name: checkout
  33. uses: actions/checkout@v4
  34. - name: run style check
  35. run: |
  36. clang-format --version
  37. cd test && make style_check
  38. ubuntu:
  39. runs-on: ubuntu-latest
  40. if: >
  41. (github.event_name == 'push') ||
  42. (github.event_name == 'pull_request' &&
  43. github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) ||
  44. (github.event_name == 'workflow_dispatch' && github.event.inputs.test_linux == 'true')
  45. steps:
  46. - name: checkout
  47. uses: actions/checkout@v4
  48. - name: install libraries
  49. run: sudo apt-get update && sudo apt-get install -y libbrotli-dev libcurl4-openssl-dev
  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. macos:
  55. runs-on: macos-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_macos == 'true')
  61. steps:
  62. - name: checkout
  63. uses: actions/checkout@v4
  64. - name: build and run tests
  65. run: cd test && make
  66. - name: run fuzz test target
  67. run: cd test && make fuzz_test
  68. windows:
  69. runs-on: windows-latest
  70. if: >
  71. (github.event_name == 'push') ||
  72. (github.event_name == 'pull_request' &&
  73. github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) ||
  74. (github.event_name == 'workflow_dispatch' && github.event.inputs.test_windows == 'true')
  75. strategy:
  76. matrix:
  77. config:
  78. - with_ssl: false
  79. name: without SSL
  80. - with_ssl: true
  81. name: with SSL
  82. name: windows ${{ matrix.config.name }}
  83. steps:
  84. - name: Prepare Git for Checkout on Windows
  85. run: |
  86. git config --global core.autocrlf false
  87. git config --global core.eol lf
  88. - name: Checkout
  89. uses: actions/checkout@v4
  90. - name: Export GitHub Actions cache environment variables
  91. uses: actions/github-script@v7
  92. with:
  93. script: |
  94. core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
  95. core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
  96. - name: Setup msbuild on windows
  97. uses: microsoft/setup-msbuild@v2
  98. - name: Install vcpkg dependencies
  99. run: vcpkg install gtest curl zlib brotli
  100. - name: Install OpenSSL
  101. if: ${{ matrix.config.with_ssl }}
  102. run: choco install openssl
  103. - name: Configure CMake ${{ matrix.config.name }}
  104. run: >
  105. cmake -B build -S .
  106. -DCMAKE_BUILD_TYPE=Release
  107. -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake
  108. -DHTTPLIB_TEST=ON
  109. -DHTTPLIB_REQUIRE_ZLIB=ON
  110. -DHTTPLIB_REQUIRE_BROTLI=ON
  111. -DHTTPLIB_REQUIRE_OPENSSL=${{ matrix.config.with_ssl && 'ON' || 'OFF' }}
  112. - name: Build ${{ matrix.config.name }}
  113. run: cmake --build build --config Release -- /v:m /clp:ShowCommandLine
  114. - name: Run tests ${{ matrix.config.name }}
  115. run: ctest --output-on-failure --test-dir build -C Release
  116. env:
  117. VCPKG_ROOT: "C:/vcpkg"
  118. VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"