release.yml 21 KB

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