release.yml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. name: 'release'
  2. run-name: 'Create SDL release artifacts for ${{ inputs.commit }}'
  3. on:
  4. workflow_dispatch:
  5. inputs:
  6. commit:
  7. description: 'Commit of SDL'
  8. required: true
  9. jobs:
  10. src:
  11. runs-on: ubuntu-latest
  12. outputs:
  13. project: ${{ steps.releaser.outputs.project }}
  14. version: ${{ steps.releaser.outputs.version }}
  15. src-tar-gz: ${{ steps.releaser.outputs.src-tar-gz }}
  16. src-tar-xz: ${{ steps.releaser.outputs.src-tar-xz }}
  17. src-zip: ${{ steps.releaser.outputs.src-zip }}
  18. steps:
  19. - name: 'Set up Python'
  20. uses: actions/setup-python@v5
  21. with:
  22. python-version: '3.10'
  23. - name: 'Fetch releaser.py'
  24. uses: actions/checkout@v4
  25. with:
  26. sparse-checkout: 'build-scripts/releaser.py'
  27. - name: 'Set up SDL sources'
  28. uses: actions/checkout@v4
  29. with:
  30. path: 'SDL'
  31. fetch-depth: 0
  32. - name: 'Build Source archive'
  33. id: releaser
  34. shell: bash
  35. run: |
  36. python build-scripts/releaser.py \
  37. --create source \
  38. --commit ${{ inputs.commit }} \
  39. --project SDL3 \
  40. --root "${{ github.workspace }}/SDL" \
  41. --github \
  42. --debug
  43. - name: 'Store source archives'
  44. uses: actions/upload-artifact@v4
  45. with:
  46. name: sources
  47. path: '${{ github.workspace}}/dist'
  48. linux-verify:
  49. needs: [src]
  50. runs-on: ubuntu-latest
  51. steps:
  52. - name: 'Download source archives'
  53. uses: actions/download-artifact@v4
  54. with:
  55. name: sources
  56. path: '${{ github.workspace }}'
  57. - name: 'Unzip ${{ needs.src.outputs.src-zip }}'
  58. id: zip
  59. run: |
  60. mkdir /tmp/zipdir
  61. cd /tmp/zipdir
  62. unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
  63. echo "path=/tmp/zipdir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  64. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  65. id: tar
  66. run: |
  67. mkdir -p /tmp/tardir
  68. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  69. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  70. - name: 'Compare contents of ${{ needs.src.outputs.src-zip }} and ${{ needs.src.outputs.src-tar-gz }}'
  71. run: |
  72. diff /tmp/zipdir /tmp/tardir
  73. - name: 'Test versioning'
  74. shell: bash
  75. run: |
  76. ${{ steps.tar.outputs.path }}/build-scripts/test-versioning.sh
  77. - name: 'CMake (configure + build + tests)'
  78. run: |
  79. cmake -S ${{ steps.tar.outputs.path }} -B /tmp/build -DSDL_TEST_LIBRARY=TRUE -DSDL_TESTS=TRUE
  80. cmake --build /tmp/build --verbose
  81. ctest --test-dir /tmp/build --no-tests=error --output-on-failure
  82. dmg:
  83. needs: [src]
  84. runs-on: macos-latest
  85. outputs:
  86. dmg: ${{ steps.releaser.outputs.dmg }}
  87. steps:
  88. - name: 'Set up Python'
  89. uses: actions/setup-python@v5
  90. with:
  91. python-version: '3.10'
  92. - name: 'Fetch releaser.py'
  93. uses: actions/checkout@v4
  94. with:
  95. sparse-checkout: 'build-scripts/releaser.py'
  96. - name: 'Download source archives'
  97. uses: actions/download-artifact@v4
  98. with:
  99. name: sources
  100. path: '${{ github.workspace }}'
  101. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  102. id: tar
  103. run: |
  104. mkdir -p /tmp/tardir
  105. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  106. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  107. - name: 'Build SDL3.dmg'
  108. id: releaser
  109. shell: bash
  110. run: |
  111. python build-scripts/releaser.py \
  112. --create xcframework \
  113. --commit ${{ inputs.commit }} \
  114. --project SDL3 \
  115. --root "${{ steps.tar.outputs.path }}" \
  116. --github \
  117. --debug
  118. - name: 'Store DMG image file'
  119. uses: actions/upload-artifact@v4
  120. with:
  121. name: dmg
  122. path: '${{ github.workspace }}/dist'
  123. dmg-verify:
  124. needs: [dmg, src]
  125. runs-on: macos-latest
  126. steps:
  127. - name: 'Download source archives'
  128. uses: actions/download-artifact@v4
  129. with:
  130. name: sources
  131. path: '${{ github.workspace }}'
  132. - name: 'Download ${{ needs.dmg.outputs.dmg }}'
  133. uses: actions/download-artifact@v4
  134. with:
  135. name: dmg
  136. path: '${{ github.workspace }}'
  137. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  138. id: src
  139. run: |
  140. mkdir -p /tmp/tardir
  141. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  142. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  143. - name: 'Mount ${{ needs.dmg.outputs.dmg }}'
  144. id: mount
  145. run: |
  146. hdiutil attach '${{ github.workspace }}/${{ needs.dmg.outputs.dmg }}'
  147. mount_point="/Volumes/${{ needs.src.outputs.project }}"
  148. if [ ! -d "$mount_point/${{ needs.src.outputs.project }}.xcframework" ]; then
  149. echo "Cannot find ${{ needs.src.outputs.project }}.xcframework!"
  150. exit 1
  151. fi
  152. echo "mount_point=$mount_point">>$GITHUB_OUTPUT
  153. - name: 'CMake (configure + build) Darwin'
  154. run: |
  155. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  156. -DTEST_FULL=FALSE \
  157. -DTEST_STATIC=FALSE \
  158. -DTEST_TEST=FALSE \
  159. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
  160. -DCMAKE_SYSTEM_NAME=Darwin \
  161. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
  162. -B build_darwin
  163. cmake --build build_darwin --config Release --verbose
  164. - name: 'CMake (configure + build) iOS'
  165. run: |
  166. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  167. -DTEST_FULL=FALSE \
  168. -DTEST_STATIC=FALSE \
  169. -DTEST_TEST=FALSE \
  170. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
  171. -DCMAKE_SYSTEM_NAME=iOS \
  172. -DCMAKE_OSX_ARCHITECTURES="arm64" \
  173. -B build_ios
  174. cmake --build build_ios --config Release --verbose
  175. - name: 'CMake (configure + build) tvOS'
  176. run: |
  177. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  178. -DTEST_FULL=FALSE \
  179. -DTEST_STATIC=FALSE \
  180. -DTEST_TEST=FALSE \
  181. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
  182. -DCMAKE_SYSTEM_NAME=tvOS \
  183. -DCMAKE_OSX_ARCHITECTURES="arm64" \
  184. -B build_tvos
  185. cmake --build build_tvos --config Release --verbose
  186. - name: 'CMake (configure + build) iOS simulator'
  187. run: |
  188. sysroot=$(xcodebuild -version -sdk iphonesimulator Path)
  189. echo "sysroot=$sysroot"
  190. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  191. -DTEST_FULL=FALSE \
  192. -DTEST_STATIC=FALSE \
  193. -DTEST_TEST=FALSE \
  194. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
  195. -DCMAKE_SYSTEM_NAME=iOS \
  196. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
  197. -DCMAKE_OSX_SYSROOT="${sysroot}" \
  198. -B build_ios_simulator
  199. cmake --build build_ios_simulator --config Release --verbose
  200. - name: 'CMake (configure + build) tvOS simulator'
  201. run: |
  202. sysroot=$(xcodebuild -version -sdk appletvsimulator Path)
  203. echo "sysroot=$sysroot"
  204. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  205. -DTEST_FULL=FALSE \
  206. -DTEST_STATIC=FALSE \
  207. -DTEST_TEST=FALSE \
  208. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
  209. -DCMAKE_SYSTEM_NAME=tvOS \
  210. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
  211. -DCMAKE_OSX_SYSROOT="${sysroot}" \
  212. -B build_tvos_simulator
  213. cmake --build build_tvos_simulator --config Release --verbose
  214. msvc:
  215. needs: [src]
  216. runs-on: windows-2019
  217. outputs:
  218. VC-x86: ${{ steps.releaser.outputs.VC-x86 }}
  219. VC-x64: ${{ steps.releaser.outputs.VC-x64 }}
  220. VC-devel: ${{ steps.releaser.outputs.VC-devel }}
  221. steps:
  222. - name: 'Set up Python'
  223. uses: actions/setup-python@v5
  224. with:
  225. python-version: '3.10'
  226. - name: 'Fetch releaser.py'
  227. uses: actions/checkout@v4
  228. with:
  229. sparse-checkout: 'build-scripts/releaser.py'
  230. - name: 'Download source archives'
  231. uses: actions/download-artifact@v4
  232. with:
  233. name: sources
  234. path: '${{ github.workspace }}'
  235. - name: 'Unzip ${{ needs.src.outputs.src-zip }}'
  236. id: zip
  237. run: |
  238. mkdir C:\zipdir
  239. cd C:\zipdir
  240. unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
  241. echo "path=C:\zipdir\${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$Env:GITHUB_OUTPUT
  242. - name: 'Build MSVC binary archives'
  243. id: releaser
  244. run: |
  245. python build-scripts/releaser.py `
  246. --create win32 `
  247. --commit ${{ inputs.commit }} `
  248. --project SDL3 `
  249. --root "${{ steps.zip.outputs.path }}" `
  250. --github `
  251. --debug
  252. - name: 'Store MSVC archives'
  253. uses: actions/upload-artifact@v4
  254. with:
  255. name: win32
  256. path: '${{ github.workspace }}/dist'
  257. msvc-verify:
  258. needs: [msvc, src]
  259. runs-on: windows-latest
  260. steps:
  261. - name: 'Download source archives'
  262. uses: actions/download-artifact@v4
  263. with:
  264. name: sources
  265. path: '${{ github.workspace }}'
  266. - name: 'Download MSVC binaries'
  267. uses: actions/download-artifact@v4
  268. with:
  269. name: win32
  270. path: '${{ github.workspace }}'
  271. - name: 'Unzip ${{ needs.src.outputs.src-zip }}'
  272. id: src
  273. run: |
  274. mkdir '${{ github.workspace }}/sources'
  275. cd '${{ github.workspace }}/sources'
  276. unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
  277. echo "path=${{ github.workspace }}/sources/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
  278. - name: 'Unzip ${{ needs.msvc.outputs.VC-devel }}'
  279. id: bin
  280. run: |
  281. mkdir '${{ github.workspace }}/vc'
  282. cd '${{ github.workspace }}/vc'
  283. unzip "${{ github.workspace }}/${{ needs.msvc.outputs.VC-devel }}"
  284. echo "path=${{ github.workspace }}/vc/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
  285. - name: 'CMake (configure + build + tests) x86'
  286. run: |
  287. $env:PATH += ";${{ steps.bin.outputs.path }}/x86"
  288. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  289. -DTEST_FULL=TRUE `
  290. -DTEST_STATIC=FALSE `
  291. -DTEST_TEST=TRUE `
  292. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" `
  293. -B build_x86 -A win32
  294. cmake --build build_x86 --config Release --verbose
  295. ctest --test-dir build_x86 --no-tests=error -C Release --output-on-failure
  296. - name: 'CMake (configure + build + tests) x64'
  297. run: |
  298. $env:PATH += ";${{ steps.bin.outputs.path }}/x86"
  299. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  300. -DTEST_FULL=TRUE `
  301. -DTEST_STATIC=FALSE `
  302. -DTEST_TEST=TRUE `
  303. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" `
  304. -B build_x64 -A x64
  305. cmake --build build_x64 --config Release --verbose
  306. ctest --test-dir build_x64 --no-tests=error -C Release --output-on-failure
  307. mingw:
  308. needs: [src]
  309. runs-on: ubuntu-latest
  310. outputs:
  311. mingw-devel-tar-gz: ${{ steps.releaser.outputs.mingw-devel-tar-gz }}
  312. mingw-devel-tar-xz: ${{ steps.releaser.outputs.mingw-devel-tar-xz }}
  313. steps:
  314. - name: 'Set up Python'
  315. uses: actions/setup-python@v5
  316. with:
  317. python-version: '3.10'
  318. - name: 'Fetch releaser.py'
  319. uses: actions/checkout@v4
  320. with:
  321. sparse-checkout: 'build-scripts/releaser.py'
  322. - name: 'Install Mingw toolchain'
  323. run: |
  324. sudo apt-get update -y
  325. sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
  326. - name: 'Download source archives'
  327. uses: actions/download-artifact@v4
  328. with:
  329. name: sources
  330. path: '${{ github.workspace }}'
  331. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  332. id: tar
  333. run: |
  334. mkdir -p /tmp/tardir
  335. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  336. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  337. - name: 'Build MinGW binary archives'
  338. id: releaser
  339. run: |
  340. python build-scripts/releaser.py \
  341. --create mingw \
  342. --commit ${{ inputs.commit }} \
  343. --project SDL3 \
  344. --root "${{ steps.tar.outputs.path }}" \
  345. --github \
  346. --debug
  347. - name: 'Store MinGW archives'
  348. uses: actions/upload-artifact@v4
  349. with:
  350. name: mingw
  351. path: '${{ github.workspace }}/dist'
  352. mingw-verify:
  353. needs: [mingw, src]
  354. runs-on: ubuntu-latest
  355. steps:
  356. - name: 'Install Mingw toolchain'
  357. run: |
  358. sudo apt-get update -y
  359. sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
  360. - name: 'Download source archives'
  361. uses: actions/download-artifact@v4
  362. with:
  363. name: sources
  364. path: '${{ github.workspace }}'
  365. - name: 'Download MinGW binaries'
  366. uses: actions/download-artifact@v4
  367. with:
  368. name: mingw
  369. path: '${{ github.workspace }}'
  370. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  371. id: src
  372. run: |
  373. mkdir -p /tmp/tardir
  374. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  375. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  376. - name: 'Untar ${{ needs.mingw.outputs.mingw-devel-tar-gz }}'
  377. id: bin
  378. run: |
  379. mkdir -p /tmp/mingw-tardir
  380. tar -C /tmp/mingw-tardir -v -x -f "${{ github.workspace }}/${{ needs.mingw.outputs.mingw-devel-tar-gz }}"
  381. echo "path=/tmp/mingw-tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  382. - name: 'CMake (configure + build) i686'
  383. run: |
  384. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  385. -DCMAKE_BUILD_TYPE="Release" \
  386. -DTEST_FULL=TRUE \
  387. -DTEST_STATIC=TRUE \
  388. -DTEST_TEST=TRUE \
  389. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" \
  390. -DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-i686.cmake" \
  391. -DCMAKE_C_FLAGS="-DSDL_DISABLE_SSE4_2" \
  392. -B build_x86
  393. cmake --build build_x86 --config Release --verbose
  394. - name: 'CMake (configure + build) x86_64'
  395. run: |
  396. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  397. -DCMAKE_BUILD_TYPE="Release" \
  398. -DTEST_FULL=TRUE \
  399. -DTEST_STATIC=TRUE \
  400. -DTEST_TEST=TRUE \
  401. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" \
  402. -DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-x86_64.cmake" \
  403. -DCMAKE_C_FLAGS="-DSDL_DISABLE_SSE4_2" \
  404. -B build_x64
  405. cmake --build build_x64 --config Release --verbose