release.yml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  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.11'
  23. - name: 'Fetch build-release.py'
  24. uses: actions/checkout@v4
  25. with:
  26. sparse-checkout: 'build-scripts/build-release.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/build-release.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 build-release.py'
  93. uses: actions/checkout@v4
  94. with:
  95. sparse-checkout: 'build-scripts/build-release.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 "${{ github.workspace }}/tardir"
  105. tar -C "${{ github.workspace }}/tardir" -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  106. echo "path=${{ github.workspace }}/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/build-release.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. -Werror=dev \
  163. -B build_darwin
  164. cmake --build build_darwin --config Release --verbose
  165. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  166. -DTEST_FULL=FALSE \
  167. -DTEST_STATIC=FALSE \
  168. -DTEST_TEST=FALSE \
  169. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}/SDL3.xcframework/macos-arm64_x86_64" \
  170. -DCMAKE_SYSTEM_NAME=Darwin \
  171. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
  172. -Werror=dev \
  173. -B build_darwin_2
  174. cmake --build build_darwin --config Release --verbose
  175. - name: 'CMake (configure + build) iOS'
  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=iOS \
  183. -DCMAKE_OSX_ARCHITECTURES="arm64" \
  184. -Werror=dev \
  185. -B build_ios
  186. cmake --build build_ios --config Release --verbose
  187. - name: 'CMake (configure + build) tvOS'
  188. run: |
  189. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  190. -DTEST_FULL=FALSE \
  191. -DTEST_STATIC=FALSE \
  192. -DTEST_TEST=FALSE \
  193. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
  194. -DCMAKE_SYSTEM_NAME=tvOS \
  195. -DCMAKE_OSX_ARCHITECTURES="arm64" \
  196. -Werror=dev \
  197. -B build_tvos
  198. cmake --build build_tvos --config Release --verbose
  199. - name: 'CMake (configure + build) iOS simulator'
  200. run: |
  201. sysroot=$(xcodebuild -version -sdk iphonesimulator Path)
  202. echo "sysroot=$sysroot"
  203. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  204. -DTEST_FULL=FALSE \
  205. -DTEST_STATIC=FALSE \
  206. -DTEST_TEST=FALSE \
  207. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
  208. -DCMAKE_SYSTEM_NAME=iOS \
  209. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
  210. -DCMAKE_OSX_SYSROOT="${sysroot}" \
  211. -Werror=dev \
  212. -B build_ios_simulator
  213. cmake --build build_ios_simulator --config Release --verbose
  214. - name: 'CMake (configure + build) tvOS simulator'
  215. run: |
  216. sysroot=$(xcodebuild -version -sdk appletvsimulator Path)
  217. echo "sysroot=$sysroot"
  218. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  219. -DTEST_FULL=FALSE \
  220. -DTEST_STATIC=FALSE \
  221. -DTEST_TEST=FALSE \
  222. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
  223. -DCMAKE_SYSTEM_NAME=tvOS \
  224. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
  225. -DCMAKE_OSX_SYSROOT="${sysroot}" \
  226. -Werror=dev \
  227. -B build_tvos_simulator
  228. cmake --build build_tvos_simulator --config Release --verbose
  229. msvc:
  230. needs: [src]
  231. runs-on: windows-2019
  232. outputs:
  233. VC-x86: ${{ steps.releaser.outputs.VC-x86 }}
  234. VC-x64: ${{ steps.releaser.outputs.VC-x64 }}
  235. VC-devel: ${{ steps.releaser.outputs.VC-devel }}
  236. steps:
  237. - name: 'Set up Python'
  238. uses: actions/setup-python@v5
  239. with:
  240. python-version: '3.10'
  241. - name: 'Fetch build-release.py'
  242. uses: actions/checkout@v4
  243. with:
  244. sparse-checkout: 'build-scripts/build-release.py'
  245. - name: 'Download source archives'
  246. uses: actions/download-artifact@v4
  247. with:
  248. name: sources
  249. path: '${{ github.workspace }}'
  250. - name: 'Unzip ${{ needs.src.outputs.src-zip }}'
  251. id: zip
  252. run: |
  253. New-Item C:\temp -ItemType Directory -ErrorAction SilentlyContinue
  254. cd C:\temp
  255. unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
  256. echo "path=C:\temp\${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$Env:GITHUB_OUTPUT
  257. - name: 'Build MSVC binary archives'
  258. id: releaser
  259. run: |
  260. python build-scripts/build-release.py `
  261. --create win32 `
  262. --commit ${{ inputs.commit }} `
  263. --project SDL3 `
  264. --root "${{ steps.zip.outputs.path }}" `
  265. --github `
  266. --debug
  267. - name: 'Store MSVC archives'
  268. uses: actions/upload-artifact@v4
  269. with:
  270. name: win32
  271. path: '${{ github.workspace }}/dist'
  272. msvc-verify:
  273. needs: [msvc, src]
  274. runs-on: windows-latest
  275. steps:
  276. - name: 'Download source archives'
  277. uses: actions/download-artifact@v4
  278. with:
  279. name: sources
  280. path: '${{ github.workspace }}'
  281. - name: 'Download MSVC binaries'
  282. uses: actions/download-artifact@v4
  283. with:
  284. name: win32
  285. path: '${{ github.workspace }}'
  286. - name: 'Unzip ${{ needs.src.outputs.src-zip }}'
  287. id: src
  288. run: |
  289. mkdir '${{ github.workspace }}/sources'
  290. cd '${{ github.workspace }}/sources'
  291. unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
  292. echo "path=${{ github.workspace }}/sources/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
  293. - name: 'Unzip ${{ needs.msvc.outputs.VC-devel }}'
  294. id: bin
  295. run: |
  296. mkdir '${{ github.workspace }}/vc'
  297. cd '${{ github.workspace }}/vc'
  298. unzip "${{ github.workspace }}/${{ needs.msvc.outputs.VC-devel }}"
  299. echo "path=${{ github.workspace }}/vc/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
  300. - name: 'CMake (configure + build + tests) x86'
  301. run: |
  302. $env:PATH += ";${{ steps.bin.outputs.path }}/x86"
  303. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  304. -DTEST_FULL=TRUE `
  305. -DTEST_STATIC=FALSE `
  306. -DTEST_TEST=TRUE `
  307. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" `
  308. -Werror=dev `
  309. -B build_x86 -A win32
  310. cmake --build build_x86 --config Release --verbose
  311. ctest --test-dir build_x86 --no-tests=error -C Release --output-on-failure
  312. - name: 'CMake (configure + build + tests) x64'
  313. run: |
  314. $env:PATH += ";${{ steps.bin.outputs.path }}/x86"
  315. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  316. -DTEST_FULL=TRUE `
  317. -DTEST_STATIC=FALSE `
  318. -DTEST_TEST=TRUE `
  319. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" `
  320. -Werror=dev `
  321. -B build_x64 -A x64
  322. cmake --build build_x64 --config Release --verbose
  323. ctest --test-dir build_x64 --no-tests=error -C Release --output-on-failure
  324. mingw:
  325. needs: [src]
  326. runs-on: ubuntu-latest
  327. outputs:
  328. mingw-devel-tar-gz: ${{ steps.releaser.outputs.mingw-devel-tar-gz }}
  329. mingw-devel-tar-xz: ${{ steps.releaser.outputs.mingw-devel-tar-xz }}
  330. steps:
  331. - name: 'Set up Python'
  332. uses: actions/setup-python@v5
  333. with:
  334. python-version: '3.10'
  335. - name: 'Fetch build-release.py'
  336. uses: actions/checkout@v4
  337. with:
  338. sparse-checkout: 'build-scripts/build-release.py'
  339. - name: 'Install Mingw toolchain'
  340. run: |
  341. sudo apt-get update -y
  342. sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
  343. - name: 'Download source archives'
  344. uses: actions/download-artifact@v4
  345. with:
  346. name: sources
  347. path: '${{ github.workspace }}'
  348. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  349. id: tar
  350. run: |
  351. mkdir -p /tmp/tardir
  352. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  353. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  354. - name: 'Build MinGW binary archives'
  355. id: releaser
  356. run: |
  357. python build-scripts/build-release.py \
  358. --create mingw \
  359. --commit ${{ inputs.commit }} \
  360. --project SDL3 \
  361. --root "${{ steps.tar.outputs.path }}" \
  362. --github \
  363. --debug
  364. - name: 'Store MinGW archives'
  365. uses: actions/upload-artifact@v4
  366. with:
  367. name: mingw
  368. path: '${{ github.workspace }}/dist'
  369. mingw-verify:
  370. needs: [mingw, src]
  371. runs-on: ubuntu-latest
  372. steps:
  373. - name: 'Install Mingw toolchain'
  374. run: |
  375. sudo apt-get update -y
  376. sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
  377. - name: 'Download source archives'
  378. uses: actions/download-artifact@v4
  379. with:
  380. name: sources
  381. path: '${{ github.workspace }}'
  382. - name: 'Download MinGW binaries'
  383. uses: actions/download-artifact@v4
  384. with:
  385. name: mingw
  386. path: '${{ github.workspace }}'
  387. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  388. id: src
  389. run: |
  390. mkdir -p /tmp/tardir
  391. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  392. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  393. - name: 'Untar ${{ needs.mingw.outputs.mingw-devel-tar-gz }}'
  394. id: bin
  395. run: |
  396. mkdir -p /tmp/mingw-tardir
  397. tar -C /tmp/mingw-tardir -v -x -f "${{ github.workspace }}/${{ needs.mingw.outputs.mingw-devel-tar-gz }}"
  398. echo "path=/tmp/mingw-tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  399. - name: 'CMake (configure + build) i686'
  400. run: |
  401. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  402. -DCMAKE_BUILD_TYPE="Release" \
  403. -DTEST_FULL=TRUE \
  404. -DTEST_STATIC=TRUE \
  405. -DTEST_TEST=TRUE \
  406. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" \
  407. -DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-i686.cmake" \
  408. -DCMAKE_C_FLAGS="-DSDL_DISABLE_SSE4_2" \
  409. -Werror=dev \
  410. -B build_x86
  411. cmake --build build_x86 --config Release --verbose
  412. - name: 'CMake (configure + build) x86_64'
  413. run: |
  414. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  415. -DCMAKE_BUILD_TYPE="Release" \
  416. -DTEST_FULL=TRUE \
  417. -DTEST_STATIC=TRUE \
  418. -DTEST_TEST=TRUE \
  419. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" \
  420. -DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-x86_64.cmake" \
  421. -DCMAKE_C_FLAGS="-DSDL_DISABLE_SSE4_2" \
  422. -Werror=dev \
  423. -B build_x64
  424. cmake --build build_x64 --config Release --verbose
  425. android:
  426. needs: [src]
  427. runs-on: ubuntu-latest
  428. outputs:
  429. android-aar: ${{ steps.releaser.outputs.android-aar }}
  430. steps:
  431. - name: 'Set up Python'
  432. uses: actions/setup-python@v5
  433. with:
  434. python-version: '3.10'
  435. - name: 'Fetch build-release.py'
  436. uses: actions/checkout@v4
  437. with:
  438. sparse-checkout: 'build-scripts/build-release.py'
  439. - name: 'Setup Android NDK'
  440. uses: nttld/setup-ndk@v1
  441. id: setup_ndk
  442. with:
  443. local-cache: true
  444. ndk-version: r21e
  445. - name: 'Setup Java JDK'
  446. uses: actions/setup-java@v4
  447. with:
  448. distribution: 'temurin'
  449. java-version: '11'
  450. - name: 'Install ninja'
  451. run: |
  452. sudo apt-get update -y
  453. sudo apt-get install -y ninja-build
  454. - name: 'Download source archives'
  455. uses: actions/download-artifact@v4
  456. with:
  457. name: sources
  458. path: '${{ github.workspace }}'
  459. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  460. id: tar
  461. run: |
  462. mkdir -p /tmp/tardir
  463. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  464. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  465. - name: 'Build Android prefab binary archive(s)'
  466. id: releaser
  467. run: |
  468. python build-scripts/build-release.py \
  469. --create android \
  470. --commit ${{ inputs.commit }} \
  471. --project SDL3 \
  472. --root "${{ steps.tar.outputs.path }}" \
  473. --github \
  474. --debug
  475. - name: 'Store Android archive(s)'
  476. uses: actions/upload-artifact@v4
  477. with:
  478. name: android
  479. path: '${{ github.workspace }}/dist'