release.yml 36 KB

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