release.yml 35 KB

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