gen_bindings.yml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. name: Bindings
  2. on: [push, pull_request]
  3. jobs:
  4. test-windows:
  5. runs-on: windows-latest
  6. steps:
  7. - uses: actions/checkout@main
  8. - name: test_win
  9. run: |
  10. cd tests
  11. test_win.cmd
  12. shell: cmd
  13. test-mac:
  14. runs-on: macos-latest
  15. steps:
  16. - uses: actions/checkout@main
  17. - uses: seanmiddleditch/gha-setup-ninja@master
  18. - name: test_macos
  19. run: |
  20. cd tests
  21. ./test_macos.sh
  22. test-linux:
  23. runs-on: ubuntu-latest
  24. steps:
  25. - uses: actions/checkout@main
  26. - uses: seanmiddleditch/gha-setup-ninja@master
  27. - name: prepare
  28. run: |
  29. sudo apt-get update
  30. sudo apt-get install libgl1-mesa-dev libegl1-mesa-dev mesa-common-dev xorg-dev libasound-dev
  31. - name: test_linux
  32. run: |
  33. cd tests
  34. ./test_linux.sh
  35. gen-bindings:
  36. needs: [ test-windows, test-mac, test-linux ]
  37. runs-on: ubuntu-latest
  38. steps:
  39. - uses: actions/checkout@main
  40. - uses: actions/checkout@main
  41. with:
  42. repository: floooh/sokol-zig
  43. path: bindgen/sokol-zig
  44. - uses: actions/checkout@main
  45. with:
  46. repository: floooh/sokol-nim
  47. path: bindgen/sokol-nim
  48. - uses: actions/checkout@main
  49. with:
  50. repository: floooh/sokol-odin
  51. path: bindgen/sokol-odin
  52. - uses: actions/checkout@main
  53. with:
  54. repository: floooh/sokol-rust
  55. path: bindgen/sokol-rust
  56. - uses: actions/checkout@main
  57. with:
  58. repository: kassane/sokol-d
  59. path: bindgen/sokol-d
  60. - uses: actions/checkout@main
  61. with:
  62. repository: colinbellino/sokol-jai
  63. path: bindgen/sokol-jai
  64. - uses: actions/checkout@main
  65. with:
  66. repository: floooh/sokol-c3
  67. path: bindgen/sokol-c3
  68. - name: generate
  69. run: |
  70. cd bindgen
  71. python3 gen_all.py
  72. - name: upload-zig-artifact
  73. uses: actions/upload-artifact@main
  74. with:
  75. name: ignore-me-zig
  76. retention-days: 1
  77. path: bindgen/sokol-zig/src/sokol
  78. - name: upload-nim-artifact
  79. uses: actions/upload-artifact@main
  80. with:
  81. name: ignore-me-nim
  82. retention-days: 1
  83. path: bindgen/sokol-nim/src/sokol
  84. - name: upload-odin-artifact
  85. uses: actions/upload-artifact@main
  86. with:
  87. name: ignore-me-odin
  88. retention-days: 1
  89. path: |
  90. bindgen/sokol-odin/sokol
  91. bindgen/sokol-odin/c
  92. - name: upload-rust-artifact
  93. uses: actions/upload-artifact@main
  94. with:
  95. name: ignore-me-rust
  96. retention-days: 1
  97. path: bindgen/sokol-rust/src
  98. - name: upload-d-artifact
  99. uses: actions/upload-artifact@main
  100. with:
  101. name: ignore-me-d
  102. retention-days: 1
  103. path: bindgen/sokol-d/src/sokol
  104. - name: upload-jai-artifact
  105. uses: actions/upload-artifact@main
  106. with:
  107. name: ignore-me-jai
  108. retention-days: 1
  109. path: bindgen/sokol-jai/sokol
  110. - name: upload-c3-artifact
  111. uses: actions/upload-artifact@main
  112. with:
  113. name: ignore-me-c3
  114. retention-days: 1
  115. path: bindgen/sokol-c3/sokol.c3l
  116. test-zig:
  117. needs: gen-bindings
  118. strategy:
  119. matrix:
  120. os: [ubuntu-latest, macos-latest, windows-latest]
  121. runs-on: ${{matrix.os}}
  122. steps:
  123. - uses: actions/checkout@main
  124. with:
  125. repository: floooh/sokol-zig
  126. - uses: mlugg/setup-zig@v2
  127. - uses: actions/download-artifact@main
  128. with:
  129. name: ignore-me-zig
  130. path: src/sokol
  131. - name: prepare
  132. if: runner.os == 'Linux'
  133. run: |
  134. sudo apt-get update
  135. sudo apt-get install libgl1-mesa-dev libegl1-mesa-dev mesa-common-dev xorg-dev libasound-dev
  136. - name: build
  137. run: zig build examples
  138. test-nim:
  139. needs: gen-bindings
  140. strategy:
  141. fail-fast: false
  142. matrix:
  143. # os: [ubuntu-latest, macos-latest, windows-latest]
  144. os: [ubuntu-latest, macos-latest]
  145. runs-on: ${{matrix.os}}
  146. steps:
  147. - if: runner.os == 'Linux'
  148. name: prepare
  149. run: |
  150. sudo apt-get update
  151. sudo apt-get install libglu1-mesa-dev mesa-common-dev xorg-dev libasound-dev
  152. - uses: actions/checkout@main
  153. with:
  154. repository: floooh/sokol-nim
  155. - uses: actions/download-artifact@main
  156. with:
  157. name: ignore-me-nim
  158. path: src/sokol
  159. - uses: jiro4989/setup-nim-action@v2
  160. with:
  161. nim-version: '2.0.x'
  162. repo-token: ${{ secrets.GITHUB_TOKEN }}
  163. - name: build
  164. run: |
  165. nimble install -Y
  166. nimble build_all
  167. test-odin:
  168. needs: gen-bindings
  169. strategy:
  170. fail-fast: false
  171. matrix:
  172. os: [ubuntu-latest, macos-latest, windows-latest]
  173. runs-on: ${{matrix.os}}
  174. steps:
  175. - uses: actions/checkout@main
  176. with:
  177. repository: floooh/sokol-odin
  178. - uses: actions/download-artifact@main
  179. with:
  180. name: ignore-me-odin
  181. # NOTE: see https://github.com/floooh/sokol-odin/blob/main/.github/workflows/main.yml
  182. - uses: ilammy/msvc-dev-cmd@v1
  183. - if: runner.os == 'Linux'
  184. name: prepare-linux
  185. run: |
  186. sudo apt-get update
  187. sudo apt-get install libglu1-mesa-dev mesa-common-dev xorg-dev libasound-dev
  188. wget https://apt.llvm.org/llvm.sh
  189. chmod +x llvm.sh
  190. echo "/usr/lib/llvm-17/bin" >> $GITHUB_PATH
  191. curl -L https://github.com/odin-lang/Odin/releases/download/dev-2024-04/odin-ubuntu-amd64-dev-2024-04.zip --output odin.zip
  192. unzip odin.zip
  193. unzip dist.zip
  194. rm -r ./dist/examples
  195. mv ./dist/* ./
  196. chmod a+x ./odin
  197. cd sokol
  198. chmod a+x ./build_clibs_linux.sh
  199. ./build_clibs_linux.sh
  200. cd ..
  201. - if: runner.os == 'macOS'
  202. name: prepare-macos
  203. run: |
  204. brew install llvm@17
  205. curl -L https://github.com/odin-lang/Odin/releases/download/dev-2024-04/odin-macos-amd64-dev-2024-04.zip --output odin.zip
  206. unzip odin.zip
  207. unzip dist.zip
  208. rm -r ./dist/examples
  209. mv ./dist/* ./
  210. chmod a+x ./odin
  211. cd sokol
  212. chmod a+x ./build_clibs_macos.sh
  213. ./build_clibs_macos.sh
  214. cd ..
  215. - if: runner.os == 'Windows'
  216. name: prepare-windows
  217. shell: cmd
  218. run: |
  219. curl -L https://github.com/odin-lang/Odin/releases/download/dev-2024-04/odin-windows-amd64-dev-2024-04.zip --output odin.zip
  220. unzip odin.zip
  221. cd sokol
  222. build_clibs_windows.cmd
  223. cd ..
  224. - name: build
  225. run: |
  226. ./odin build examples/clear -debug
  227. ./odin build examples/triangle -debug
  228. ./odin build examples/quad -debug
  229. ./odin build examples/bufferoffsets -debug
  230. ./odin build examples/cube -debug
  231. ./odin build examples/noninterleaved -debug
  232. ./odin build examples/texcube -debug
  233. ./odin build examples/shapes -debug
  234. ./odin build examples/offscreen -debug
  235. ./odin build examples/instancing -debug
  236. ./odin build examples/mrt -debug
  237. ./odin build examples/blend -debug
  238. ./odin build examples/debugtext -debug
  239. ./odin build examples/debugtext-print -debug
  240. ./odin build examples/debugtext-userfont -debug
  241. ./odin build examples/saudio -debug
  242. ./odin build examples/sgl -debug
  243. ./odin build examples/sgl-points -debug
  244. ./odin build examples/sgl-context -debug
  245. test-rust:
  246. needs: gen-bindings
  247. env:
  248. CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  249. strategy:
  250. fail-fast: false
  251. matrix:
  252. # os: [ubuntu-latest, macos-latest, windows-latest]
  253. os: [ubuntu-latest, windows-latest]
  254. runs-on: ${{matrix.os}}
  255. steps:
  256. - uses: actions/checkout@main
  257. with:
  258. repository: floooh/sokol-rust
  259. - uses: actions/download-artifact@main
  260. with:
  261. name: ignore-me-rust
  262. path: src
  263. - uses: dtolnay/rust-toolchain@master
  264. with:
  265. toolchain: stable
  266. - name: prepare-linux
  267. if: runner.os == 'Linux'
  268. run: |
  269. sudo apt-get update
  270. sudo apt-get install libglu1-mesa-dev mesa-common-dev xorg-dev libasound-dev
  271. - name: build
  272. run: |
  273. cargo --version
  274. cargo build --examples --verbose
  275. test-d:
  276. needs: gen-bindings
  277. strategy:
  278. matrix:
  279. os: [ubuntu-latest, macos-latest, windows-latest]
  280. runs-on: ${{matrix.os}}
  281. steps:
  282. - uses: actions/checkout@main
  283. with:
  284. repository: kassane/sokol-d
  285. - uses: egor-tensin/vs-shell@v2 # get cl.exe (default for Windows)
  286. - uses: dlang-community/setup-dlang@v2
  287. with:
  288. compiler: ldc-master
  289. - uses: actions/download-artifact@main
  290. with:
  291. name: ignore-me-d
  292. path: src/sokol
  293. - name: prepare
  294. if: runner.os == 'Linux'
  295. run: |
  296. sudo apt-get update
  297. sudo apt-get install libgl1-mesa-dev libegl1-mesa-dev mesa-common-dev xorg-dev libasound-dev
  298. - name: build
  299. working-directory: examples
  300. run: |
  301. dub build :blend
  302. dub build :bufferoffsets
  303. dub build :clear
  304. dub build :cube
  305. dub build :debugtext
  306. dub build :droptest
  307. dub build :imgui
  308. dub build :instancing
  309. dub build :instancingcompute
  310. dub build :mrt
  311. dub build :noninterleaved
  312. dub build :nuklear
  313. dub build :offscreen
  314. dub build :quad
  315. dub build :shapes
  316. dub build :saudio
  317. dub build :sglcontext
  318. dub build :sglpoints
  319. dub build :triangle
  320. dub build :texcube
  321. dub build :userdata
  322. dub build :vertexpull
  323. test-jai:
  324. needs: gen-bindings
  325. strategy:
  326. matrix:
  327. os: [ubuntu-latest, macos-latest, windows-latest]
  328. runs-on: ${{matrix.os}}
  329. steps:
  330. - uses: actions/checkout@main
  331. with:
  332. repository: colinbellino/sokol-jai
  333. - uses: actions/download-artifact@v4
  334. with:
  335. name: ignore-me-jai
  336. path: sokol
  337. - name: prepare
  338. if: runner.os == 'Linux'
  339. run: |
  340. sudo apt-get update
  341. sudo apt-get install libgl1-mesa-dev libegl1-mesa-dev mesa-common-dev xorg-dev libasound-dev
  342. - name: build
  343. run: echo "run jai here"
  344. test-c3:
  345. needs: gen-bindings
  346. strategy:
  347. # Continue build even if some platforms fail.
  348. fail-fast: false
  349. matrix:
  350. include:
  351. - os: macos-latest
  352. arch: arm64
  353. - os: ubuntu-latest
  354. arch: x64
  355. - os: windows-latest
  356. arch: x64
  357. runs-on: ${{matrix.os}}
  358. steps:
  359. - uses: actions/checkout@main
  360. with:
  361. repository: floooh/sokol-c3
  362. - uses: radekm/setup-c3@v2
  363. with:
  364. version: v0.7.2
  365. - uses: actions/download-artifact@main
  366. with:
  367. name: ignore-me-c3
  368. path: sokol.c3l
  369. - name: prepare
  370. if: runner.os == 'Linux'
  371. run: |
  372. sudo apt-get update
  373. sudo apt-get install libgl1-mesa-dev libegl1-mesa-dev mesa-common-dev xorg-dev libasound-dev
  374. - name: build
  375. shell: bash
  376. run: ./build-examples.sh
  377. # only deploy the bindings for commits on the main branch
  378. deploy-zig:
  379. needs: test-zig
  380. if: github.ref == 'refs/heads/master'
  381. runs-on: ubuntu-latest
  382. steps:
  383. - uses: actions/checkout@v4
  384. with:
  385. repository: floooh/sokol-zig
  386. ssh-key: ${{ secrets.GHACTIONS_ZIG_PUSH }}
  387. - uses: actions/download-artifact@v4
  388. with:
  389. name: ignore-me-zig
  390. path: src/sokol
  391. - name: "commit and push"
  392. run: |
  393. git config user.email "none"
  394. git config user.name "GH Action"
  395. git add -A
  396. git diff-index --quiet HEAD || git commit -m "updated (https://github.com/floooh/sokol/commit/${{ github.sha }})"
  397. git push
  398. deploy-nim:
  399. needs: test-nim
  400. if: github.ref == 'refs/heads/master'
  401. runs-on: ubuntu-latest
  402. steps:
  403. - uses: actions/checkout@v4
  404. with:
  405. repository: floooh/sokol-nim
  406. ssh-key: ${{ secrets.GHACTIONS_NIM_PUSH }}
  407. - uses: actions/download-artifact@v4
  408. with:
  409. name: ignore-me-nim
  410. path: src/sokol
  411. - name: "commit and push"
  412. run: |
  413. git config user.email "none"
  414. git config user.name "GH Action"
  415. git add -A
  416. git diff-index --quiet HEAD || git commit -m "updated (https://github.com/floooh/sokol/commit/${{ github.sha }})"
  417. git push
  418. deploy-odin:
  419. needs: test-odin
  420. if: github.ref == 'refs/heads/master'
  421. runs-on: ubuntu-latest
  422. steps:
  423. - uses: actions/checkout@v4
  424. with:
  425. repository: floooh/sokol-odin
  426. ssh-key: ${{ secrets.GHACTIONS_ODIN_PUSH }}
  427. - uses: actions/download-artifact@v4
  428. with:
  429. name: ignore-me-odin
  430. - name: "commit and push"
  431. run: |
  432. git config user.email "none"
  433. git config user.name "GH Action"
  434. git add -A
  435. git diff-index --quiet HEAD || git commit -m "updated (https://github.com/floooh/sokol/commit/${{ github.sha }})"
  436. git push
  437. deploy-rust:
  438. needs: test-rust
  439. env:
  440. CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  441. if: github.ref == 'refs/heads/master'
  442. runs-on: ubuntu-latest
  443. steps:
  444. - uses: actions/checkout@v4
  445. with:
  446. repository: floooh/sokol-rust
  447. ssh-key: ${{ secrets.GHACTIONS_RUST_PUSH }}
  448. - uses: actions/download-artifact@v4
  449. with:
  450. name: ignore-me-rust
  451. path: src
  452. - uses: dtolnay/rust-toolchain@master
  453. with:
  454. toolchain: stable
  455. - name: "cargo fmt"
  456. run: cargo fmt
  457. - name: "commit and push"
  458. run: |
  459. git config user.email "none"
  460. git config user.name "GH Action"
  461. git status -vv
  462. git add -A
  463. git diff-index --quiet HEAD || git commit -m "updated (https://github.com/floooh/sokol/commit/${{ github.sha }})"
  464. git push
  465. deploy-d:
  466. needs: test-d
  467. if: github.ref == 'refs/heads/master'
  468. runs-on: ubuntu-latest
  469. steps:
  470. - uses: actions/checkout@v4
  471. with:
  472. repository: kassane/sokol-d
  473. ssh-key: ${{ secrets.GHACTIONS_D_PUSH }}
  474. - uses: actions/download-artifact@v4
  475. with:
  476. name: ignore-me-d
  477. path: src/sokol
  478. - name: "commit and push"
  479. run: |
  480. git config user.email "none"
  481. git config user.name "GH Action"
  482. git add -A
  483. git diff-index --quiet HEAD || git commit -m "updated (https://github.com/floooh/sokol/commit/${{ github.sha }})"
  484. git push
  485. deploy-jai:
  486. needs: test-jai
  487. if: github.ref == 'refs/heads/master'
  488. runs-on: ubuntu-latest
  489. steps:
  490. - uses: actions/checkout@v4
  491. with:
  492. repository: colinbellino/sokol-jai
  493. ssh-key: ${{ secrets.GHACTIONS_JAI_PUSH }}
  494. - uses: actions/download-artifact@v4
  495. with:
  496. name: ignore-me-jai
  497. path: sokol
  498. - name: "commit and push"
  499. run: |
  500. git config user.email "none"
  501. git config user.name "GH Action"
  502. git add -A
  503. git diff-index --quiet HEAD || git commit -m "updated (https://github.com/floooh/sokol/commit/${{ github.sha }})"
  504. git push
  505. deploy-c3:
  506. needs: test-c3
  507. if: github.ref == 'refs/heads/master'
  508. runs-on: ubuntu-latest
  509. steps:
  510. - uses: actions/checkout@main
  511. with:
  512. repository: floooh/sokol-c3
  513. ssh-key: ${{ secrets.GHACTIONS_C3_PUSH }}
  514. - uses: actions/download-artifact@main
  515. with:
  516. name: ignore-me-c3
  517. path: sokol.c3l
  518. - name: "commit and push"
  519. run: |
  520. git config user.email "none"
  521. git config user.name "GH Action"
  522. git add -A
  523. git diff-index --quiet HEAD || git commit -m "updated (https://github.com/floooh/sokol/commit/${{ github.sha }})"
  524. git push