ci.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. name: MinIO C++ Cmake
  2. on:
  3. push:
  4. branches: [ main ]
  5. pull_request:
  6. branches: [ main ]
  7. # This ensures that previous jobs for the PR are canceled when the PR is
  8. # updated.
  9. concurrency:
  10. group: ${{ github.workflow }}-${{ github.head_ref }}
  11. cancel-in-progress: true
  12. permissions:
  13. contents: read
  14. jobs:
  15. build:
  16. name: ${{ matrix.config.name }}
  17. runs-on: ${{ matrix.config.os }}
  18. strategy:
  19. fail-fast: false
  20. matrix:
  21. config:
  22. - {
  23. name: "Ubuntu_Latest_GCC",
  24. os: Ubuntu-latest,
  25. build_type: "Release",
  26. cc: "gcc",
  27. cxx: "g++"
  28. }
  29. - {
  30. name: "macOS Latest Clang",
  31. os: macos-latest,
  32. build_type: "Release",
  33. cc: "clang",
  34. cxx: "clang++"
  35. }
  36. steps:
  37. - uses: actions/checkout@v2
  38. - name: Print env
  39. run: |
  40. echo github.event.action: ${{ github.event.action }}
  41. echo github.event_name: ${{ github.event_name }}
  42. - name: Install dependencies if Ubuntu
  43. if: startsWith(matrix.config.name, 'Ubuntu_Latest_GCC')
  44. run: |
  45. wget --quiet -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
  46. echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main' | sudo tee -a /etc/apt/sources.list
  47. sudo apt-get -qy update
  48. sudo apt-get -qy install cmake clang-format-14
  49. wget --quiet https://dl.min.io/server/minio/release/linux-amd64/minio
  50. chmod +x minio
  51. cmake --version
  52. clang-format --version
  53. ./minio --version
  54. - name: Install dependencies if macOS
  55. if: startsWith(matrix.config.os, 'macos')
  56. run: |
  57. brew install pkg-config cmake clang-format minio/stable/minio
  58. cmake --version
  59. minio --version
  60. clang-format --version
  61. - name: Install vcpkg
  62. shell: bash
  63. run: |
  64. mkdir -p ~/.vcpkg
  65. touch ~/.vcpkg/vcpkg.path.txt
  66. wget --quiet -O vcpkg-master.zip https://github.com/microsoft/vcpkg/archive/refs/heads/master.zip
  67. unzip -qq vcpkg-master.zip
  68. ./vcpkg-master/bootstrap-vcpkg.sh
  69. ./vcpkg-master/vcpkg integrate install
  70. ./vcpkg-master/vcpkg install
  71. - name: C++ Style check
  72. shell: bash
  73. run: |
  74. ./check-style.sh
  75. - name: Configure and Build
  76. shell: bash
  77. run: |
  78. cmake -B ./build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DCMAKE_TOOLCHAIN_FILE=./vcpkg-master/scripts/buildsystems/vcpkg.cmake
  79. cmake --build ./build --config ${{ matrix.config.build_type }} -j 4
  80. - name: Start MinIO server if Ubuntu
  81. if: startsWith(matrix.config.name, 'Ubuntu_Latest_GCC')
  82. run: |
  83. mkdir -p ~/.minio/certs
  84. cp ./tests/public.crt ./tests/private.key ~/.minio/certs/
  85. sudo cp ./tests/public.crt /usr/local/share/ca-certificates/
  86. sudo update-ca-certificates
  87. MINIO_CI_CD=true ./minio server /tmp/test-xl/{1...4}/ &
  88. sleep 10
  89. - name: Start MinIO server if macOS
  90. if: startsWith(matrix.config.name, 'macos')
  91. run: |
  92. MINIO_CI_CD=true minio server test-xl/{1...4}/ &
  93. sleep 10
  94. - name: Run tests if Ubuntu
  95. if: startsWith(matrix.config.name, 'Ubuntu_Latest_GCC')
  96. run: |
  97. SERVER_ENDPOINT=localhost:9000 ACCESS_KEY=minioadmin SECRET_KEY=minioadmin ENABLE_HTTPS=1 ./build/tests/tests
  98. - name: Run tests if macOS
  99. if: startsWith(matrix.config.name, 'macos')
  100. run: |
  101. SERVER_ENDPOINT=localhost:9000 ACCESS_KEY=minioadmin SECRET_KEY=minioadmin ./build/tests/tests
  102. - name: Run CMake test
  103. working-directory: ${{github.workspace}}/build
  104. # Execute tests defined by the CMake configuration.
  105. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
  106. run: ctest -C ${{ matrix.config.build_type }}