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