作者: 韩晨旭 10225101440 李畅 10225102463
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

102 řádky
3.1 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. # libgoogle-perftools-dev is temporarily removed from the package list
  64. # because it is currently broken on GitHub's Ubuntu 22.04.
  65. run: |
  66. sudo apt-get update
  67. sudo apt-get install libkyotocabinet-dev libsnappy-dev libsqlite3-dev
  68. - name: Generate build config
  69. run: >-
  70. cmake -S "${{ github.workspace }}" -B "${{ env.CMAKE_BUILD_DIR }}"
  71. -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }}
  72. -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/install_test/
  73. - name: Build
  74. run: >-
  75. cmake --build "${{ env.CMAKE_BUILD_DIR }}"
  76. --config "${{ env.CMAKE_BUILD_TYPE }}"
  77. - name: Run Tests
  78. working-directory: ${{ github.workspace }}/build
  79. run: ctest -C "${{ env.CMAKE_BUILD_TYPE }}" --verbose
  80. - name: Run LevelDB Benchmarks
  81. run: ${{ env.BINARY_PATH }}db_bench${{ env.BINARY_SUFFIX }}
  82. - name: Run SQLite Benchmarks
  83. if: ${{ runner.os != 'Windows' }}
  84. run: ${{ env.BINARY_PATH }}db_bench_sqlite3${{ env.BINARY_SUFFIX }}
  85. - name: Run Kyoto Cabinet Benchmarks
  86. if: ${{ runner.os == 'Linux' && matrix.compiler == 'clang' }}
  87. run: ${{ env.BINARY_PATH }}db_bench_tree_db${{ env.BINARY_SUFFIX }}
  88. - name: Test CMake installation
  89. run: cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target install