release.yml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  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. --actions source \
  38. --commit ${{ inputs.commit }} \
  39. --root "${{ github.workspace }}/SDL" \
  40. --github \
  41. --debug
  42. - name: 'Store source archives'
  43. uses: actions/upload-artifact@v4
  44. with:
  45. name: sources
  46. path: '${{ github.workspace}}/dist'
  47. linux-verify:
  48. needs: [src]
  49. runs-on: ubuntu-latest
  50. steps:
  51. - name: 'Download source archives'
  52. uses: actions/download-artifact@v4
  53. with:
  54. name: sources
  55. path: '${{ github.workspace }}'
  56. - name: 'Unzip ${{ needs.src.outputs.src-zip }}'
  57. id: zip
  58. run: |
  59. mkdir /tmp/zipdir
  60. cd /tmp/zipdir
  61. unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
  62. echo "path=/tmp/zipdir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  63. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  64. id: tar
  65. run: |
  66. mkdir -p /tmp/tardir
  67. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  68. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  69. - name: 'Compare contents of ${{ needs.src.outputs.src-zip }} and ${{ needs.src.outputs.src-tar-gz }}'
  70. run: |
  71. diff /tmp/zipdir /tmp/tardir
  72. - name: 'Test versioning'
  73. shell: bash
  74. run: |
  75. ${{ steps.tar.outputs.path }}/build-scripts/test-versioning.sh
  76. - name: 'CMake (configure + build + tests + examples)'
  77. run: |
  78. cmake -S ${{ steps.tar.outputs.path }} -B /tmp/build -DSDL_TEST_LIBRARY=TRUE -DSDL_TESTS=TRUE -DSDL_EXAMPLES=TRUE
  79. cmake --build /tmp/build --verbose
  80. ctest --test-dir /tmp/build --no-tests=error --output-on-failure
  81. dmg:
  82. needs: [src]
  83. runs-on: macos-latest
  84. outputs:
  85. dmg: ${{ steps.releaser.outputs.dmg }}
  86. steps:
  87. - name: 'Set up Python'
  88. uses: actions/setup-python@v5
  89. with:
  90. python-version: '3.11'
  91. - name: 'Fetch build-release.py'
  92. uses: actions/checkout@v4
  93. with:
  94. sparse-checkout: 'build-scripts/build-release.py'
  95. - name: 'Download source archives'
  96. uses: actions/download-artifact@v4
  97. with:
  98. name: sources
  99. path: '${{ github.workspace }}'
  100. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  101. id: tar
  102. run: |
  103. mkdir -p "${{ github.workspace }}/tardir"
  104. tar -C "${{ github.workspace }}/tardir" -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  105. echo "path=${{ github.workspace }}/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  106. - name: 'Build SDL3.dmg'
  107. id: releaser
  108. shell: bash
  109. run: |
  110. python build-scripts/build-release.py \
  111. --actions dmg \
  112. --commit ${{ inputs.commit }} \
  113. --root "${{ steps.tar.outputs.path }}" \
  114. --github \
  115. --debug
  116. - name: 'Store DMG image file'
  117. uses: actions/upload-artifact@v4
  118. with:
  119. name: dmg
  120. path: '${{ github.workspace }}/dist'
  121. dmg-verify:
  122. needs: [dmg, src]
  123. runs-on: macos-latest
  124. steps:
  125. - name: 'Download source archives'
  126. uses: actions/download-artifact@v4
  127. with:
  128. name: sources
  129. path: '${{ github.workspace }}'
  130. - name: 'Download ${{ needs.dmg.outputs.dmg }}'
  131. uses: actions/download-artifact@v4
  132. with:
  133. name: dmg
  134. path: '${{ github.workspace }}'
  135. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  136. id: src
  137. run: |
  138. mkdir -p /tmp/tardir
  139. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  140. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  141. - name: 'Mount ${{ needs.dmg.outputs.dmg }}'
  142. id: mount
  143. run: |
  144. hdiutil attach '${{ github.workspace }}/${{ needs.dmg.outputs.dmg }}'
  145. mount_point="/Volumes/${{ needs.src.outputs.project }}"
  146. if [ ! -d "$mount_point/${{ needs.src.outputs.project }}.xcframework" ]; then
  147. echo "Cannot find ${{ needs.src.outputs.project }}.xcframework!"
  148. exit 1
  149. fi
  150. echo "mount_point=$mount_point">>$GITHUB_OUTPUT
  151. - name: 'CMake (configure + build) Darwin'
  152. run: |
  153. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  154. -DTEST_FULL=FALSE \
  155. -DTEST_STATIC=FALSE \
  156. -DTEST_TEST=FALSE \
  157. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
  158. -DCMAKE_SYSTEM_NAME=Darwin \
  159. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
  160. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 \
  161. -Werror=dev \
  162. -B build_darwin
  163. cmake --build build_darwin --config Release --verbose
  164. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  165. -DTEST_FULL=FALSE \
  166. -DTEST_STATIC=FALSE \
  167. -DTEST_TEST=FALSE \
  168. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}/SDL3.xcframework/macos-arm64_x86_64" \
  169. -DCMAKE_SYSTEM_NAME=Darwin \
  170. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
  171. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 \
  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. -DCMAKE_OSX_DEPLOYMENT_TARGET=9.0 \
  185. -Werror=dev \
  186. -B build_ios
  187. cmake --build build_ios --config Release --verbose
  188. - name: 'CMake (configure + build) tvOS'
  189. run: |
  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=tvOS \
  196. -DCMAKE_OSX_ARCHITECTURES="arm64" \
  197. -DCMAKE_OSX_DEPLOYMENT_TARGET=9.0 \
  198. -Werror=dev \
  199. -B build_tvos
  200. cmake --build build_tvos --config Release --verbose
  201. - name: 'CMake (configure + build) iOS simulator'
  202. run: |
  203. sysroot=$(xcodebuild -version -sdk iphonesimulator Path)
  204. echo "sysroot=$sysroot"
  205. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  206. -DTEST_FULL=FALSE \
  207. -DTEST_STATIC=FALSE \
  208. -DTEST_TEST=FALSE \
  209. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
  210. -DCMAKE_SYSTEM_NAME=iOS \
  211. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
  212. -DCMAKE_OSX_SYSROOT="${sysroot}" \
  213. -DCMAKE_OSX_DEPLOYMENT_TARGET=9.0 \
  214. -Werror=dev \
  215. -B build_ios_simulator
  216. cmake --build build_ios_simulator --config Release --verbose
  217. - name: 'CMake (configure + build) tvOS simulator'
  218. run: |
  219. sysroot=$(xcodebuild -version -sdk appletvsimulator Path)
  220. echo "sysroot=$sysroot"
  221. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  222. -DTEST_FULL=FALSE \
  223. -DTEST_STATIC=FALSE \
  224. -DTEST_TEST=FALSE \
  225. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
  226. -DCMAKE_SYSTEM_NAME=tvOS \
  227. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
  228. -DCMAKE_OSX_SYSROOT="${sysroot}" \
  229. -DCMAKE_OSX_DEPLOYMENT_TARGET=9.0 \
  230. -Werror=dev \
  231. -B build_tvos_simulator
  232. cmake --build build_tvos_simulator --config Release --verbose
  233. msvc:
  234. needs: [src]
  235. runs-on: windows-2019
  236. outputs:
  237. VC-x86: ${{ steps.releaser.outputs.VC-x86 }}
  238. VC-x64: ${{ steps.releaser.outputs.VC-x64 }}
  239. VC-arm64: ${{ steps.releaser.outputs.VC-arm64 }}
  240. VC-devel: ${{ steps.releaser.outputs.VC-devel }}
  241. steps:
  242. - name: 'Set up Python'
  243. uses: actions/setup-python@v5
  244. with:
  245. python-version: '3.11'
  246. - name: 'Fetch build-release.py'
  247. uses: actions/checkout@v4
  248. with:
  249. sparse-checkout: 'build-scripts/build-release.py'
  250. - name: 'Download source archives'
  251. uses: actions/download-artifact@v4
  252. with:
  253. name: sources
  254. path: '${{ github.workspace }}'
  255. - name: 'Unzip ${{ needs.src.outputs.src-zip }}'
  256. id: zip
  257. run: |
  258. New-Item C:\temp -ItemType Directory -ErrorAction SilentlyContinue
  259. cd C:\temp
  260. unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
  261. echo "path=C:\temp\${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$Env:GITHUB_OUTPUT
  262. - name: 'Build MSVC binary archives'
  263. id: releaser
  264. run: |
  265. python build-scripts/build-release.py `
  266. --actions msvc `
  267. --commit ${{ inputs.commit }} `
  268. --root "${{ steps.zip.outputs.path }}" `
  269. --github `
  270. --debug
  271. - name: 'Store MSVC archives'
  272. uses: actions/upload-artifact@v4
  273. with:
  274. name: win32
  275. path: '${{ github.workspace }}/dist'
  276. msvc-verify:
  277. needs: [msvc, src]
  278. runs-on: windows-latest
  279. steps:
  280. - name: 'Fetch .github/actions/setup-ninja/action.yml'
  281. uses: actions/checkout@v4
  282. with:
  283. sparse-checkout: '.github/actions/setup-ninja/action.yml'
  284. - name: 'Download source archives'
  285. uses: actions/download-artifact@v4
  286. with:
  287. name: sources
  288. path: '${{ github.workspace }}'
  289. - name: 'Download MSVC binaries'
  290. uses: actions/download-artifact@v4
  291. with:
  292. name: win32
  293. path: '${{ github.workspace }}'
  294. - name: 'Unzip ${{ needs.src.outputs.src-zip }}'
  295. id: src
  296. run: |
  297. mkdir '${{ github.workspace }}/sources'
  298. cd '${{ github.workspace }}/sources'
  299. unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
  300. echo "path=${{ github.workspace }}/sources/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
  301. - name: 'Unzip ${{ needs.msvc.outputs.VC-devel }}'
  302. id: bin
  303. run: |
  304. mkdir '${{ github.workspace }}/vc'
  305. cd '${{ github.workspace }}/vc'
  306. unzip "${{ github.workspace }}/${{ needs.msvc.outputs.VC-devel }}"
  307. echo "path=${{ github.workspace }}/vc/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
  308. - name: Set up ninja
  309. uses: ./.github/actions/setup-ninja
  310. - name: 'Configure vcvars x86'
  311. uses: ilammy/msvc-dev-cmd@v1
  312. with:
  313. arch: x64_x86
  314. - name: 'CMake (configure + build + tests) x86'
  315. run: |
  316. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  317. -B build_x86 `
  318. -GNinja `
  319. -DCMAKE_BUILD_TYPE=Debug `
  320. -Werror=dev `
  321. -DTEST_FULL=TRUE `
  322. -DTEST_STATIC=FALSE `
  323. -DTEST_SHARED=TRUE `
  324. -DTEST_TEST=TRUE `
  325. -DCMAKE_SUPPRESS_REGENERATION=TRUE `
  326. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}"
  327. Start-Sleep -Seconds 2
  328. cmake --build build_x86 --config Release --verbose
  329. ctest --test-dir build_x86 --no-tests=error -C Release --output-on-failure
  330. - name: 'Configure vcvars x64'
  331. uses: ilammy/msvc-dev-cmd@v1
  332. with:
  333. arch: x64
  334. - name: 'CMake (configure + build + tests) x64'
  335. run: |
  336. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  337. -B build_x64 `
  338. -GNinja `
  339. -DCMAKE_BUILD_TYPE=Debug `
  340. -Werror=dev `
  341. -DTEST_FULL=TRUE `
  342. -DTEST_STATIC=FALSE `
  343. -DTEST_SHARED=TRUE `
  344. -DTEST_TEST=TRUE `
  345. -DCMAKE_SUPPRESS_REGENERATION=TRUE `
  346. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}"
  347. Start-Sleep -Seconds 2
  348. cmake --build build_x64 --config Release --verbose
  349. ctest --test-dir build_x64 --no-tests=error -C Release --output-on-failure
  350. - name: 'Configure vcvars arm64'
  351. uses: ilammy/msvc-dev-cmd@v1
  352. with:
  353. arch: x64_arm64
  354. - name: 'CMake (configure + build) arm64'
  355. run: |
  356. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  357. -B build_arm64 `
  358. -GNinja `
  359. -DCMAKE_BUILD_TYPE=Debug `
  360. -Werror=dev `
  361. -DTEST_FULL=TRUE `
  362. -DTEST_STATIC=FALSE `
  363. -DTEST_SHARED=TRUE `
  364. -DTEST_TEST=TRUE `
  365. -DCMAKE_SUPPRESS_REGENERATION=TRUE `
  366. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}"
  367. Start-Sleep -Seconds 2
  368. cmake --build build_arm64 --config Release --verbose
  369. - name: 'CMake (configure + build) arm64ec'
  370. run: |
  371. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  372. -B build_arm64ec `
  373. -GNinja `
  374. -DCMAKE_BUILD_TYPE=Debug `
  375. -Werror=dev `
  376. -DTEST_FULL=TRUE `
  377. -DTEST_STATIC=FALSE `
  378. -DTEST_SHARED=TRUE `
  379. -DTEST_TEST=TRUE `
  380. -DSDL_DISABLE_AVX=TRUE `
  381. -DSDL_DISABLE_AVX2=TRUE `
  382. -DSDL_DISABLE_AVX512F=TRUE `
  383. -DCMAKE_SUPPRESS_REGENERATION=TRUE `
  384. -DCMAKE_C_FLAGS="/arm64EC" `
  385. -DCMAKE_CXX_FLAGS="/arm64EC" `
  386. -DCMAKE_EXE_LINKER_FLAGS="/MACHINE:ARM64EC" `
  387. -DCMAKE_SHARED_LINKER_FLAGS="/MACHINE:ARM64EC" `
  388. -DCMAKE_STATIC_LINKER_FLAGS="/MACHINE:ARM64EC" `
  389. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}"
  390. Start-Sleep -Seconds 2
  391. cmake --build build_arm64ec --config Release --verbose
  392. mingw:
  393. needs: [src]
  394. runs-on: ubuntu-24.04 # FIXME: current ubuntu-latest ships an outdated mingw, replace with ubuntu-latest once 24.04 becomes the new default
  395. outputs:
  396. mingw-devel-tar-gz: ${{ steps.releaser.outputs.mingw-devel-tar-gz }}
  397. mingw-devel-tar-xz: ${{ steps.releaser.outputs.mingw-devel-tar-xz }}
  398. steps:
  399. - name: 'Set up Python'
  400. uses: actions/setup-python@v5
  401. with:
  402. python-version: '3.11'
  403. - name: 'Fetch build-release.py'
  404. uses: actions/checkout@v4
  405. with:
  406. sparse-checkout: 'build-scripts/build-release.py'
  407. - name: 'Install Mingw toolchain'
  408. run: |
  409. sudo apt-get update -y
  410. sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
  411. - name: 'Download source archives'
  412. uses: actions/download-artifact@v4
  413. with:
  414. name: sources
  415. path: '${{ github.workspace }}'
  416. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  417. id: tar
  418. run: |
  419. mkdir -p /tmp/tardir
  420. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  421. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  422. - name: 'Build MinGW binary archives'
  423. id: releaser
  424. run: |
  425. python build-scripts/build-release.py \
  426. --actions mingw \
  427. --commit ${{ inputs.commit }} \
  428. --root "${{ steps.tar.outputs.path }}" \
  429. --github \
  430. --debug
  431. - name: 'Store MinGW archives'
  432. uses: actions/upload-artifact@v4
  433. with:
  434. name: mingw
  435. path: '${{ github.workspace }}/dist'
  436. mingw-verify:
  437. needs: [mingw, src]
  438. runs-on: ubuntu-latest
  439. steps:
  440. - name: 'Install Mingw toolchain'
  441. run: |
  442. sudo apt-get update -y
  443. sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
  444. - name: 'Download source archives'
  445. uses: actions/download-artifact@v4
  446. with:
  447. name: sources
  448. path: '${{ github.workspace }}'
  449. - name: 'Download MinGW binaries'
  450. uses: actions/download-artifact@v4
  451. with:
  452. name: mingw
  453. path: '${{ github.workspace }}'
  454. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  455. id: src
  456. run: |
  457. mkdir -p /tmp/tardir
  458. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  459. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  460. - name: 'Untar ${{ needs.mingw.outputs.mingw-devel-tar-gz }}'
  461. id: bin
  462. run: |
  463. mkdir -p /tmp/mingw-tardir
  464. tar -C /tmp/mingw-tardir -v -x -f "${{ github.workspace }}/${{ needs.mingw.outputs.mingw-devel-tar-gz }}"
  465. echo "path=/tmp/mingw-tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  466. - name: 'CMake (configure + build) i686'
  467. run: |
  468. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  469. -DCMAKE_BUILD_TYPE="Release" \
  470. -DTEST_FULL=TRUE \
  471. -DTEST_STATIC=FALSE \
  472. -DTEST_TEST=TRUE \
  473. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" \
  474. -DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-i686.cmake" \
  475. -DCMAKE_C_FLAGS="-DSDL_DISABLE_SSE4_2" \
  476. -Werror=dev \
  477. -B build_x86
  478. cmake --build build_x86 --config Release --verbose
  479. - name: 'CMake (configure + build) x86_64'
  480. run: |
  481. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  482. -DCMAKE_BUILD_TYPE="Release" \
  483. -DTEST_FULL=TRUE \
  484. -DTEST_STATIC=false \
  485. -DTEST_TEST=TRUE \
  486. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" \
  487. -DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-x86_64.cmake" \
  488. -DCMAKE_C_FLAGS="-DSDL_DISABLE_SSE4_2" \
  489. -Werror=dev \
  490. -B build_x64
  491. cmake --build build_x64 --config Release --verbose
  492. android:
  493. needs: [src]
  494. runs-on: ubuntu-latest
  495. outputs:
  496. android-aar: ${{ steps.releaser.outputs.android-aar }}
  497. steps:
  498. - name: 'Set up Python'
  499. uses: actions/setup-python@v5
  500. with:
  501. python-version: '3.11'
  502. - name: 'Fetch build-release.py'
  503. uses: actions/checkout@v4
  504. with:
  505. sparse-checkout: 'build-scripts/build-release.py'
  506. - name: 'Setup Android NDK'
  507. uses: nttld/setup-ndk@v1
  508. with:
  509. local-cache: true
  510. ndk-version: r21e
  511. - name: 'Setup Java JDK'
  512. uses: actions/setup-java@v4
  513. with:
  514. distribution: 'temurin'
  515. java-version: '11'
  516. - name: 'Install ninja'
  517. run: |
  518. sudo apt-get update -y
  519. sudo apt-get install -y ninja-build
  520. - name: 'Download source archives'
  521. uses: actions/download-artifact@v4
  522. with:
  523. name: sources
  524. path: '${{ github.workspace }}'
  525. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  526. id: tar
  527. run: |
  528. mkdir -p /tmp/tardir
  529. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  530. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  531. - name: 'Build Android prefab binary archive(s)'
  532. id: releaser
  533. run: |
  534. python build-scripts/build-release.py \
  535. --actions android \
  536. --commit ${{ inputs.commit }} \
  537. --root "${{ steps.tar.outputs.path }}" \
  538. --github \
  539. --debug
  540. - name: 'Store Android archive(s)'
  541. uses: actions/upload-artifact@v4
  542. with:
  543. name: android
  544. path: '${{ github.workspace }}/dist'
  545. android-verify:
  546. needs: [android, src]
  547. runs-on: ubuntu-latest
  548. steps:
  549. - name: 'Set up Python'
  550. uses: actions/setup-python@v5
  551. with:
  552. python-version: '3.11'
  553. - uses: actions/setup-java@v4
  554. with:
  555. distribution: 'temurin'
  556. java-version: '17'
  557. - name: 'Download source archives'
  558. uses: actions/download-artifact@v4
  559. with:
  560. name: sources
  561. path: '${{ github.workspace }}'
  562. - name: 'Download Android .aar archive'
  563. uses: actions/download-artifact@v4
  564. with:
  565. name: android
  566. path: '${{ github.workspace }}'
  567. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  568. id: src
  569. run: |
  570. mkdir -p /tmp/tardir
  571. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  572. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  573. - name: 'Extract Android SDK from AAR'
  574. id: sdk
  575. run: |
  576. python "${{ github.workspace }}/${{ needs.android.outputs.android-aar }}" -o /tmp/SDL3-android
  577. echo "prefix=/tmp/SDL3-android" >>$GITHUB_OUTPUT
  578. - name: 'CMake (configure + build) x86, x64, arm32, arm64'
  579. run: |
  580. android_abis="x86 x86_64 armeabi-v7a arm64-v8a"
  581. for android_abi in ${android_abis}; do
  582. echo "Configuring ${android_abi}..."
  583. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  584. -DTEST_FULL=TRUE \
  585. -DTEST_STATIC=FALSE \
  586. -DTEST_TEST=TRUE \
  587. -DCMAKE_PREFIX_PATH="${{ steps.sdk.outputs.prefix }}" \
  588. -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
  589. -DANDROID_ABI=${android_abi} \
  590. -DCMAKE_BUILD_TYPE=Release \
  591. -B "${android_abi}"
  592. echo "Building ${android_abi}..."
  593. cmake --build "${android_abi}" --config Release --verbose
  594. done
  595. - name: 'Create gradle project'
  596. id: create-gradle-project
  597. run: |
  598. python ${{ steps.src.outputs.path }}/build-scripts/create-android-project.py \
  599. org.libsdl.testspriteminimal \
  600. ${{ steps.src.outputs.path }}/test/testspriteminimal.c \
  601. ${{ steps.src.outputs.path }}/test/icon.h \
  602. --variant aar \
  603. --output "/tmp/projects"
  604. echo "path=/tmp/projects/org.libsdl.testspriteminimal" >>$GITHUB_OUTPUT
  605. - name: 'Copy SDL3 aar into Gradle project'
  606. run: |
  607. cp "${{ github.workspace }}/${{ needs.android.outputs.android-aar }}" "${{ steps.create-gradle-project.outputs.path }}/app/libs"
  608. echo ""
  609. echo "Project contents:"
  610. echo ""
  611. find "${{ steps.create-gradle-project.outputs.path }}"
  612. - name: 'Build app (Gradle & CMake)'
  613. run: |
  614. cd "${{ steps.create-gradle-project.outputs.path }}"
  615. ./gradlew -i assembleRelease -Pandroid.native.buildOutput=verbose -PBUILD_WITH_CMAKE=1
  616. - name: 'Build app (Gradle & ndk-build)'
  617. run: |
  618. cd "${{ steps.create-gradle-project.outputs.path }}"
  619. ./gradlew -i assembleRelease -Pandroid.native.buildOutput=verbose