ci.yml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. name: CI
  2. on: [push, pull_request, workflow_dispatch]
  3. jobs:
  4. build_netbsd:
  5. name: NetBSD Build, Check, and Test
  6. runs-on: ubuntu-latest
  7. env:
  8. PKGSRC_BRANCH: 2025Q2
  9. steps:
  10. - uses: actions/checkout@v4
  11. - name: Build, Check, and Test
  12. timeout-minutes: 15
  13. uses: vmactions/netbsd-vm@v1
  14. with:
  15. release: "10.0"
  16. envs: PKGSRC_BRANCH
  17. usesh: true
  18. copyback: false
  19. prepare: |
  20. PKG_PATH="https://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/amd64/$(uname -r | cut -d_ -f1)_${PKGSRC_BRANCH}/All" /usr/sbin/pkg_add pkgin
  21. pkgin -y in gmake git bash python311 llvm clang
  22. ln -s /usr/pkg/bin/python3.11 /usr/bin/python3
  23. run: |
  24. set -e -x
  25. git config --global --add safe.directory $(pwd)
  26. gmake release
  27. ./odin version
  28. ./odin report
  29. gmake -C vendor/stb/src
  30. gmake -C vendor/cgltf/src
  31. gmake -C vendor/miniaudio/src
  32. ./odin check examples/all -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -target:netbsd_amd64
  33. ./odin check examples/all -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -target:netbsd_arm64
  34. ./odin check examples/all/sdl3 -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -target:netbsd_amd64 -no-entry-point
  35. ./odin check examples/all/sdl3 -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -target:netbsd_arm64 -no-entry-point
  36. ./odin test tests/core/normal.odin -file -all-packages -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
  37. ./odin test tests/core/speed.odin -file -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -o:speed -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
  38. ./odin test tests/vendor -all-packages -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
  39. (cd tests/issues; ./run.sh)
  40. ./odin check tests/benchmark -vet -strict-style -no-entry-point
  41. build_freebsd:
  42. name: FreeBSD Build, Check, and Test
  43. runs-on: ubuntu-latest
  44. steps:
  45. - uses: actions/checkout@v4
  46. - name: Build, Check, and Test
  47. timeout-minutes: 15
  48. uses: vmactions/freebsd-vm@v1
  49. with:
  50. usesh: true
  51. copyback: false
  52. prepare: |
  53. pkg install -y gmake git bash python3 libxml2 llvm18
  54. run: |
  55. # `set -e` is needed for test failures to register. https://github.com/vmactions/freebsd-vm/issues/72
  56. set -e -x
  57. git config --global --add safe.directory $(pwd)
  58. gmake release
  59. ./odin version
  60. ./odin report
  61. gmake -C vendor/stb/src
  62. gmake -C vendor/cgltf/src
  63. gmake -C vendor/miniaudio/src
  64. ./odin check examples/all -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -target:freebsd_amd64
  65. ./odin check examples/all/sdl3 -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -target:freebsd_amd64 -no-entry-point
  66. ./odin test tests/core/normal.odin -file -all-packages -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
  67. ./odin test tests/core/speed.odin -file -all-packages -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -o:speed -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
  68. ./odin test tests/vendor -all-packages -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
  69. (cd tests/issues; ./run.sh)
  70. ./odin check tests/benchmark -vet -strict-style -no-entry-point
  71. ci:
  72. strategy:
  73. fail-fast: false
  74. matrix:
  75. # MacOS 13 runs on Intel, 14 runs on ARM
  76. os: [macos-14, ubuntu-latest]
  77. runs-on: ${{ matrix.os }}
  78. name: ${{ matrix.os == 'macos-14' && 'MacOS ARM' || (matrix.os == 'macos-13' && 'MacOS Intel') || (matrix.os == 'ubuntu-latest' && 'Ubuntu') }} Build, Check, and Test
  79. timeout-minutes: 15
  80. steps:
  81. - uses: actions/checkout@v4
  82. - name: Download LLVM (MacOS Intel)
  83. if: matrix.os == 'macos-13'
  84. run: |
  85. brew update
  86. brew install llvm@20 [email protected] lld
  87. echo "$(brew --prefix llvm@20)/bin" >> $GITHUB_PATH
  88. - name: Download LLVM (MacOS ARM)
  89. if: matrix.os == 'macos-14'
  90. run: |
  91. brew update
  92. brew install llvm@20 wasmtime [email protected] lld
  93. echo "$(brew --prefix llvm@20)/bin" >> $GITHUB_PATH
  94. - name: Download LLVM (Ubuntu)
  95. if: matrix.os == 'ubuntu-latest'
  96. run: |
  97. wget https://apt.llvm.org/llvm.sh
  98. chmod +x llvm.sh
  99. sudo ./llvm.sh 20
  100. echo "/usr/lib/llvm-20/bin" >> $GITHUB_PATH
  101. - name: Build Odin
  102. run: ./build_odin.sh release
  103. - name: Odin version
  104. run: ./odin version
  105. - name: Odin report
  106. run: ./odin report
  107. - name: Compile needed Vendor
  108. run: |
  109. make -C vendor/stb/src
  110. make -C vendor/cgltf/src
  111. make -C vendor/miniaudio/src
  112. - name: Odin check
  113. run: ./odin check examples/demo -vet
  114. - name: Odin run
  115. run: ./odin run examples/demo
  116. - name: Odin run -debug
  117. run: ./odin run examples/demo -debug
  118. - name: Odin check examples/all
  119. run: ./odin check examples/all -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do
  120. - name: Odin check examples/all/sdl3
  121. run: ./odin check examples/all/sdl3 -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -no-entry-point
  122. - name: Normal Core library tests
  123. run: ./odin test tests/core/normal.odin -file -all-packages -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true -sanitize:address
  124. - name: Optimized Core library tests
  125. run: ./odin test tests/core/speed.odin -o:speed -file -all-packages -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true -sanitize:address
  126. - name: Vendor library tests
  127. run: ./odin test tests/vendor -all-packages -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true -sanitize:address
  128. - name: Internals tests
  129. run: ./odin test tests/internal -all-packages -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true -sanitize:address
  130. - name: GitHub Issue tests
  131. run: |
  132. cd tests/issues
  133. ./run.sh
  134. - name: Run demo on WASI WASM32
  135. run: |
  136. ./odin build examples/demo -target:wasi_wasm32 -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -out:demo
  137. wasmtime ./demo.wasm
  138. if: matrix.os == 'macos-14'
  139. - name: Check benchmarks
  140. run: ./odin check tests/benchmark -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -no-entry-point
  141. - name: Odin check examples/all for Linux i386
  142. if: matrix.os == 'ubuntu-latest'
  143. run: ./odin check examples/all -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -target:linux_i386
  144. - name: Odin check examples/all for Linux arm64
  145. if: matrix.os == 'ubuntu-latest'
  146. run: ./odin check examples/all -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -target:linux_arm64
  147. - name: Odin check examples/all for FreeBSD amd64
  148. if: matrix.os == 'ubuntu-latest'
  149. run: ./odin check examples/all -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -target:freebsd_amd64
  150. - name: Odin check examples/all for OpenBSD amd64
  151. if: matrix.os == 'ubuntu-latest'
  152. run: ./odin check examples/all -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -target:openbsd_amd64
  153. - name: Odin check examples/all for js_wasm32
  154. if: matrix.os == 'ubuntu-latest'
  155. run: ./odin check examples/all -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -no-entry-point -target:js_wasm32
  156. - name: Odin check examples/all for js_wasm64p32
  157. if: matrix.os == 'ubuntu-latest'
  158. run: ./odin check examples/all -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -no-entry-point -target:js_wasm64p32
  159. - name: Odin check examples/all/sdl3 for Linux i386
  160. if: matrix.os == 'ubuntu-latest'
  161. run: ./odin check examples/all/sdl3 -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -no-entry-point -target:linux_i386
  162. - name: Odin check examples/all/sdl3 for Linux arm64
  163. if: matrix.os == 'ubuntu-latest'
  164. run: ./odin check examples/all/sdl3 -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -no-entry-point -target:linux_arm64
  165. - name: Odin check examples/all/sdl3 for FreeBSD amd64
  166. if: matrix.os == 'ubuntu-latest'
  167. run: ./odin check examples/all/sdl3 -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -no-entry-point -target:freebsd_amd64
  168. - name: Odin check examples/all/sdl3 for OpenBSD amd64
  169. if: matrix.os == 'ubuntu-latest'
  170. run: ./odin check examples/all/sdl3 -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -no-entry-point -target:openbsd_amd64
  171. build_windows:
  172. name: Windows Build, Check, and Test
  173. runs-on: windows-2022
  174. timeout-minutes: 15
  175. steps:
  176. - uses: actions/checkout@v4
  177. - name: build Odin
  178. shell: cmd
  179. run: |
  180. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  181. ./build.bat 1
  182. - name: Odin version
  183. run: ./odin version
  184. - name: Odin report
  185. run: ./odin report
  186. - name: Odin check
  187. shell: cmd
  188. run: |
  189. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  190. odin check examples/demo -vet
  191. - name: Odin run
  192. shell: cmd
  193. run: |
  194. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  195. odin run examples/demo
  196. - name: Odin run -debug
  197. shell: cmd
  198. run: |
  199. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  200. odin run examples/demo -debug -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do
  201. - name: Odin check examples/all
  202. shell: cmd
  203. run: |
  204. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  205. odin check examples/all -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do
  206. - name: Odin check examples/all/sdl3
  207. shell: cmd
  208. run: |
  209. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  210. odin check examples/all/sdl3 -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -no-entry-point
  211. - name: Core library tests
  212. shell: cmd
  213. run: |
  214. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  215. odin test tests/core/normal.odin -file -all-packages -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true -sanitize:address
  216. - name: Optimized core library tests
  217. shell: cmd
  218. run: |
  219. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  220. odin test tests/core/speed.odin -o:speed -file -all-packages -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true -sanitize:address
  221. - name: Vendor library tests
  222. shell: cmd
  223. run: |
  224. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  225. copy vendor\lua\5.4\windows\*.dll .
  226. odin test tests/vendor -all-packages -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true -sanitize:address
  227. - name: Odin internals tests
  228. shell: cmd
  229. run: |
  230. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  231. odin test tests/internal -all-packages -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true -sanitize:address
  232. - name: Check issues
  233. shell: cmd
  234. run: |
  235. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  236. cd tests/issues
  237. call run.bat
  238. - name: Check benchmarks
  239. shell: cmd
  240. run: |
  241. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  242. odin check tests/benchmark -vet -strict-style -no-entry-point
  243. - name: Odin documentation tests
  244. shell: cmd
  245. run: |
  246. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  247. cd tests\documentation
  248. call build.bat
  249. - name: Odin check examples/all for Windows 32bits
  250. shell: cmd
  251. run: |
  252. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  253. odin check examples/all -strict-style -target:windows_i386
  254. build_linux_riscv64:
  255. runs-on: ubuntu-latest
  256. name: Linux riscv64 (emulated) Build, Check and Test
  257. timeout-minutes: 15
  258. steps:
  259. - uses: actions/checkout@v4
  260. - name: Download LLVM (Linux)
  261. run: |
  262. wget https://apt.llvm.org/llvm.sh
  263. chmod +x llvm.sh
  264. sudo ./llvm.sh 18
  265. echo "/usr/lib/llvm-18/bin" >> $GITHUB_PATH
  266. - name: Build Odin
  267. run: ./build_odin.sh release
  268. - name: Odin version
  269. run: ./odin version
  270. - name: Odin report
  271. run: ./odin report
  272. - name: Compile needed Vendor
  273. run: |
  274. make -C vendor/stb/src
  275. make -C vendor/cgltf/src
  276. make -C vendor/miniaudio/src
  277. - name: Odin check examples/all
  278. run: ./odin check examples/all -target:linux_riscv64 -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do
  279. - name: Odin check examples/all/sdl3
  280. run: ./odin check examples/all/sdl3 -target:linux_riscv64 -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -no-entry-point
  281. - name: Install riscv64 toolchain and qemu
  282. run: sudo apt-get install -y qemu-user qemu-user-static gcc-12-riscv64-linux-gnu libc6-riscv64-cross
  283. - name: Odin run
  284. run: ./odin run examples/demo -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -target:linux_riscv64 -extra-linker-flags:"-fuse-ld=/usr/bin/riscv64-linux-gnu-gcc-12 -static -Wl,-static" -no-rpath
  285. - name: Odin run -debug
  286. run: ./odin run examples/demo -debug -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -target:linux_riscv64 -extra-linker-flags:"-fuse-ld=/usr/bin/riscv64-linux-gnu-gcc-12 -static -Wl,-static" -no-rpath
  287. - name: Normal Core library tests
  288. run: ./odin test tests/core/normal.odin -file -all-packages -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true -target:linux_riscv64 -extra-linker-flags:"-fuse-ld=/usr/bin/riscv64-linux-gnu-gcc-12 -static -Wl,-static" -no-rpath
  289. - name: Optimized Core library tests
  290. run: ./odin test tests/core/speed.odin -o:speed -file -all-packages -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true -target:linux_riscv64 -extra-linker-flags:"-fuse-ld=/usr/bin/riscv64-linux-gnu-gcc-12 -static -Wl,-static" -no-rpath
  291. - name: Internals tests
  292. run: ./odin test tests/internal -all-packages -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true -target:linux_riscv64 -extra-linker-flags:"-fuse-ld=/usr/bin/riscv64-linux-gnu-gcc-12 -static -Wl,-static" -no-rpath