continuous_integration.yml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. name: Continuous Integration
  2. on:
  3. workflow_dispatch:
  4. pull_request:
  5. branches:
  6. - main
  7. permissions: read-all
  8. jobs:
  9. linux:
  10. needs: linux-shared # fastest job to do sanity check
  11. runs-on: ubuntu-22.04
  12. strategy:
  13. fail-fast: false
  14. matrix:
  15. compiler: [{cc: clang, cxx: clang++}, {cc: gcc, cxx: g++}]
  16. cmake_build_type: [Debug, Release]
  17. steps:
  18. - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  19. - name: Setup ccache
  20. uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20
  21. with:
  22. key: ubuntu-22-${{ matrix.cmake_build_type }}-${{ matrix.compiler.cc }}-${{matrix.compiler.cxx}}
  23. - run: ./update_glslang_sources.py
  24. - name: Configure
  25. run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} -DBUILD_WERROR=ON -D GLSLANG_TESTS=ON
  26. env:
  27. CC: ${{matrix.compiler.cc}}
  28. CXX: ${{matrix.compiler.cxx}}
  29. CMAKE_GENERATOR: Ninja
  30. CMAKE_C_COMPILER_LAUNCHER: ccache
  31. CMAKE_CXX_COMPILER_LAUNCHER: ccache
  32. - name: Build
  33. run: cmake --build build
  34. - name: Install
  35. run: cmake --install build --prefix build/install
  36. - name: Test find_package support
  37. run: |
  38. cmake -S Test/find_package -B build/find_package && \
  39. cmake --build build/find_package
  40. - name: Test
  41. run: ctest --output-on-failure --test-dir build
  42. - name: Check known validation failure list
  43. run: grep -l 'Validation failed' Test/baseResults/* | sort -fd | diff -u Test/baseResults/validation_fails.txt -
  44. linux-shared:
  45. runs-on: ubuntu-22.04
  46. strategy:
  47. fail-fast: false
  48. matrix:
  49. compiler: [{cc: clang, cxx: clang++}, {cc: gcc, cxx: g++}]
  50. cmake_build_type: [Release]
  51. steps:
  52. - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  53. - name: Setup ccache
  54. uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20
  55. with:
  56. key: ubuntu-22-${{ matrix.cmake_build_type }}-${{ matrix.compiler.cc }}-${{matrix.compiler.cxx}}
  57. - run: ./update_glslang_sources.py
  58. - name: Configure
  59. run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} -DBUILD_WERROR=ON -D GLSLANG_TESTS=ON -DBUILD_SHARED_LIBS=ON
  60. env:
  61. CC: ${{matrix.compiler.cc}}
  62. CXX: ${{matrix.compiler.cxx}}
  63. CMAKE_GENERATOR: Ninja
  64. CMAKE_C_COMPILER_LAUNCHER: ccache
  65. CMAKE_CXX_COMPILER_LAUNCHER: ccache
  66. - name: Build
  67. run: cmake --build build
  68. - name: Install
  69. run: cmake --install build --prefix build/install
  70. - name: Test find_package support
  71. run: |
  72. cmake -S Test/find_package -B build/find_package && \
  73. cmake --build build/find_package
  74. - name: Test
  75. run: ctest --output-on-failure --test-dir build
  76. linux-asan:
  77. needs: linux-shared # fastest job to do sanity check
  78. runs-on: ubuntu-22.04
  79. strategy:
  80. fail-fast: false
  81. matrix:
  82. compiler: [{cc: gcc, cxx: g++}]
  83. cmake_build_type: [Debug]
  84. flags: ['-fsanitize=address', '-fsanitize=thread', '-fsanitize=undefined']
  85. steps:
  86. - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  87. - name: Setup ccache
  88. uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20
  89. with:
  90. key: ubuntu-22-${{ matrix.cmake_build_type }}-${{ matrix.compiler.cc }}-${{matrix.compiler.cxx}}-${{matrix.flags}}
  91. # This is to combat a bug when using 6.6 linux kernels with thread/address sanitizer
  92. # https://github.com/google/sanitizers/issues/1716
  93. - run: sudo sysctl vm.mmap_rnd_bits=28
  94. - run: ./update_glslang_sources.py
  95. - name: Configure
  96. run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} -D GLSLANG_TESTS=ON
  97. env:
  98. CC: ${{matrix.compiler.cc}}
  99. CXX: ${{matrix.compiler.cxx}}
  100. CMAKE_GENERATOR: Ninja
  101. CMAKE_C_COMPILER_LAUNCHER: ccache
  102. CMAKE_CXX_COMPILER_LAUNCHER: ccache
  103. CFLAGS: ${{matrix.flags}}
  104. CXXFLAGS: ${{matrix.flags}}
  105. LDFLAGS: ${{matrix.flags}}
  106. - name: Build
  107. run: cmake --build build
  108. - name: Install
  109. run: cmake --install build --prefix build/install
  110. - name: Test
  111. env:
  112. UBSAN_OPTIONS: 'halt_on_error=1:print_stacktrace=1'
  113. run: ctest --output-on-failure --test-dir build
  114. # Ensure we can compile/run on an older distro, with older tools (cmake, python, etc)
  115. linux_min:
  116. needs: linux-shared # fastest job to do sanity check
  117. name: Linux Backcompat
  118. runs-on: ubuntu-22.04
  119. steps:
  120. - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  121. - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
  122. with:
  123. python-version: '3.7'
  124. - uses: lukka/get-cmake@f176ccd3f28bda569c43aae4894f06b2435a3375 # v4.2.3
  125. with:
  126. cmakeVersion: 3.22.1
  127. - name: Setup ccache
  128. uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20
  129. with:
  130. key: linux_backcompat
  131. - run: ./update_glslang_sources.py
  132. - name: Configure
  133. run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D GLSLANG_TESTS=ON
  134. env:
  135. CMAKE_C_COMPILER_LAUNCHER: ccache
  136. CMAKE_CXX_COMPILER_LAUNCHER: ccache
  137. - name: Build
  138. run: cmake --build build
  139. - name: Install
  140. run: cmake --install build --prefix build/install
  141. - name: Test find_package support
  142. run: |
  143. cmake -S Test/find_package -B build/find_package && \
  144. cmake --build build/find_package
  145. - name: Test
  146. run: ctest --output-on-failure --test-dir build
  147. macos:
  148. # iOS is 10x expensive to run on GitHub machines, so only run if we know something else passed as well
  149. needs: windows-shared
  150. runs-on: ${{matrix.os}}
  151. strategy:
  152. fail-fast: false
  153. matrix:
  154. os: [macos-latest]
  155. compiler: [{cc: clang, cxx: clang++}]
  156. cmake_build_type: [Debug, Release]
  157. steps:
  158. - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  159. - run: ./update_glslang_sources.py
  160. - run: |
  161. cmake -S . -B build \
  162. -D CMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} \
  163. -G Ninja \
  164. -D BUILD_WERROR=ON \
  165. -D GLSLANG_TESTS=ON \
  166. -D "CMAKE_OSX_ARCHITECTURES=arm64;x86_64"
  167. env:
  168. CC: ${{matrix.compiler.cc}}
  169. CXX: ${{matrix.compiler.cxx}}
  170. MACOSX_DEPLOYMENT_TARGET: 11.0
  171. - run: cmake --build build
  172. - run: cmake --install build --prefix build/install
  173. - name: Test find_package support
  174. run: |
  175. cmake -S Test/find_package -B build/find_package && \
  176. cmake --build build/find_package
  177. - run: ctest --output-on-failure --test-dir build
  178. macos-shared:
  179. # iOS is 10x expensive to run on GitHub machines, so only run if we know something else passed as well
  180. needs: windows-shared
  181. runs-on: ${{matrix.os}}
  182. strategy:
  183. fail-fast: false
  184. matrix:
  185. os: [macos-latest]
  186. compiler: [{cc: clang, cxx: clang++}]
  187. cmake_build_type: [Release]
  188. steps:
  189. - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  190. - run: ./update_glslang_sources.py
  191. - run: |
  192. cmake -S . -B build \
  193. -D CMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} \
  194. -G Ninja \
  195. -D BUILD_WERROR=ON \
  196. -D GLSLANG_TESTS=ON \
  197. -DBUILD_SHARED_LIBS=ON \
  198. -D "CMAKE_OSX_ARCHITECTURES=arm64;x86_64"
  199. env:
  200. CC: ${{matrix.compiler.cc}}
  201. CXX: ${{matrix.compiler.cxx}}
  202. MACOSX_DEPLOYMENT_TARGET: 11.0
  203. - run: cmake --build build
  204. - run: cmake --install build --prefix build/install
  205. - name: Test find_package support
  206. run: |
  207. cmake -S Test/find_package -B build/find_package && \
  208. cmake --build build/find_package
  209. - run: ctest --output-on-failure --test-dir build
  210. windows:
  211. needs: linux-shared # fastest job to do sanity check
  212. runs-on: ${{matrix.os.genus}}
  213. permissions:
  214. contents: write
  215. strategy:
  216. fail-fast: false
  217. matrix:
  218. os: [{genus: windows-2022, family: windows}]
  219. cmake_build_type: [Debug, Release]
  220. steps:
  221. - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  222. - run: python update_glslang_sources.py
  223. - name: Build
  224. run: |
  225. cmake -S. -Bbuild -G "Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX="$PWD/build/install" -DBUILD_WERROR=ON -D GLSLANG_TESTS=ON
  226. cmake --build build --config ${{matrix.cmake_build_type}} --target install
  227. - name: Test find_package support
  228. run: |
  229. cmake -S Test/find_package -B build/find_package
  230. cmake --build build/find_package
  231. - name: Test
  232. run: ctest -C ${{matrix.cmake_build_type}} --output-on-failure --test-dir build
  233. windows-shared:
  234. needs: linux-shared # fastest job to do sanity check
  235. runs-on: ${{matrix.os.genus}}
  236. permissions:
  237. contents: write
  238. strategy:
  239. fail-fast: false
  240. matrix:
  241. os: [{genus: windows-2022, family: windows}]
  242. cmake_build_type: [Debug, Release]
  243. steps:
  244. - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  245. - run: python update_glslang_sources.py
  246. - name: Build
  247. run: |
  248. cmake -S. -Bbuild -G "Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX="$PWD/build/install" -DBUILD_WERROR=ON -D GLSLANG_TESTS=ON -DBUILD_SHARED_LIBS=ON
  249. cmake --build build --config ${{matrix.cmake_build_type}} --target install
  250. - name: Test find_package support
  251. run: |
  252. cmake -S Test/find_package -B build/find_package
  253. cmake --build build/find_package
  254. - name: Test
  255. run: ctest -C ${{matrix.cmake_build_type}} --output-on-failure --test-dir build
  256. iOS:
  257. # iOS is 10x expensive to run on GitHub machines, so only run if we know something else passed as well
  258. needs: windows-shared
  259. runs-on: macos-latest
  260. steps:
  261. - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  262. - name: Setup ccache
  263. uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20
  264. with:
  265. key: IOS
  266. - run: ./update_glslang_sources.py
  267. # NOTE: The MacOS SDK ships universal binaries. CI should reflect this.
  268. - name: Configure Universal Binary for iOS
  269. run: |
  270. cmake -S . -B build \
  271. -D CMAKE_BUILD_TYPE=Debug \
  272. -D CMAKE_SYSTEM_NAME=iOS \
  273. "-D CMAKE_OSX_ARCHITECTURES=arm64;x86_64" \
  274. -G Ninja
  275. env:
  276. CMAKE_C_COMPILER_LAUNCHER: ccache
  277. CMAKE_CXX_COMPILER_LAUNCHER: ccache
  278. - run: cmake --build build
  279. - run: cmake --install build --prefix /tmp
  280. android:
  281. needs: linux-shared # fastest job to do sanity check
  282. runs-on: ubuntu-22.04
  283. strategy:
  284. matrix:
  285. # Android NDK currently offers 2 different toolchains.
  286. # Test both to ensure we are compatible with either approach.
  287. LEGACY: [ON, OFF]
  288. steps:
  289. - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  290. - name: Setup ccache
  291. uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20
  292. with:
  293. key: android-${{ matrix.LEGACY }}
  294. - run: ./update_glslang_sources.py
  295. - name: Configure for Android
  296. run: |
  297. cmake -S . -B build/ --toolchain $ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \
  298. -D CMAKE_BUILD_TYPE=Release \
  299. -D ANDROID_ABI=armeabi-v7a \
  300. -D ANDROID_USE_LEGACY_TOOLCHAIN_FILE=${{ matrix.LEGACY }} \
  301. -G Ninja
  302. env:
  303. CMAKE_C_COMPILER_LAUNCHER: ccache
  304. CMAKE_CXX_COMPILER_LAUNCHER: ccache
  305. - run: cmake --build build/
  306. - run: cmake --install build/ --prefix /tmp
  307. emscripten:
  308. needs: linux-shared # fastest job to do sanity check
  309. runs-on: ubuntu-22.04
  310. steps:
  311. - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  312. - name: Setup ccache
  313. uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20
  314. with:
  315. key: ubuntu-emscripten
  316. - uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14
  317. - name: Update Glslang Sources
  318. run: ./update_glslang_sources.py
  319. - name: Configure
  320. run: emcmake cmake -GNinja -Bbuild/web -DCMAKE_BUILD_TYPE=Release -DENABLE_GLSLANG_JS=ON -DENABLE_OPT=OFF
  321. env:
  322. CMAKE_GENERATOR: Ninja
  323. CMAKE_C_COMPILER_LAUNCHER: ccache
  324. CMAKE_CXX_COMPILER_LAUNCHER: ccache
  325. - name: Build
  326. run: cmake --build build/web