release.yml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  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 + examples)'
  78. run: |
  79. cmake -S ${{ steps.tar.outputs.path }} -B /tmp/build -DSDL_TEST_LIBRARY=TRUE -DSDL_TESTS=TRUE -DSDL_EXAMPLES=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: 'Fetch .github/actions/setup-ninja/action.yml'
  277. uses: actions/checkout@v4
  278. with:
  279. sparse-checkout: '.github/actions/setup-ninja/action.yml'
  280. - name: 'Download source archives'
  281. uses: actions/download-artifact@v4
  282. with:
  283. name: sources
  284. path: '${{ github.workspace }}'
  285. - name: 'Download MSVC binaries'
  286. uses: actions/download-artifact@v4
  287. with:
  288. name: win32
  289. path: '${{ github.workspace }}'
  290. - name: 'Unzip ${{ needs.src.outputs.src-zip }}'
  291. id: src
  292. run: |
  293. mkdir '${{ github.workspace }}/sources'
  294. cd '${{ github.workspace }}/sources'
  295. unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
  296. echo "path=${{ github.workspace }}/sources/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
  297. - name: 'Unzip ${{ needs.msvc.outputs.VC-devel }}'
  298. id: bin
  299. run: |
  300. mkdir '${{ github.workspace }}/vc'
  301. cd '${{ github.workspace }}/vc'
  302. unzip "${{ github.workspace }}/${{ needs.msvc.outputs.VC-devel }}"
  303. echo "path=${{ github.workspace }}/vc/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
  304. - name: Set up ninja
  305. uses: ./.github/actions/setup-ninja
  306. - name: 'Configure vcvars x86'
  307. uses: ilammy/msvc-dev-cmd@v1
  308. with:
  309. arch: x64_x86
  310. - name: 'CMake (configure + build + tests) x86'
  311. run: |
  312. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  313. -B build_x86 `
  314. -GNinja `
  315. -DCMAKE_BUILD_TYPE=Debug `
  316. -Werror=dev `
  317. -DTEST_FULL=TRUE `
  318. -DTEST_STATIC=FALSE `
  319. -DTEST_SHARED=TRUE `
  320. -DTEST_TEST=TRUE `
  321. -DCMAKE_SUPPRESS_REGENERATION=TRUE `
  322. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}"
  323. Start-Sleep -Seconds 2
  324. cmake --build build_x86 --config Release --verbose
  325. ctest --test-dir build_x86 --no-tests=error -C Release --output-on-failure
  326. - name: 'Configure vcvars x64'
  327. uses: ilammy/msvc-dev-cmd@v1
  328. with:
  329. arch: x64
  330. - name: 'CMake (configure + build + tests) x64'
  331. run: |
  332. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  333. -B build_x64 `
  334. -GNinja `
  335. -DCMAKE_BUILD_TYPE=Debug `
  336. -Werror=dev `
  337. -DTEST_FULL=TRUE `
  338. -DTEST_STATIC=FALSE `
  339. -DTEST_SHARED=TRUE `
  340. -DTEST_TEST=TRUE `
  341. -DCMAKE_SUPPRESS_REGENERATION=TRUE `
  342. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}"
  343. Start-Sleep -Seconds 2
  344. cmake --build build_x64 --config Release --verbose
  345. ctest --test-dir build_x64 --no-tests=error -C Release --output-on-failure
  346. - name: 'Configure vcvars arm64'
  347. uses: ilammy/msvc-dev-cmd@v1
  348. with:
  349. arch: x64_arm64
  350. - name: 'CMake (configure + build) arm64'
  351. run: |
  352. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  353. -B build_arm64 `
  354. -GNinja `
  355. -DCMAKE_BUILD_TYPE=Debug `
  356. -Werror=dev `
  357. -DTEST_FULL=TRUE `
  358. -DTEST_STATIC=FALSE `
  359. -DTEST_SHARED=TRUE `
  360. -DTEST_TEST=TRUE `
  361. -DCMAKE_SUPPRESS_REGENERATION=TRUE `
  362. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}"
  363. Start-Sleep -Seconds 2
  364. cmake --build build_arm64 --config Release --verbose
  365. - name: 'CMake (configure + build) arm64ec'
  366. run: |
  367. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  368. -B build_arm64ec `
  369. -GNinja `
  370. -DCMAKE_BUILD_TYPE=Debug `
  371. -Werror=dev `
  372. -DTEST_FULL=TRUE `
  373. -DTEST_STATIC=FALSE `
  374. -DTEST_SHARED=TRUE `
  375. -DTEST_TEST=TRUE `
  376. -DSDL_DISABLE_AVX=TRUE `
  377. -DSDL_DISABLE_AVX2=TRUE `
  378. -DSDL_DISABLE_AVX512F=TRUE `
  379. -DCMAKE_SUPPRESS_REGENERATION=TRUE `
  380. -DCMAKE_C_FLAGS="/arm64EC" `
  381. -DCMAKE_CXX_FLAGS="/arm64EC" `
  382. -DCMAKE_EXE_LINKER_FLAGS="/MACHINE:ARM64EC" `
  383. -DCMAKE_SHARED_LINKER_FLAGS="/MACHINE:ARM64EC" `
  384. -DCMAKE_STATIC_LINKER_FLAGS="/MACHINE:ARM64EC" `
  385. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}"
  386. Start-Sleep -Seconds 2
  387. cmake --build build_arm64ec --config Release --verbose
  388. mingw:
  389. needs: [src]
  390. runs-on: ubuntu-24.04 # FIXME: current ubuntu-latest ships an outdated mingw, replace with ubuntu-latest once 24.04 becomes the new default
  391. outputs:
  392. mingw-devel-tar-gz: ${{ steps.releaser.outputs.mingw-devel-tar-gz }}
  393. mingw-devel-tar-xz: ${{ steps.releaser.outputs.mingw-devel-tar-xz }}
  394. steps:
  395. - name: 'Set up Python'
  396. uses: actions/setup-python@v5
  397. with:
  398. python-version: '3.10'
  399. - name: 'Fetch build-release.py'
  400. uses: actions/checkout@v4
  401. with:
  402. sparse-checkout: 'build-scripts/build-release.py'
  403. - name: 'Install Mingw toolchain'
  404. run: |
  405. sudo apt-get update -y
  406. sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
  407. - name: 'Download source archives'
  408. uses: actions/download-artifact@v4
  409. with:
  410. name: sources
  411. path: '${{ github.workspace }}'
  412. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  413. id: tar
  414. run: |
  415. mkdir -p /tmp/tardir
  416. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  417. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  418. - name: 'Build MinGW binary archives'
  419. id: releaser
  420. run: |
  421. python build-scripts/build-release.py \
  422. --create mingw \
  423. --commit ${{ inputs.commit }} \
  424. --project SDL3 \
  425. --root "${{ steps.tar.outputs.path }}" \
  426. --github \
  427. --debug
  428. - name: 'Store MinGW archives'
  429. uses: actions/upload-artifact@v4
  430. with:
  431. name: mingw
  432. path: '${{ github.workspace }}/dist'
  433. mingw-verify:
  434. needs: [mingw, src]
  435. runs-on: ubuntu-latest
  436. steps:
  437. - name: 'Install Mingw toolchain'
  438. run: |
  439. sudo apt-get update -y
  440. sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
  441. - name: 'Download source archives'
  442. uses: actions/download-artifact@v4
  443. with:
  444. name: sources
  445. path: '${{ github.workspace }}'
  446. - name: 'Download MinGW binaries'
  447. uses: actions/download-artifact@v4
  448. with:
  449. name: mingw
  450. path: '${{ github.workspace }}'
  451. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  452. id: src
  453. run: |
  454. mkdir -p /tmp/tardir
  455. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  456. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  457. - name: 'Untar ${{ needs.mingw.outputs.mingw-devel-tar-gz }}'
  458. id: bin
  459. run: |
  460. mkdir -p /tmp/mingw-tardir
  461. tar -C /tmp/mingw-tardir -v -x -f "${{ github.workspace }}/${{ needs.mingw.outputs.mingw-devel-tar-gz }}"
  462. echo "path=/tmp/mingw-tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  463. - name: 'CMake (configure + build) i686'
  464. run: |
  465. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  466. -DCMAKE_BUILD_TYPE="Release" \
  467. -DTEST_FULL=TRUE \
  468. -DTEST_STATIC=TRUE \
  469. -DTEST_TEST=TRUE \
  470. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" \
  471. -DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-i686.cmake" \
  472. -DCMAKE_C_FLAGS="-DSDL_DISABLE_SSE4_2" \
  473. -Werror=dev \
  474. -B build_x86
  475. cmake --build build_x86 --config Release --verbose
  476. - name: 'CMake (configure + build) x86_64'
  477. run: |
  478. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  479. -DCMAKE_BUILD_TYPE="Release" \
  480. -DTEST_FULL=TRUE \
  481. -DTEST_STATIC=TRUE \
  482. -DTEST_TEST=TRUE \
  483. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" \
  484. -DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-x86_64.cmake" \
  485. -DCMAKE_C_FLAGS="-DSDL_DISABLE_SSE4_2" \
  486. -Werror=dev \
  487. -B build_x64
  488. cmake --build build_x64 --config Release --verbose
  489. android:
  490. needs: [src]
  491. runs-on: ubuntu-latest
  492. outputs:
  493. android-aar: ${{ steps.releaser.outputs.android-aar }}
  494. steps:
  495. - name: 'Set up Python'
  496. uses: actions/setup-python@v5
  497. with:
  498. python-version: '3.10'
  499. - name: 'Fetch build-release.py'
  500. uses: actions/checkout@v4
  501. with:
  502. sparse-checkout: 'build-scripts/build-release.py'
  503. - name: 'Setup Android NDK'
  504. uses: nttld/setup-ndk@v1
  505. with:
  506. local-cache: true
  507. ndk-version: r21e
  508. - name: 'Setup Java JDK'
  509. uses: actions/setup-java@v4
  510. with:
  511. distribution: 'temurin'
  512. java-version: '11'
  513. - name: 'Install ninja'
  514. run: |
  515. sudo apt-get update -y
  516. sudo apt-get install -y ninja-build
  517. - name: 'Download source archives'
  518. uses: actions/download-artifact@v4
  519. with:
  520. name: sources
  521. path: '${{ github.workspace }}'
  522. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  523. id: tar
  524. run: |
  525. mkdir -p /tmp/tardir
  526. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  527. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  528. - name: 'Build Android prefab binary archive(s)'
  529. id: releaser
  530. run: |
  531. python build-scripts/build-release.py \
  532. --create android \
  533. --commit ${{ inputs.commit }} \
  534. --project SDL3 \
  535. --root "${{ steps.tar.outputs.path }}" \
  536. --github \
  537. --debug
  538. - name: 'Store Android archive(s)'
  539. uses: actions/upload-artifact@v4
  540. with:
  541. name: android
  542. path: '${{ github.workspace }}/dist'
  543. android-verify:
  544. needs: [android, src]
  545. runs-on: ubuntu-latest
  546. steps:
  547. - name: 'Set up Python'
  548. uses: actions/setup-python@v5
  549. with:
  550. python-version: '3.10'
  551. - uses: actions/setup-java@v4
  552. with:
  553. distribution: 'temurin'
  554. java-version: '17'
  555. - name: 'Download source archives'
  556. uses: actions/download-artifact@v4
  557. with:
  558. name: sources
  559. path: '${{ github.workspace }}'
  560. - name: 'Download Android .aar archive'
  561. uses: actions/download-artifact@v4
  562. with:
  563. name: android
  564. path: '${{ github.workspace }}'
  565. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  566. id: src
  567. run: |
  568. mkdir -p /tmp/tardir
  569. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  570. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  571. - name: 'Create gradle project'
  572. id: create-gradle-project
  573. run: |
  574. python ${{ steps.src.outputs.path }}/build-scripts/create-android-project.py \
  575. org.libsdl.testspriteminimal \
  576. ${{ steps.src.outputs.path }}/test/testspriteminimal.c \
  577. ${{ steps.src.outputs.path }}/test/icon.h \
  578. --variant aar \
  579. --output "/tmp/projects"
  580. echo "path=/tmp/projects/org.libsdl.testspriteminimal" >>$GITHUB_OUTPUT
  581. echo ""
  582. echo "Project contents:"
  583. echo ""
  584. find "/tmp/projects/org.libsdl.testspriteminimal"
  585. - name: 'Copy SDL3 aar into Gradle project'
  586. run: |
  587. cp "${{ github.workspace }}/${{ needs.android.outputs.android-aar }}" "${{ steps.create-gradle-project.outputs.path }}/app/libs"
  588. echo ""
  589. echo "Project contents:"
  590. echo ""
  591. find "${{ steps.create-gradle-project.outputs.path }}"
  592. - name: 'Build app (Gradle & ndk-build)'
  593. run: |
  594. cd "${{ steps.create-gradle-project.outputs.path }}"
  595. ./gradlew -i assembleRelease -PBUILD_WITH_CMAKE=1
  596. - name: 'Build app (Gradle & CMake)'
  597. run: |
  598. cd "${{ steps.create-gradle-project.outputs.path }}"
  599. ./gradlew -i assembleRelease
  600. - name: 'Extract Android SDK from AAR'
  601. id: sdk
  602. run: |
  603. python "${{ github.workspace }}/${{ needs.android.outputs.android-aar }}" -o /tmp/SDL3-android
  604. echo "prefix=/tmp/SDL3-android" >>$GITHUB_OUTPUT
  605. - name: 'CMake (configure + build) x86, x64, arm32, arm64'
  606. run: |
  607. android_abis="x86 x86_64 armeabi-v7a arm64-v8a"
  608. for android_abi in ${android_abis}; do
  609. echo "Configuring ${android_abi}..."
  610. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  611. -DTEST_FULL=TRUE \
  612. -DTEST_STATIC=FALSE \
  613. -DTEST_TEST=TRUE \
  614. -DCMAKE_PREFIX_PATH="${{ steps.sdk.outputs.prefix }}" \
  615. -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
  616. -DANDROID_ABI=${android_abi} \
  617. -Werror=dev \
  618. -DCMAKE_BUILD_TYPE=Release \
  619. -B "${android_abi}"
  620. echo "Building ${android_abi}..."
  621. cmake --build "${android_abi}" --config Release --verbose
  622. done