ccpp.yml 4.5 KB

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