ccpp.yml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. name: C/C++ CI
  2. on:
  3. push:
  4. branches: [ master ]
  5. pull_request:
  6. branches: [ master ]
  7. permissions:
  8. contents: write # to fetch code (actions/checkout),and release
  9. jobs:
  10. build:
  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, windows-latest-clang.exe, ubuntu-latest-clang++]
  17. # For Windows msvc, for Linux and macOS let's use the clang compiler, use gcc for Linux.
  18. include:
  19. - name: windows-latest-clang.exe
  20. os: windows-latest
  21. cxx: clang++.exe
  22. cc: clang.exe
  23. - name: windows-latest-cl.exe
  24. os: windows-latest
  25. cxx: cl.exe
  26. cc: cl.exe
  27. - name: windows-hunter-latest-cl.exe
  28. os: windows-latest
  29. cxx: cl.exe
  30. cc: cl.exe
  31. - name: ubuntu-latest-clang++
  32. os: ubuntu-latest
  33. cxx: clang++
  34. cc: clang
  35. - name: macos-latest-clang++
  36. os: macos-latest
  37. cxx: clang++
  38. cc: clang
  39. - name: ubuntu-latest-g++
  40. os: ubuntu-latest
  41. cxx: g++
  42. cc: gcc
  43. steps:
  44. - name: ccache
  45. uses: hendrikmuhs/[email protected]
  46. - uses: actions/checkout@v4
  47. with:
  48. submodules: true
  49. - uses: lukka/get-cmake@latest
  50. - uses: ilammy/msvc-dev-cmd@v1
  51. - name: Set Compiler Environment
  52. uses: lukka/set-shell-env@v1
  53. with:
  54. CXX: ${{ matrix.cxx }}
  55. CC: ${{ matrix.cc }}
  56. - name: Cache DX SDK
  57. id: dxcache
  58. if: contains(matrix.name, 'windows')
  59. uses: actions/cache@v4
  60. with:
  61. path: '${{ github.workspace }}/DX_SDK'
  62. key: ${{ runner.os }}-DX_SDK
  63. restore-keys: |
  64. ${{ runner.os }}-DX_SDK
  65. - name: Download DXSetup
  66. if: contains(matrix.name, 'windows-latest-cl.exe') && steps.dxcache.outputs.cache-hit != 'true'
  67. run: |
  68. curl -s -o DXSDK_Jun10.exe --location https://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe
  69. cmd.exe /c start /wait .\DXSDK_Jun10.exe /U /O /F /S /P "${{ github.workspace }}\DX_SDK"
  70. - name: Set Windows specific CMake arguments
  71. if: contains(matrix.name, 'windows-latest-cl.exe')
  72. id: windows_extra_cmake_args
  73. run: echo ":set-output name=args::=-DASSIMP_BUILD_ASSIMP_TOOLS=1 -DASSIMP_BUILD_ASSIMP_VIEW=1" >> $GITHUB_OUTPUT
  74. - name: Set Hunter specific CMake arguments
  75. if: contains(matrix.name, 'hunter')
  76. id: hunter_extra_cmake_args
  77. run: echo "args=-DBUILD_SHARED_LIBS=OFF -DASSIMP_HUNTER_ENABLED=ON -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/polly/${{ matrix.toolchain }}.cmake" >> $GITHUB_OUTPUT
  78. - name: configure and build
  79. uses: lukka/run-cmake@v3
  80. env:
  81. DXSDK_DIR: '${{ github.workspace }}/DX_SDK'
  82. with:
  83. cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
  84. cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
  85. cmakeAppendedArgs: '-GNinja -DCMAKE_BUILD_TYPE=Release ${{ steps.windows_extra_cmake_args.outputs.args }} ${{ steps.hunter_extra_cmake_args.outputs.args }}'
  86. buildWithCMakeArgs: '--parallel 24 -v'
  87. buildDirectory: '${{ github.workspace }}/build/'
  88. - name: Exclude certain tests in Hunter specific builds
  89. if: contains(matrix.name, 'hunter')
  90. id: hunter_extra_test_args
  91. run: echo "args=--gtest_filter=-utOpenGEXImportExport.Importissue1340_EmptyCameraObject:utColladaZaeImportExport.importBlenFromFileTest" >> $GITHUB_OUTPUT
  92. - name: test
  93. run: cd build/bin && ./unit ${{ steps.hunter_extra_test_args.outputs.args }}
  94. shell: bash
  95. - uses: actions/upload-artifact@v4
  96. if: matrix.name == 'windows-msvc'
  97. with:
  98. name: 'assimp-bins-${{ matrix.name }}'
  99. path: build/bin/assimp*.exe
  100. - uses: marvinpinto/action-automatic-releases@latest
  101. if: contains(matrix.name, 'windows-msvc-hunter')
  102. with:
  103. repo_token: "${{ secrets.GITHUB_TOKEN }}"
  104. automatic_release_tag: "master"
  105. prerelease: true
  106. title: "AutoRelease"
  107. files: |
  108. build/bin/assimp*.exe
  109. create-release:
  110. needs: [build]
  111. runs-on: ubuntu-latest
  112. if: startsWith(github.ref, 'refs/tags/')
  113. steps:
  114. - id: create-release
  115. uses: actions/create-release@v1
  116. env:
  117. GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}}'
  118. with:
  119. tag_name: '${{github.ref}}'
  120. release_name: 'Release ${{github.ref}}'
  121. draft: false
  122. prerelease: true
  123. - run: |
  124. echo '${{steps.create-release.outputs.upload_url}}' > release_upload_url.txt
  125. - uses: actions/upload-artifact@v4
  126. with:
  127. name: create-release
  128. path: release_upload_url.txt
  129. upload-release:
  130. strategy:
  131. matrix:
  132. name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, ubuntu-latest-clang++, ubuntu-gcc-hunter, macos-clang-hunter, windows-msvc-hunter]
  133. # For Windows msvc, for Linux and macOS let's use the clang compiler, use gcc for Linux.
  134. include:
  135. - name: windows-latest-cl.exe
  136. os: windows-latest
  137. cxx: cl.exe
  138. cc: cl.exe
  139. - name: ubuntu-latest-clang++
  140. os: ubuntu-latest
  141. cxx: clang++
  142. cc: clang
  143. - name: macos-latest-clang++
  144. os: macos-latest
  145. cxx: clang++
  146. cc: clang
  147. - name: ubuntu-latest-g++
  148. os: ubuntu-latest
  149. cxx: g++
  150. cc: gcc
  151. - name: ubuntu-gcc-hunter
  152. os: ubuntu-latest
  153. toolchain: ninja-gcc-cxx17-fpic
  154. - name: macos-clang-hunter
  155. os: macos-latest
  156. toolchain: ninja-clang-cxx17-fpic
  157. - name: windows-msvc-hunter
  158. os: windows-latest
  159. toolchain: ninja-vs-win64-cxx17
  160. needs: [create-release]
  161. runs-on: ubuntu-latest
  162. if: startsWith(github.ref, 'refs/tags/')
  163. steps:
  164. - uses: softprops/action-gh-release@v2
  165. with:
  166. name: create-release
  167. - id: upload-url
  168. run: |
  169. echo "url=$(cat create-release/release_upload_url.txt)" >> $GITHUB_OUTPUT
  170. - uses: actions/download-artifact@v4
  171. with:
  172. name: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}'
  173. - uses: actions/upload-release-asset@v1
  174. env:
  175. GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}}'
  176. with:
  177. files: |
  178. *.zip