release.yml 18 KB

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