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. 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. with:
  128. # NOTE: version can also come from build.zig.zon
  129. version: master
  130. - uses: actions/download-artifact@main
  131. with:
  132. name: ignore-me-zig
  133. path: src/sokol
  134. - name: prepare
  135. if: runner.os == 'Linux'
  136. run: |
  137. sudo apt-get update
  138. sudo apt-get install libgl1-mesa-dev libegl1-mesa-dev mesa-common-dev xorg-dev libasound-dev
  139. - name: build
  140. run: zig build examples
  141. test-nim:
  142. needs: gen-bindings
  143. strategy:
  144. fail-fast: false
  145. matrix:
  146. # os: [ubuntu-latest, macos-latest, windows-latest]
  147. os: [ubuntu-latest, macos-latest]
  148. runs-on: ${{matrix.os}}
  149. steps:
  150. - if: runner.os == 'Linux'
  151. name: prepare
  152. run: |
  153. sudo apt-get update
  154. sudo apt-get install libglu1-mesa-dev mesa-common-dev xorg-dev libasound-dev
  155. - uses: actions/checkout@main
  156. with:
  157. repository: floooh/sokol-nim
  158. - uses: actions/download-artifact@main
  159. with:
  160. name: ignore-me-nim
  161. path: src/sokol
  162. - uses: jiro4989/setup-nim-action@v2
  163. with:
  164. nim-version: '2.0.x'
  165. repo-token: ${{ secrets.GITHUB_TOKEN }}
  166. - name: build
  167. run: |
  168. nimble install -Y
  169. nimble build_all
  170. test-odin:
  171. needs: gen-bindings
  172. strategy:
  173. fail-fast: false
  174. matrix:
  175. os: [ubuntu-latest, macos-latest, windows-latest]
  176. runs-on: ${{matrix.os}}
  177. steps:
  178. - uses: actions/checkout@main
  179. with:
  180. repository: floooh/sokol-odin
  181. - uses: actions/download-artifact@main
  182. with:
  183. name: ignore-me-odin
  184. # NOTE: see https://github.com/floooh/sokol-odin/blob/main/.github/workflows/main.yml
  185. - uses: ilammy/msvc-dev-cmd@v1
  186. - if: runner.os == 'Linux'
  187. name: prepare-linux
  188. run: |
  189. sudo apt-get update
  190. sudo apt-get install libglu1-mesa-dev mesa-common-dev xorg-dev libasound-dev
  191. wget https://apt.llvm.org/llvm.sh
  192. chmod +x llvm.sh
  193. echo "/usr/lib/llvm-17/bin" >> $GITHUB_PATH
  194. curl -L https://github.com/odin-lang/Odin/releases/download/dev-2024-04/odin-ubuntu-amd64-dev-2024-04.zip --output odin.zip
  195. unzip odin.zip
  196. unzip dist.zip
  197. rm -r ./dist/examples
  198. mv ./dist/* ./
  199. chmod a+x ./odin
  200. cd sokol
  201. chmod a+x ./build_clibs_linux.sh
  202. ./build_clibs_linux.sh
  203. cd ..
  204. - if: runner.os == 'macOS'
  205. name: prepare-macos
  206. run: |
  207. brew install llvm@17
  208. curl -L https://github.com/odin-lang/Odin/releases/download/dev-2024-04/odin-macos-amd64-dev-2024-04.zip --output odin.zip
  209. unzip odin.zip
  210. unzip dist.zip
  211. rm -r ./dist/examples
  212. mv ./dist/* ./
  213. chmod a+x ./odin
  214. cd sokol
  215. chmod a+x ./build_clibs_macos.sh
  216. ./build_clibs_macos.sh
  217. cd ..
  218. - if: runner.os == 'Windows'
  219. name: prepare-windows
  220. shell: cmd
  221. run: |
  222. curl -L https://github.com/odin-lang/Odin/releases/download/dev-2024-04/odin-windows-amd64-dev-2024-04.zip --output odin.zip
  223. unzip odin.zip
  224. cd sokol
  225. build_clibs_windows.cmd
  226. cd ..
  227. - name: build
  228. run: |
  229. ./odin build examples/clear -debug
  230. ./odin build examples/triangle -debug
  231. ./odin build examples/quad -debug
  232. ./odin build examples/bufferoffsets -debug
  233. ./odin build examples/cube -debug
  234. ./odin build examples/noninterleaved -debug
  235. ./odin build examples/texcube -debug
  236. ./odin build examples/shapes -debug
  237. ./odin build examples/offscreen -debug
  238. ./odin build examples/instancing -debug
  239. ./odin build examples/mrt -debug
  240. ./odin build examples/blend -debug
  241. ./odin build examples/debugtext -debug
  242. ./odin build examples/debugtext-print -debug
  243. ./odin build examples/debugtext-userfont -debug
  244. ./odin build examples/saudio -debug
  245. ./odin build examples/sgl -debug
  246. ./odin build examples/sgl-points -debug
  247. ./odin build examples/sgl-context -debug
  248. test-rust:
  249. needs: gen-bindings
  250. env:
  251. CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  252. strategy:
  253. fail-fast: false
  254. matrix:
  255. # os: [ubuntu-latest, macos-latest, windows-latest]
  256. os: [ubuntu-latest, windows-latest]
  257. runs-on: ${{matrix.os}}
  258. steps:
  259. - uses: actions/checkout@main
  260. with:
  261. repository: floooh/sokol-rust
  262. - uses: actions/download-artifact@main
  263. with:
  264. name: ignore-me-rust
  265. path: src
  266. - uses: dtolnay/rust-toolchain@master
  267. with:
  268. toolchain: stable
  269. - name: prepare-linux
  270. if: runner.os == 'Linux'
  271. run: |
  272. sudo apt-get update
  273. sudo apt-get install libglu1-mesa-dev mesa-common-dev xorg-dev libasound-dev
  274. - name: build
  275. run: |
  276. cargo --version
  277. cargo build --examples --verbose
  278. test-d:
  279. needs: gen-bindings
  280. strategy:
  281. matrix:
  282. os: [ubuntu-latest, macos-latest, windows-latest]
  283. runs-on: ${{matrix.os}}
  284. steps:
  285. - uses: actions/checkout@main
  286. with:
  287. repository: kassane/sokol-d
  288. - uses: egor-tensin/vs-shell@v2 # get cl.exe (default for Windows)
  289. - uses: dlang-community/setup-dlang@v2
  290. with:
  291. compiler: ldc-master
  292. - uses: actions/download-artifact@main
  293. with:
  294. name: ignore-me-d
  295. path: src/sokol
  296. - name: prepare
  297. if: runner.os == 'Linux'
  298. run: |
  299. sudo apt-get update
  300. sudo apt-get install libgl1-mesa-dev libegl1-mesa-dev mesa-common-dev xorg-dev libasound-dev
  301. - name: build
  302. working-directory: examples
  303. run: |
  304. dub build :blend
  305. dub build :bufferoffsets
  306. dub build :clear
  307. dub build :cube
  308. dub build :debugtext
  309. dub build :droptest
  310. dub build :imgui
  311. dub build :instancing
  312. dub build :instancingcompute
  313. dub build :mrt
  314. dub build :noninterleaved
  315. dub build :nuklear
  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