release.yml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. name: 'release'
  2. run-name: 'Create SDL release artifacts for ${{ inputs.commit }}'
  3. on:
  4. workflow_dispatch:
  5. inputs:
  6. commit:
  7. description: 'Commit of SDL'
  8. required: true
  9. jobs:
  10. src:
  11. runs-on: ubuntu-latest
  12. outputs:
  13. project: ${{ steps.releaser.outputs.project }}
  14. version: ${{ steps.releaser.outputs.version }}
  15. src-tar-gz: ${{ steps.releaser.outputs.src-tar-gz }}
  16. src-tar-xz: ${{ steps.releaser.outputs.src-tar-xz }}
  17. src-zip: ${{ steps.releaser.outputs.src-zip }}
  18. steps:
  19. - name: 'Set up Python'
  20. uses: actions/setup-python@v5
  21. with:
  22. python-version: '3.11'
  23. - name: 'Fetch build-release.py'
  24. uses: actions/checkout@v4
  25. with:
  26. sparse-checkout: 'build-scripts/build-release.py'
  27. - name: 'Set up SDL sources'
  28. uses: actions/checkout@v4
  29. with:
  30. path: 'SDL'
  31. fetch-depth: 0
  32. - name: 'Build Source archive'
  33. id: releaser
  34. shell: bash
  35. run: |
  36. python build-scripts/build-release.py \
  37. --create source \
  38. --commit ${{ inputs.commit }} \
  39. --project SDL2 \
  40. --root "${{ github.workspace }}/SDL" \
  41. --github \
  42. --debug
  43. - name: 'Store source archives'
  44. uses: actions/upload-artifact@v4
  45. with:
  46. name: sources
  47. path: '${{ github.workspace}}/dist'
  48. linux-verify:
  49. needs: [src]
  50. runs-on: ubuntu-latest
  51. steps:
  52. - name: 'Download source archives'
  53. uses: actions/download-artifact@v4
  54. with:
  55. name: sources
  56. path: '${{ github.workspace }}'
  57. - name: 'Unzip ${{ needs.src.outputs.src-zip }}'
  58. id: zip
  59. run: |
  60. mkdir /tmp/zipdir
  61. cd /tmp/zipdir
  62. unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
  63. echo "path=/tmp/zipdir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  64. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  65. id: tar
  66. run: |
  67. mkdir -p /tmp/tardir
  68. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  69. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  70. - name: 'Compare contents of ${{ needs.src.outputs.src-zip }} and ${{ needs.src.outputs.src-tar-gz }}'
  71. run: |
  72. diff /tmp/zipdir /tmp/tardir
  73. - name: 'Test versioning'
  74. shell: bash
  75. run: |
  76. ${{ steps.tar.outputs.path }}/build-scripts/test-versioning.sh
  77. - name: 'CMake (configure + build + tests + examples)'
  78. run: |
  79. cmake -S ${{ steps.tar.outputs.path }} -B /tmp/build -DSDL_TEST_LIBRARY=TRUE -DSDL_TESTS=TRUE -DSDL_EXAMPLES=TRUE
  80. cmake --build /tmp/build --verbose
  81. ctest --test-dir /tmp/build --no-tests=error --output-on-failure
  82. dmg:
  83. needs: [src]
  84. runs-on: macos-latest
  85. outputs:
  86. dmg: ${{ steps.releaser.outputs.dmg }}
  87. steps:
  88. - name: 'Set up Python'
  89. uses: actions/setup-python@v5
  90. with:
  91. python-version: '3.10'
  92. - name: 'Fetch build-release.py'
  93. uses: actions/checkout@v4
  94. with:
  95. sparse-checkout: 'build-scripts/build-release.py'
  96. - name: 'Download source archives'
  97. uses: actions/download-artifact@v4
  98. with:
  99. name: sources
  100. path: '${{ github.workspace }}'
  101. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  102. id: tar
  103. run: |
  104. mkdir -p "${{ github.workspace }}/tardir"
  105. tar -C "${{ github.workspace }}/tardir" -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  106. echo "path=${{ github.workspace }}/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  107. - name: 'Build SDL2.dmg'
  108. id: releaser
  109. shell: bash
  110. run: |
  111. python build-scripts/build-release.py \
  112. --create framework \
  113. --commit ${{ inputs.commit }} \
  114. --project SDL2 \
  115. --root "${{ steps.tar.outputs.path }}" \
  116. --github \
  117. --debug
  118. - name: 'Store DMG image file'
  119. uses: actions/upload-artifact@v4
  120. with:
  121. name: dmg
  122. path: '${{ github.workspace }}/dist'
  123. dmg-verify:
  124. needs: [dmg, src]
  125. runs-on: macos-latest
  126. steps:
  127. - name: 'Download source archives'
  128. uses: actions/download-artifact@v4
  129. with:
  130. name: sources
  131. path: '${{ github.workspace }}'
  132. - name: 'Download ${{ needs.dmg.outputs.dmg }}'
  133. uses: actions/download-artifact@v4
  134. with:
  135. name: dmg
  136. path: '${{ github.workspace }}'
  137. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  138. id: src
  139. run: |
  140. mkdir -p /tmp/tardir
  141. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  142. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  143. - name: 'Mount ${{ needs.dmg.outputs.dmg }}'
  144. id: mount
  145. run: |
  146. hdiutil attach '${{ github.workspace }}/${{ needs.dmg.outputs.dmg }}'
  147. mount_point="/Volumes/${{ needs.src.outputs.project }}"
  148. if [ ! -d "$mount_point/${{ needs.src.outputs.project }}.framework" ]; then
  149. echo "Cannot find ${{ needs.src.outputs.project }}.framework!"
  150. exit 1
  151. fi
  152. echo "mount_point=$mount_point">>$GITHUB_OUTPUT
  153. - name: 'CMake (configure + build) Darwin'
  154. run: |
  155. set -e
  156. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  157. -DTEST_FULL=FALSE \
  158. -DTEST_STATIC=FALSE \
  159. -DTEST_TEST=FALSE \
  160. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
  161. -DCMAKE_SYSTEM_NAME=Darwin \
  162. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
  163. -Werror=dev \
  164. -B build_darwin
  165. cmake --build build_darwin --config Release --verbose
  166. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  167. -DTEST_FULL=FALSE \
  168. -DTEST_STATIC=FALSE \
  169. -DTEST_TEST=FALSE \
  170. -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
  171. -DCMAKE_SYSTEM_NAME=Darwin \
  172. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
  173. -Werror=dev \
  174. -B build_darwin_2
  175. cmake --build build_darwin --config Release --verbose
  176. msvc:
  177. needs: [src]
  178. runs-on: windows-2019
  179. outputs:
  180. VC-x86: ${{ steps.releaser.outputs.VC-x86 }}
  181. VC-x64: ${{ steps.releaser.outputs.VC-x64 }}
  182. VC-devel: ${{ steps.releaser.outputs.VC-devel }}
  183. steps:
  184. - name: 'Set up Python'
  185. uses: actions/setup-python@v5
  186. with:
  187. python-version: '3.10'
  188. - name: 'Fetch build-release.py'
  189. uses: actions/checkout@v4
  190. with:
  191. sparse-checkout: 'build-scripts/build-release.py'
  192. - name: 'Download source archives'
  193. uses: actions/download-artifact@v4
  194. with:
  195. name: sources
  196. path: '${{ github.workspace }}'
  197. - name: 'Unzip ${{ needs.src.outputs.src-zip }}'
  198. id: zip
  199. run: |
  200. New-Item C:\temp -ItemType Directory -ErrorAction SilentlyContinue
  201. cd C:\temp
  202. unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
  203. echo "path=C:\temp\${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$Env:GITHUB_OUTPUT
  204. - name: 'Build MSVC binary archives'
  205. id: releaser
  206. run: |
  207. python build-scripts/build-release.py `
  208. --create win32 `
  209. --commit ${{ inputs.commit }} `
  210. --project SDL2 `
  211. --root "${{ steps.zip.outputs.path }}" `
  212. --github `
  213. --debug
  214. - name: 'Store MSVC archives'
  215. uses: actions/upload-artifact@v4
  216. with:
  217. name: win32
  218. path: '${{ github.workspace }}/dist'
  219. msvc-verify:
  220. needs: [msvc, src]
  221. runs-on: windows-latest
  222. steps:
  223. - name: 'Fetch .github/actions/setup-ninja/action.yml'
  224. uses: actions/checkout@v4
  225. with:
  226. sparse-checkout: '.github/actions/setup-ninja/action.yml'
  227. - name: 'Download source archives'
  228. uses: actions/download-artifact@v4
  229. with:
  230. name: sources
  231. path: '${{ github.workspace }}'
  232. - name: 'Download MSVC binaries'
  233. uses: actions/download-artifact@v4
  234. with:
  235. name: win32
  236. path: '${{ github.workspace }}'
  237. - name: 'Unzip ${{ needs.src.outputs.src-zip }}'
  238. id: src
  239. run: |
  240. mkdir '${{ github.workspace }}/sources'
  241. cd '${{ github.workspace }}/sources'
  242. unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
  243. echo "path=${{ github.workspace }}/sources/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
  244. - name: 'Unzip ${{ needs.msvc.outputs.VC-devel }}'
  245. id: bin
  246. run: |
  247. mkdir '${{ github.workspace }}/vc'
  248. cd '${{ github.workspace }}/vc'
  249. unzip "${{ github.workspace }}/${{ needs.msvc.outputs.VC-devel }}"
  250. echo "path=${{ github.workspace }}/vc/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
  251. - name: Set up ninja
  252. uses: ./.github/actions/setup-ninja
  253. - name: 'Configure vcvars x86'
  254. uses: ilammy/msvc-dev-cmd@v1
  255. with:
  256. arch: x64_x86
  257. - name: 'CMake (configure + build + tests) x86'
  258. run: |
  259. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  260. -B build_x86 `
  261. -GNinja `
  262. -DCMAKE_BUILD_TYPE=Debug `
  263. -Werror=dev `
  264. -DTEST_FULL=FALSE `
  265. -DTEST_STATIC=FALSE `
  266. -DTEST_SHARED=TRUE `
  267. -DTEST_TEST=TRUE `
  268. -DCMAKE_SUPPRESS_REGENERATION=TRUE `
  269. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}"
  270. Start-Sleep -Seconds 2
  271. cmake --build build_x86 --config Release --verbose
  272. #ctest --test-dir build_x86 --no-tests=error -C Release --output-on-failure
  273. - name: 'Configure vcvars x64'
  274. uses: ilammy/msvc-dev-cmd@v1
  275. with:
  276. arch: x64
  277. - name: 'CMake (configure + build + tests) x64'
  278. run: |
  279. cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
  280. -B build_x64 `
  281. -GNinja `
  282. -DCMAKE_BUILD_TYPE=Debug `
  283. -Werror=dev `
  284. -DTEST_FULL=FALSE `
  285. -DTEST_STATIC=FALSE `
  286. -DTEST_SHARED=TRUE `
  287. -DTEST_TEST=TRUE `
  288. -DCMAKE_SUPPRESS_REGENERATION=TRUE `
  289. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}"
  290. Start-Sleep -Seconds 2
  291. cmake --build build_x64 --config Release --verbose
  292. #ctest --test-dir build_x64 --no-tests=error -C Release --output-on-failure
  293. mingw:
  294. needs: [src]
  295. runs-on: ubuntu-24.04 # FIXME: current ubuntu-latest ships an outdated mingw, replace with ubuntu-latest once 24.04 becomes the new default
  296. outputs:
  297. mingw-devel-tar-gz: ${{ steps.releaser.outputs.mingw-devel-tar-gz }}
  298. mingw-devel-tar-xz: ${{ steps.releaser.outputs.mingw-devel-tar-xz }}
  299. steps:
  300. - name: 'Set up Python'
  301. uses: actions/setup-python@v5
  302. with:
  303. python-version: '3.10'
  304. - name: 'Fetch build-release.py'
  305. uses: actions/checkout@v4
  306. with:
  307. sparse-checkout: 'build-scripts/build-release.py'
  308. - name: 'Install Mingw toolchain'
  309. run: |
  310. sudo apt-get update -y
  311. sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
  312. - name: 'Download source archives'
  313. uses: actions/download-artifact@v4
  314. with:
  315. name: sources
  316. path: '${{ github.workspace }}'
  317. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  318. id: tar
  319. run: |
  320. mkdir -p /tmp/tardir
  321. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  322. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  323. - name: 'Build MinGW binary archives'
  324. id: releaser
  325. run: |
  326. python build-scripts/build-release.py \
  327. --create mingw \
  328. --commit ${{ inputs.commit }} \
  329. --project SDL2 \
  330. --root "${{ steps.tar.outputs.path }}" \
  331. --github \
  332. --debug
  333. - name: 'Store MinGW archives'
  334. uses: actions/upload-artifact@v4
  335. with:
  336. name: mingw
  337. path: '${{ github.workspace }}/dist'
  338. mingw-verify:
  339. needs: [mingw, src]
  340. runs-on: ubuntu-latest
  341. steps:
  342. - name: 'Install Mingw toolchain'
  343. run: |
  344. sudo apt-get update -y
  345. sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
  346. - name: 'Download source archives'
  347. uses: actions/download-artifact@v4
  348. with:
  349. name: sources
  350. path: '${{ github.workspace }}'
  351. - name: 'Download MinGW binaries'
  352. uses: actions/download-artifact@v4
  353. with:
  354. name: mingw
  355. path: '${{ github.workspace }}'
  356. - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
  357. id: src
  358. run: |
  359. mkdir -p /tmp/tardir
  360. tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
  361. echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  362. - name: 'Untar ${{ needs.mingw.outputs.mingw-devel-tar-gz }}'
  363. id: bin
  364. run: |
  365. mkdir -p /tmp/mingw-tardir
  366. tar -C /tmp/mingw-tardir -v -x -f "${{ github.workspace }}/${{ needs.mingw.outputs.mingw-devel-tar-gz }}"
  367. echo "path=/tmp/mingw-tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
  368. - name: 'CMake (configure + build) i686'
  369. run: |
  370. set -e
  371. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  372. -DCMAKE_BUILD_TYPE="Release" \
  373. -DTEST_FULL=FALSE \
  374. -DTEST_STATIC=TRUE \
  375. -DTEST_TEST=TRUE \
  376. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" \
  377. -DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-i686.cmake" \
  378. -DCMAKE_C_FLAGS="-DSDL_DISABLE_SSE4_2" \
  379. -Werror=dev \
  380. -B build_x86
  381. cmake --build build_x86 --config Release --verbose
  382. - name: 'CMake (configure + build) x86_64'
  383. run: |
  384. set -e
  385. cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
  386. -DCMAKE_BUILD_TYPE="Release" \
  387. -DTEST_FULL=FALSE \
  388. -DTEST_STATIC=TRUE \
  389. -DTEST_TEST=TRUE \
  390. -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" \
  391. -DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-x86_64.cmake" \
  392. -DCMAKE_C_FLAGS="-DSDL_DISABLE_SSE4_2" \
  393. -Werror=dev \
  394. -B build_x64
  395. cmake --build build_x64 --config Release --verbose