提供基本的ttl测试用例
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
3.0 KiB

  1. # Copyright 2021 The LevelDB Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file. See the AUTHORS file for names of contributors.
  4. name: ci
  5. on: [push, pull_request]
  6. permissions:
  7. contents: read
  8. jobs:
  9. build-and-test:
  10. name: >-
  11. CI
  12. ${{ matrix.os }}
  13. ${{ matrix.compiler }}
  14. ${{ matrix.optimized && 'release' || 'debug' }}
  15. runs-on: ${{ matrix.os }}
  16. strategy:
  17. fail-fast: false
  18. matrix:
  19. compiler: [clang, gcc, msvc]
  20. os: [ubuntu-latest, macos-latest, windows-latest]
  21. optimized: [true, false]
  22. exclude:
  23. # MSVC only works on Windows.
  24. - os: ubuntu-latest
  25. compiler: msvc
  26. - os: macos-latest
  27. compiler: msvc
  28. # Not testing with GCC on macOS.
  29. - os: macos-latest
  30. compiler: gcc
  31. # Only testing with MSVC on Windows.
  32. - os: windows-latest
  33. compiler: clang
  34. - os: windows-latest
  35. compiler: gcc
  36. include:
  37. - compiler: clang
  38. CC: clang
  39. CXX: clang++
  40. - compiler: gcc
  41. CC: gcc
  42. CXX: g++
  43. - compiler: msvc
  44. CC:
  45. CXX:
  46. env:
  47. CMAKE_BUILD_DIR: ${{ github.workspace }}/build
  48. CMAKE_BUILD_TYPE: ${{ matrix.optimized && 'RelWithDebInfo' || 'Debug' }}
  49. CC: ${{ matrix.CC }}
  50. CXX: ${{ matrix.CXX }}
  51. BINARY_SUFFIX: ${{ startsWith(matrix.os, 'windows') && '.exe' || '' }}
  52. BINARY_PATH: >-
  53. ${{ format(
  54. startsWith(matrix.os, 'windows') && '{0}\build\{1}\' || '{0}/build/',
  55. github.workspace,
  56. matrix.optimized && 'RelWithDebInfo' || 'Debug') }}
  57. steps:
  58. - uses: actions/checkout@v2
  59. with:
  60. submodules: true
  61. - name: Install dependencies on Linux
  62. if: ${{ runner.os == 'Linux' }}
  63. run: |
  64. sudo apt-get update
  65. sudo apt-get install libgoogle-perftools-dev libkyotocabinet-dev \
  66. libsnappy-dev libsqlite3-dev
  67. - name: Generate build config
  68. run: >-
  69. cmake -S "${{ github.workspace }}" -B "${{ env.CMAKE_BUILD_DIR }}"
  70. -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }}
  71. -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/install_test/
  72. - name: Build
  73. run: >-
  74. cmake --build "${{ env.CMAKE_BUILD_DIR }}"
  75. --config "${{ env.CMAKE_BUILD_TYPE }}"
  76. - name: Run Tests
  77. working-directory: ${{ github.workspace }}/build
  78. run: ctest -C "${{ env.CMAKE_BUILD_TYPE }}" --verbose
  79. - name: Run LevelDB Benchmarks
  80. run: ${{ env.BINARY_PATH }}db_bench${{ env.BINARY_SUFFIX }}
  81. - name: Run SQLite Benchmarks
  82. if: ${{ runner.os != 'Windows' }}
  83. run: ${{ env.BINARY_PATH }}db_bench_sqlite3${{ env.BINARY_SUFFIX }}
  84. - name: Run Kyoto Cabinet Benchmarks
  85. if: ${{ runner.os == 'Linux' && matrix.compiler == 'clang' }}
  86. run: ${{ env.BINARY_PATH }}db_bench_tree_db${{ env.BINARY_SUFFIX }}
  87. - name: Test CMake installation
  88. run: cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target install