release.yml 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  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. -Werror=dev \
  161. -B build_darwin
  162. cmake --build build_darwin --config Release --verbose
  163. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  164. -DTEST_FULL=FALSE \
  165. -DTEST_STATIC=FALSE \
  166. -DTEST_TEST=FALSE \
  167. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}/SDL3.xcframework/macos-arm64_x86_64" \
  168. -DCMAKE_SYSTEM_NAME=Darwin \
  169. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
  170. -Werror=dev \
  171. -B build_darwin_2
  172. cmake --build build_darwin --config Release --verbose
  173. - name: 'CMake (configure + build) iOS'
  174. run: |
  175. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  176. -DTEST_FULL=FALSE \
  177. -DTEST_STATIC=FALSE \
  178. -DTEST_TEST=FALSE \
  179. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
  180. -DCMAKE_SYSTEM_NAME=iOS \
  181. -DCMAKE_OSX_ARCHITECTURES="arm64" \
  182. -Werror=dev \
  183. -B build_ios
  184. cmake --build build_ios --config Release --verbose
  185. - name: 'CMake (configure + build) tvOS'
  186. run: |
  187. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  188. -DTEST_FULL=FALSE \
  189. -DTEST_STATIC=FALSE \
  190. -DTEST_TEST=FALSE \
  191. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
  192. -DCMAKE_SYSTEM_NAME=tvOS \
  193. -DCMAKE_OSX_ARCHITECTURES="arm64" \
  194. -Werror=dev \
  195. -B build_tvos
  196. cmake --build build_tvos --config Release --verbose
  197. - name: 'CMake (configure + build) iOS simulator'
  198. run: |
  199. sysroot=$(xcodebuild -version -sdk iphonesimulator Path)
  200. echo "sysroot=$sysroot"
  201. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  202. -DTEST_FULL=FALSE \
  203. -DTEST_STATIC=FALSE \
  204. -DTEST_TEST=FALSE \
  205. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
  206. -DCMAKE_SYSTEM_NAME=iOS \
  207. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
  208. -DCMAKE_OSX_SYSROOT="${sysroot}" \
  209. -Werror=dev \
  210. -B build_ios_simulator
  211. cmake --build build_ios_simulator --config Release --verbose
  212. - name: 'CMake (configure + build) tvOS simulator'
  213. run: |
  214. sysroot=$(xcodebuild -version -sdk appletvsimulator Path)
  215. echo "sysroot=$sysroot"
  216. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  217. -DTEST_FULL=FALSE \
  218. -DTEST_STATIC=FALSE \
  219. -DTEST_TEST=FALSE \
  220. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
  221. -DCMAKE_SYSTEM_NAME=tvOS \
  222. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
  223. -DCMAKE_OSX_SYSROOT="${sysroot}" \
  224. -Werror=dev \
  225. -B build_tvos_simulator
  226. cmake --build build_tvos_simulator --config Release --verbose
  227. msvc:
  228. needs: [src]
  229. runs-on: windows-2019
  230. outputs:
  231. VC-x86: ${{ steps.releaser.outputs.VC-x86 }}
  232. VC-x64: ${{ steps.releaser.outputs.VC-x64 }}
  233. VC-arm64: ${{ steps.releaser.outputs.VC-arm64 }}
  234. VC-devel: ${{ steps.releaser.outputs.VC-devel }}
  235. steps:
  236. - name: 'Set up Python'
  237. uses: actions/setup-python@v5
  238. with:
  239. python-version: '3.11'
  240. - name: 'Fetch build-release.py'
  241. uses: actions/checkout@v4
  242. with:
  243. sparse-checkout: 'build-scripts/build-release.py'
  244. - name: 'Download source archives'
  245. uses: actions/download-artifact@v4
  246. with:
  247. name: sources
  248. path: '${{ github.workspace }}'
  249. - name: 'Unzip ${{ needs.src.outputs.src-zip }}'
  250. id: zip
  251. run: |
  252. New-Item C:\temp -ItemType Directory -ErrorAction SilentlyContinue
  253. cd C:\temp
  254. unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
  255. echo "path=C:\temp\${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$Env:GITHUB_OUTPUT
  256. - name: 'Build MSVC binary archives'
  257. id: releaser
  258. run: |
  259. python build-scripts/build-release.py `
  260. --actions msvc `
  261. --commit ${{ inputs.commit }} `
  262. --root "${{ steps.zip.outputs.path }}" `
  263. --github `
  264. --debug
  265. - name: 'Store MSVC archives'
  266. uses: actions/upload-artifact@v4
  267. with:
  268. name: win32
  269. path: '${{ github.workspace }}/dist'
  270. msvc-verify:
  271. needs: [msvc, src]
  272. runs-on: windows-latest
  273. steps:
  274. - name: 'Fetch .github/actions/setup-ninja/action.yml'
  275. uses: actions/checkout@v4
  276. with:
  277. sparse-checkout: '.github/actions/setup-ninja/action.yml'
  278. - name: 'Download source archives'
  279. uses: actions/download-artifact@v4
  280. with:
  281. name: sources
  282. path: '${{ github.workspace }}'
  283. - name: 'Download MSVC binaries'
  284. uses: actions/download-artifact@v4
  285. with:
  286. name: win32
  287. path: '${{ github.workspace }}'
  288. - name: 'Unzip ${{ needs.src.outputs.src-zip }}'
  289. id: src
  290. run: |
  291. mkdir '${{ github.workspace }}/sources'
  292. cd '${{ github.workspace }}/sources'
  293. unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
  294. echo "path=${{ github.workspace }}/sources/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
  295. - name: 'Unzip ${{ needs.msvc.outputs.VC-devel }}'
  296. id: bin
  297. run: |
  298. mkdir '${{ github.workspace }}/vc'
  299. cd '${{ github.workspace }}/vc'
  300. unzip "${{ github.workspace }}/${{ needs.msvc.outputs.VC-devel }}"
  301. echo "path=${{ github.workspace }}/vc/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
  302. - name: Set up ninja
  303. uses: ./.github/actions/setup-ninja
  304. - name: 'Configure vcvars x86'
  305. uses: ilammy/msvc-dev-cmd@v1
  306. with:
  307. arch: x64_x86
  308. - name: 'CMake (configure + build + tests) x86'
  309. run: |
  310. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  311. -B build_x86 `
  312. -GNinja `
  313. -DCMAKE_BUILD_TYPE=Debug `
  314. -Werror=dev `
  315. -DTEST_FULL=TRUE `
  316. -DTEST_STATIC=FALSE `
  317. -DTEST_SHARED=TRUE `
  318. -DTEST_TEST=TRUE `
  319. -DCMAKE_SUPPRESS_REGENERATION=TRUE `
  320. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}"
  321. Start-Sleep -Seconds 2
  322. cmake --build build_x86 --config Release --verbose
  323. ctest --test-dir build_x86 --no-tests=error -C Release --output-on-failure
  324. - name: 'Configure vcvars x64'
  325. uses: ilammy/msvc-dev-cmd@v1
  326. with:
  327. arch: x64
  328. - name: 'CMake (configure + build + tests) x64'
  329. run: |
  330. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  331. -B build_x64 `
  332. -GNinja `
  333. -DCMAKE_BUILD_TYPE=Debug `
  334. -Werror=dev `
  335. -DTEST_FULL=TRUE `
  336. -DTEST_STATIC=FALSE `
  337. -DTEST_SHARED=TRUE `
  338. -DTEST_TEST=TRUE `
  339. -DCMAKE_SUPPRESS_REGENERATION=TRUE `
  340. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}"
  341. Start-Sleep -Seconds 2
  342. cmake --build build_x64 --config Release --verbose
  343. ctest --test-dir build_x64 --no-tests=error -C Release --output-on-failure
  344. - name: 'Configure vcvars arm64'
  345. uses: ilammy/msvc-dev-cmd@v1
  346. with:
  347. arch: x64_arm64
  348. - name: 'CMake (configure + build) arm64'
  349. run: |
  350. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  351. -B build_arm64 `
  352. -GNinja `
  353. -DCMAKE_BUILD_TYPE=Debug `
  354. -Werror=dev `
  355. -DTEST_FULL=TRUE `
  356. -DTEST_STATIC=FALSE `
  357. -DTEST_SHARED=TRUE `
  358. -DTEST_TEST=TRUE `
  359. -DCMAKE_SUPPRESS_REGENERATION=TRUE `
  360. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}"
  361. Start-Sleep -Seconds 2
  362. cmake --build build_arm64 --config Release --verbose
  363. - name: 'CMake (configure + build) arm64ec'
  364. run: |
  365. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  366. -B build_arm64ec `
  367. -GNinja `
  368. -DCMAKE_BUILD_TYPE=Debug `
  369. -Werror=dev `
  370. -DTEST_FULL=TRUE `
  371. -DTEST_STATIC=FALSE `
  372. -DTEST_SHARED=TRUE `
  373. -DTEST_TEST=TRUE `
  374. -DSDL_DISABLE_AVX=TRUE `
  375. -DSDL_DISABLE_AVX2=TRUE `
  376. -DSDL_DISABLE_AVX512F=TRUE `
  377. -DCMAKE_SUPPRESS_REGENERATION=TRUE `
  378. -DCMAKE_C_FLAGS="/arm64EC" `
  379. -DCMAKE_CXX_FLAGS="/arm64EC" `
  380. -DCMAKE_EXE_LINKER_FLAGS="/MACHINE:ARM64EC" `
  381. -DCMAKE_SHARED_LINKER_FLAGS="/MACHINE:ARM64EC" `
  382. -DCMAKE_STATIC_LINKER_FLAGS="/MACHINE:ARM64EC" `
  383. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}"
  384. Start-Sleep -Seconds 2
  385. cmake --build build_arm64ec --config Release --verbose
  386. mingw:
  387. needs: [src]
  388. runs-on: ubuntu-24.04 # FIXME: current ubuntu-latest ships an outdated mingw, replace with ubuntu-latest once 24.04 becomes the new default
  389. outputs:
  390. mingw-devel-tar-gz: ${{ steps.releaser.outputs.mingw-devel-tar-gz }}
  391. mingw-devel-tar-xz: ${{ steps.releaser.outputs.mingw-devel-tar-xz }}
  392. steps:
  393. - name: 'Set up Python'
  394. uses: actions/setup-python@v5
  395. with:
  396. python-version: '3.11'
  397. - name: 'Fetch build-release.py'
  398. uses: actions/checkout@v4
  399. with:
  400. sparse-checkout: 'build-scripts/build-release.py'
  401. - name: 'Install Mingw toolchain'
  402. run: |
  403. sudo apt-get update -y
  404. sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
  405. - name: 'Download source archives'
  406. uses: actions/download-artifact@v4
  407. with:
  408. name: sources
  409. path: '${{ github.workspace }}'
  410. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  411. id: tar
  412. run: |
  413. mkdir -p /tmp/tardir
  414. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  415. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  416. - name: 'Build MinGW binary archives'
  417. id: releaser
  418. run: |
  419. python build-scripts/build-release.py \
  420. --actions mingw \
  421. --commit ${{ inputs.commit }} \
  422. --root "${{ steps.tar.outputs.path }}" \
  423. --github \
  424. --debug
  425. - name: 'Store MinGW archives'
  426. uses: actions/upload-artifact@v4
  427. with:
  428. name: mingw
  429. path: '${{ github.workspace }}/dist'
  430. mingw-verify:
  431. needs: [mingw, src]
  432. runs-on: ubuntu-latest
  433. steps:
  434. - name: 'Install Mingw toolchain'
  435. run: |
  436. sudo apt-get update -y
  437. sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
  438. - name: 'Download source archives'
  439. uses: actions/download-artifact@v4
  440. with:
  441. name: sources
  442. path: '${{ github.workspace }}'
  443. - name: 'Download MinGW binaries'
  444. uses: actions/download-artifact@v4
  445. with:
  446. name: mingw
  447. path: '${{ github.workspace }}'
  448. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  449. id: src
  450. run: |
  451. mkdir -p /tmp/tardir
  452. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  453. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  454. - name: 'Untar ${{ needs.mingw.outputs.mingw-devel-tar-gz }}'
  455. id: bin
  456. run: |
  457. mkdir -p /tmp/mingw-tardir
  458. tar -C /tmp/mingw-tardir -v -x -f "${{ github.workspace }}/${{ needs.mingw.outputs.mingw-devel-tar-gz }}"
  459. echo "path=/tmp/mingw-tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  460. - name: 'CMake (configure + build) i686'
  461. run: |
  462. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  463. -DCMAKE_BUILD_TYPE="Release" \
  464. -DTEST_FULL=TRUE \
  465. -DTEST_STATIC=TRUE \
  466. -DTEST_TEST=TRUE \
  467. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" \
  468. -DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-i686.cmake" \
  469. -DCMAKE_C_FLAGS="-DSDL_DISABLE_SSE4_2" \
  470. -Werror=dev \
  471. -B build_x86
  472. cmake --build build_x86 --config Release --verbose
  473. - name: 'CMake (configure + build) x86_64'
  474. run: |
  475. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  476. -DCMAKE_BUILD_TYPE="Release" \
  477. -DTEST_FULL=TRUE \
  478. -DTEST_STATIC=TRUE \
  479. -DTEST_TEST=TRUE \
  480. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" \
  481. -DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-x86_64.cmake" \
  482. -DCMAKE_C_FLAGS="-DSDL_DISABLE_SSE4_2" \
  483. -Werror=dev \
  484. -B build_x64
  485. cmake --build build_x64 --config Release --verbose
  486. android:
  487. needs: [src]
  488. runs-on: ubuntu-latest
  489. outputs:
  490. android-aar: ${{ steps.releaser.outputs.android-aar }}
  491. steps:
  492. - name: 'Set up Python'
  493. uses: actions/setup-python@v5
  494. with:
  495. python-version: '3.11'
  496. - name: 'Fetch build-release.py'
  497. uses: actions/checkout@v4
  498. with:
  499. sparse-checkout: 'build-scripts/build-release.py'
  500. - name: 'Setup Android NDK'
  501. uses: nttld/setup-ndk@v1
  502. with:
  503. local-cache: true
  504. ndk-version: r21e
  505. - name: 'Setup Java JDK'
  506. uses: actions/setup-java@v4
  507. with:
  508. distribution: 'temurin'
  509. java-version: '11'
  510. - name: 'Install ninja'
  511. run: |
  512. sudo apt-get update -y
  513. sudo apt-get install -y ninja-build
  514. - name: 'Download source archives'
  515. uses: actions/download-artifact@v4
  516. with:
  517. name: sources
  518. path: '${{ github.workspace }}'
  519. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  520. id: tar
  521. run: |
  522. mkdir -p /tmp/tardir
  523. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  524. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  525. - name: 'Build Android prefab binary archive(s)'
  526. id: releaser
  527. run: |
  528. python build-scripts/build-release.py \
  529. --actions android \
  530. --commit ${{ inputs.commit }} \
  531. --root "${{ steps.tar.outputs.path }}" \
  532. --github \
  533. --debug
  534. - name: 'Store Android archive(s)'
  535. uses: actions/upload-artifact@v4
  536. with:
  537. name: android
  538. path: '${{ github.workspace }}/dist'
  539. android-verify:
  540. needs: [android, src]
  541. runs-on: ubuntu-latest
  542. steps:
  543. - name: 'Set up Python'
  544. uses: actions/setup-python@v5
  545. with:
  546. python-version: '3.11'
  547. - uses: actions/setup-java@v4
  548. with:
  549. distribution: 'temurin'
  550. java-version: '17'
  551. - name: 'Download source archives'
  552. uses: actions/download-artifact@v4
  553. with:
  554. name: sources
  555. path: '${{ github.workspace }}'
  556. - name: 'Download Android .aar archive'
  557. uses: actions/download-artifact@v4
  558. with:
  559. name: android
  560. path: '${{ github.workspace }}'
  561. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  562. id: src
  563. run: |
  564. mkdir -p /tmp/tardir
  565. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  566. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  567. - name: 'Extract Android SDK from AAR'
  568. id: sdk
  569. run: |
  570. python "${{ github.workspace }}/${{ needs.android.outputs.android-aar }}" -o /tmp/SDL3-android
  571. echo "prefix=/tmp/SDL3-android" >>$GITHUB_OUTPUT
  572. - name: 'CMake (configure + build) x86, x64, arm32, arm64'
  573. run: |
  574. android_abis="x86 x86_64 armeabi-v7a arm64-v8a"
  575. for android_abi in ${android_abis}; do
  576. echo "Configuring ${android_abi}..."
  577. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  578. -DTEST_FULL=TRUE \
  579. -DTEST_STATIC=FALSE \
  580. -DTEST_TEST=TRUE \
  581. -DCMAKE_PREFIX_PATH="${{ steps.sdk.outputs.prefix }}" \
  582. -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
  583. -DANDROID_ABI=${android_abi} \
  584. -Werror=dev \
  585. -DCMAKE_BUILD_TYPE=Release \
  586. -B "${android_abi}"
  587. echo "Building ${android_abi}..."
  588. cmake --build "${android_abi}" --config Release --verbose
  589. done
  590. - name: 'Create gradle project'
  591. id: create-gradle-project
  592. run: |
  593. python ${{ steps.src.outputs.path }}/build-scripts/create-android-project.py \
  594. org.libsdl.testspriteminimal \
  595. ${{ steps.src.outputs.path }}/test/testspriteminimal.c \
  596. ${{ steps.src.outputs.path }}/test/icon.h \
  597. --variant aar \
  598. --output "/tmp/projects"
  599. echo "path=/tmp/projects/org.libsdl.testspriteminimal" >>$GITHUB_OUTPUT
  600. - name: 'Copy SDL3 aar into Gradle project'
  601. run: |
  602. cp "${{ github.workspace }}/${{ needs.android.outputs.android-aar }}" "${{ steps.create-gradle-project.outputs.path }}/app/libs"
  603. echo ""
  604. echo "Project contents:"
  605. echo ""
  606. find "${{ steps.create-gradle-project.outputs.path }}"
  607. - name: 'Build app (Gradle & CMake)'
  608. run: |
  609. cd "${{ steps.create-gradle-project.outputs.path }}"
  610. ./gradlew -i assembleRelease -Pandroid.native.buildOutput=verbose -PBUILD_WITH_CMAKE=1
  611. - name: 'Build app (Gradle & ndk-build)'
  612. run: |
  613. cd "${{ steps.create-gradle-project.outputs.path }}"
  614. ./gradlew -i assembleRelease -Pandroid.native.buildOutput=verbose