gen_bindings.yml 16 KB

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