ccpp.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. name: C/C++ CI
  2. on:
  3. push:
  4. branches: [ master ]
  5. pull_request:
  6. branches: [ master ]
  7. permissions:
  8. contents: read # to fetch code (actions/checkout)
  9. jobs:
  10. job:
  11. name: ${{ matrix.name }}-build-and-test
  12. runs-on: ${{ matrix.os }}
  13. strategy:
  14. fail-fast: false
  15. matrix:
  16. name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, ubuntu-latest-clang++, ubuntu-gcc-hunter, macos-clang-hunter, windows-msvc-hunter]
  17. # For Windows msvc, for Linux and macOS let's use the clang compiler, use gcc for Linux.
  18. include:
  19. - name: windows-latest-cl.exe
  20. os: windows-latest
  21. cxx: cl.exe
  22. cc: cl.exe
  23. - name: ubuntu-latest-clang++
  24. os: ubuntu-latest
  25. cxx: clang++
  26. cc: clang
  27. - name: macos-latest-clang++
  28. os: macos-latest
  29. cxx: clang++
  30. cc: clang
  31. - name: ubuntu-latest-g++
  32. os: ubuntu-latest
  33. cxx: g++
  34. cc: gcc
  35. - name: ubuntu-gcc-hunter
  36. os: ubuntu-latest
  37. toolchain: ninja-gcc-cxx17-fpic
  38. - name: macos-clang-hunter
  39. os: macos-latest
  40. toolchain: ninja-clang-cxx17-fpic
  41. - name: windows-msvc-hunter
  42. os: windows-latest
  43. toolchain: ninja-vs-win64-cxx17
  44. steps:
  45. - uses: actions/checkout@v3
  46. with:
  47. submodules: true
  48. - uses: lukka/get-cmake@latest
  49. - uses: ilammy/msvc-dev-cmd@v1
  50. - name: Set Compiler Environment
  51. if: "!endsWith(matrix.name, 'hunter')"
  52. uses: lukka/set-shell-env@v1
  53. with:
  54. CXX: ${{ matrix.cxx }}
  55. CC: ${{ matrix.cc }}
  56. - name: Set Compiler Environment for Hunter on Windows
  57. if: startsWith(matrix.name, 'windows') && endsWith(matrix.name, 'hunter')
  58. uses: lukka/set-shell-env@v1
  59. with:
  60. VS160COMNTOOLS: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools
  61. - name: Checkout Hunter toolchains
  62. if: endsWith(matrix.name, 'hunter')
  63. uses: actions/checkout@v3
  64. with:
  65. repository: cpp-pm/polly
  66. path: cmake/polly
  67. - name: Cache DX SDK
  68. id: dxcache
  69. if: contains(matrix.name, 'windows')
  70. uses: actions/cache@v3
  71. with:
  72. path: '${{ github.workspace }}/DX_SDK'
  73. key: ${{ runner.os }}-DX_SDK
  74. restore-keys: |
  75. ${{ runner.os }}-DX_SDK
  76. - name: Download DXSetup
  77. if: contains(matrix.name, 'windows') && steps.dxcache.outputs.cache-hit != 'true'
  78. run: |
  79. curl -s -o DXSDK_Jun10.exe --location https://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe
  80. cmd.exe /c start /wait .\DXSDK_Jun10.exe /U /O /F /S /P "${{ github.workspace }}\DX_SDK"
  81. - name: Set Windows specific CMake arguments
  82. if: contains(matrix.name, 'windows')
  83. id: windows_extra_cmake_args
  84. run: echo "::set-output name=args::-DASSIMP_BUILD_ASSIMP_TOOLS=1 -DASSIMP_BUILD_ASSIMP_VIEW=1 -DASSIMP_BUILD_ZLIB=1"
  85. - name: Set Hunter specific CMake arguments
  86. if: contains(matrix.name, 'hunter')
  87. id: hunter_extra_cmake_args
  88. run: echo "::set-output name=args::-DBUILD_SHARED_LIBS=OFF -DASSIMP_HUNTER_ENABLED=ON -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/polly/${{ matrix.toolchain }}.cmake"
  89. - name: configure and build
  90. uses: lukka/run-cmake@v3
  91. env:
  92. DXSDK_DIR: '${{ github.workspace }}/DX_SDK'
  93. with:
  94. cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
  95. cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
  96. cmakeAppendedArgs: '-GNinja -DCMAKE_BUILD_TYPE=Release ${{ steps.windows_extra_cmake_args.outputs.args }} ${{ steps.hunter_extra_cmake_args.outputs.args }}'
  97. buildWithCMakeArgs: '--parallel 24 -v'
  98. buildDirectory: '${{ github.workspace }}/build/'
  99. - name: Exclude certain tests in Hunter specific builds
  100. if: contains(matrix.name, 'hunter')
  101. id: hunter_extra_test_args
  102. run: echo "::set-output name=args::--gtest_filter=-utOpenGEXImportExport.Importissue1340_EmptyCameraObject:utColladaZaeImportExport.importBlenFromFileTest"
  103. - name: test
  104. run: cd build/bin && ./unit ${{ steps.hunter_extra_test_args.outputs.args }}
  105. shell: bash
  106. - uses: actions/upload-artifact@v3
  107. if: matrix.name == 'windows-msvc'
  108. with:
  109. name: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}'
  110. path: build/bin