release.yml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  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. - name: 'CMake (configure + build) arm64'
  325. run: |
  326. $env:PATH += ";${{ steps.bin.outputs.path }}/x86"
  327. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  328. -DTEST_FULL=TRUE `
  329. -DTEST_STATIC=FALSE `
  330. -DTEST_TEST=TRUE `
  331. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" `
  332. -Werror=dev `
  333. -B build_arm64 -A ARM64
  334. cmake --build build_arm64 --config Release --verbose
  335. mingw:
  336. needs: [src]
  337. runs-on: ubuntu-latest
  338. outputs:
  339. mingw-devel-tar-gz: ${{ steps.releaser.outputs.mingw-devel-tar-gz }}
  340. mingw-devel-tar-xz: ${{ steps.releaser.outputs.mingw-devel-tar-xz }}
  341. steps:
  342. - name: 'Set up Python'
  343. uses: actions/setup-python@v5
  344. with:
  345. python-version: '3.10'
  346. - name: 'Fetch build-release.py'
  347. uses: actions/checkout@v4
  348. with:
  349. sparse-checkout: 'build-scripts/build-release.py'
  350. - name: 'Install Mingw toolchain'
  351. run: |
  352. sudo apt-get update -y
  353. sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
  354. - name: 'Download source archives'
  355. uses: actions/download-artifact@v4
  356. with:
  357. name: sources
  358. path: '${{ github.workspace }}'
  359. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  360. id: tar
  361. run: |
  362. mkdir -p /tmp/tardir
  363. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  364. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  365. - name: 'Build MinGW binary archives'
  366. id: releaser
  367. run: |
  368. python build-scripts/build-release.py \
  369. --create mingw \
  370. --commit ${{ inputs.commit }} \
  371. --project SDL3 \
  372. --root "${{ steps.tar.outputs.path }}" \
  373. --github \
  374. --debug
  375. - name: 'Store MinGW archives'
  376. uses: actions/upload-artifact@v4
  377. with:
  378. name: mingw
  379. path: '${{ github.workspace }}/dist'
  380. mingw-verify:
  381. needs: [mingw, src]
  382. runs-on: ubuntu-latest
  383. steps:
  384. - name: 'Install Mingw toolchain'
  385. run: |
  386. sudo apt-get update -y
  387. sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
  388. - name: 'Download source archives'
  389. uses: actions/download-artifact@v4
  390. with:
  391. name: sources
  392. path: '${{ github.workspace }}'
  393. - name: 'Download MinGW binaries'
  394. uses: actions/download-artifact@v4
  395. with:
  396. name: mingw
  397. path: '${{ github.workspace }}'
  398. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  399. id: src
  400. run: |
  401. mkdir -p /tmp/tardir
  402. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  403. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  404. - name: 'Untar ${{ needs.mingw.outputs.mingw-devel-tar-gz }}'
  405. id: bin
  406. run: |
  407. mkdir -p /tmp/mingw-tardir
  408. tar -C /tmp/mingw-tardir -v -x -f "${{ github.workspace }}/${{ needs.mingw.outputs.mingw-devel-tar-gz }}"
  409. echo "path=/tmp/mingw-tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  410. - name: 'CMake (configure + build) i686'
  411. run: |
  412. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  413. -DCMAKE_BUILD_TYPE="Release" \
  414. -DTEST_FULL=TRUE \
  415. -DTEST_STATIC=TRUE \
  416. -DTEST_TEST=TRUE \
  417. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" \
  418. -DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-i686.cmake" \
  419. -DCMAKE_C_FLAGS="-DSDL_DISABLE_SSE4_2" \
  420. -Werror=dev \
  421. -B build_x86
  422. cmake --build build_x86 --config Release --verbose
  423. - name: 'CMake (configure + build) x86_64'
  424. run: |
  425. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  426. -DCMAKE_BUILD_TYPE="Release" \
  427. -DTEST_FULL=TRUE \
  428. -DTEST_STATIC=TRUE \
  429. -DTEST_TEST=TRUE \
  430. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" \
  431. -DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-x86_64.cmake" \
  432. -DCMAKE_C_FLAGS="-DSDL_DISABLE_SSE4_2" \
  433. -Werror=dev \
  434. -B build_x64
  435. cmake --build build_x64 --config Release --verbose
  436. android:
  437. needs: [src]
  438. runs-on: ubuntu-latest
  439. outputs:
  440. android-aar: ${{ steps.releaser.outputs.android-aar }}
  441. steps:
  442. - name: 'Set up Python'
  443. uses: actions/setup-python@v5
  444. with:
  445. python-version: '3.10'
  446. - name: 'Fetch build-release.py'
  447. uses: actions/checkout@v4
  448. with:
  449. sparse-checkout: 'build-scripts/build-release.py'
  450. - name: 'Setup Android NDK'
  451. uses: nttld/setup-ndk@v1
  452. id: setup_ndk
  453. with:
  454. local-cache: true
  455. ndk-version: r21e
  456. - name: 'Setup Java JDK'
  457. uses: actions/setup-java@v4
  458. with:
  459. distribution: 'temurin'
  460. java-version: '11'
  461. - name: 'Install ninja'
  462. run: |
  463. sudo apt-get update -y
  464. sudo apt-get install -y ninja-build
  465. - name: 'Download source archives'
  466. uses: actions/download-artifact@v4
  467. with:
  468. name: sources
  469. path: '${{ github.workspace }}'
  470. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  471. id: tar
  472. run: |
  473. mkdir -p /tmp/tardir
  474. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  475. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  476. - name: 'Build Android prefab binary archive(s)'
  477. id: releaser
  478. run: |
  479. python build-scripts/build-release.py \
  480. --create android \
  481. --commit ${{ inputs.commit }} \
  482. --project SDL3 \
  483. --root "${{ steps.tar.outputs.path }}" \
  484. --github \
  485. --debug
  486. - name: 'Store Android archive(s)'
  487. uses: actions/upload-artifact@v4
  488. with:
  489. name: android
  490. path: '${{ github.workspace }}/dist'