ci.yml 15 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: 2024Q3
  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 -strict-style -disallow-do -target:netbsd_amd64
  33. ./odin check examples/all -vet -strict-style -disallow-do -target:netbsd_arm64
  34. ./odin check vendor/sdl3 -vet -strict-style -disallow-do -target:netbsd_amd64 -no-entry-point
  35. ./odin check vendor/sdl3 -vet -strict-style -disallow-do -target:netbsd_arm64 -no-entry-point
  36. ./odin test tests/core/normal.odin -file -all-packages -vet -strict-style -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
  37. ./odin test tests/core/speed.odin -file -all-packages -vet -strict-style -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 -strict-style -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 -strict-style -disallow-do -target:freebsd_amd64
  65. ./odin check vendor/sdl3 -vet -strict-style -disallow-do -target:freebsd_amd64 -no-entry-point
  66. ./odin test tests/core/normal.odin -file -all-packages -vet -strict-style -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 -strict-style -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 -strict-style -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: [ubuntu-latest, macos-13, macos-14]
  77. runs-on: ${{ matrix.os }}
  78. name: ${{ matrix.os == 'macos-14' && 'MacOS ARM' || (matrix.os == 'macos-13' && 'MacOS Intel' || 'Ubuntu') }} Build, Check, and Test
  79. timeout-minutes: 15
  80. steps:
  81. - uses: actions/checkout@v4
  82. - name: Download LLVM (Linux)
  83. if: matrix.os == 'ubuntu-latest'
  84. run: |
  85. wget https://apt.llvm.org/llvm.sh
  86. chmod +x llvm.sh
  87. sudo ./llvm.sh 20
  88. echo "/usr/lib/llvm-20/bin" >> $GITHUB_PATH
  89. - name: Download LLVM (MacOS Intel)
  90. if: matrix.os == 'macos-13'
  91. run: |
  92. brew update
  93. brew install llvm [email protected] lld
  94. brew --prefix llvm@20 # Verifies it is LLVM 20
  95. - name: Download LLVM (MacOS ARM)
  96. if: matrix.os == 'macos-14'
  97. run: |
  98. brew update
  99. brew install llvm wasmtime [email protected] lld
  100. brew --prefix llvm@20 # Verifies it is LLVM 20
  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 -strict-style -vet -disallow-do
  120. - name: Odin check vendor/sdl3
  121. run: ./odin check vendor/sdl3 -strict-style -vet -disallow-do -no-entry-point
  122. - name: Normal Core library tests
  123. run: ./odin test tests/core/normal.odin -file -all-packages -vet -strict-style -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
  124. - name: Optimized Core library tests
  125. run: ./odin test tests/core/speed.odin -o:speed -file -all-packages -vet -strict-style -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
  126. - name: Vendor library tests
  127. run: ./odin test tests/vendor -all-packages -vet -strict-style -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
  128. - name: Internals tests
  129. run: ./odin test tests/internal -all-packages -vet -strict-style -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
  130. - name: GitHub Issue tests
  131. run: |
  132. cd tests/issues
  133. ./run.sh
  134. - name: Check benchmarks
  135. run: ./odin check tests/benchmark -vet -strict-style -no-entry-point
  136. - name: Odin check examples/all for Linux i386
  137. run: ./odin check examples/all -vet -strict-style -disallow-do -target:linux_i386
  138. if: matrix.os == 'ubuntu-latest'
  139. - name: Odin check examples/all for Linux arm64
  140. run: ./odin check examples/all -vet -strict-style -disallow-do -target:linux_arm64
  141. if: matrix.os == 'ubuntu-latest'
  142. - name: Odin check examples/all for FreeBSD amd64
  143. run: ./odin check examples/all -vet -strict-style -disallow-do -target:freebsd_amd64
  144. if: matrix.os == 'ubuntu-latest'
  145. - name: Odin check examples/all for OpenBSD amd64
  146. run: ./odin check examples/all -vet -strict-style -disallow-do -target:openbsd_amd64
  147. if: matrix.os == 'ubuntu-latest'
  148. - name: Odin check vendor/sdl3 for Linux i386
  149. run: ./odin check vendor/sdl3 -vet -strict-style -disallow-do -no-entry-point -target:linux_i386
  150. if: matrix.os == 'ubuntu-latest'
  151. - name: Odin check vendor/sdl3 for Linux arm64
  152. run: ./odin check vendor/sdl3 -vet -strict-style -disallow-do -no-entry-point -target:linux_arm64
  153. if: matrix.os == 'ubuntu-latest'
  154. - name: Odin check vendor/sdl3 for FreeBSD amd64
  155. run: ./odin check vendor/sdl3 -vet -strict-style -disallow-do -no-entry-point -target:freebsd_amd64
  156. if: matrix.os == 'ubuntu-latest'
  157. - name: Odin check vendor/sdl3 for OpenBSD amd64
  158. run: ./odin check vendor/sdl3 -vet -strict-style -disallow-do -no-entry-point -target:openbsd_amd64
  159. if: matrix.os == 'ubuntu-latest'
  160. - name: Run demo on WASI WASM32
  161. run: |
  162. ./odin build examples/demo -target:wasi_wasm32 -vet -strict-style -disallow-do -out:demo
  163. wasmtime ./demo.wasm
  164. if: matrix.os == 'macos-14'
  165. build_windows:
  166. name: Windows Build, Check, and Test
  167. runs-on: windows-2022
  168. timeout-minutes: 15
  169. steps:
  170. - uses: actions/checkout@v4
  171. - name: build Odin
  172. shell: cmd
  173. run: |
  174. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  175. ./build.bat 1
  176. - name: Odin version
  177. run: ./odin version
  178. - name: Odin report
  179. run: ./odin report
  180. - name: Odin check
  181. shell: cmd
  182. run: |
  183. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  184. odin check examples/demo -vet
  185. - name: Odin run
  186. shell: cmd
  187. run: |
  188. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  189. odin run examples/demo
  190. - name: Odin run -debug
  191. shell: cmd
  192. run: |
  193. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  194. odin run examples/demo -debug -vet -strict-style -disallow-do
  195. - name: Odin check examples/all
  196. shell: cmd
  197. run: |
  198. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  199. odin check examples/all -vet -strict-style -disallow-do
  200. - name: Odin check vendor/sdl3
  201. shell: cmd
  202. run: |
  203. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  204. odin check vendor/sdl3 -vet -strict-style -disallow-do -no-entry-point
  205. - name: Core library tests
  206. shell: cmd
  207. run: |
  208. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  209. odin test tests/core/normal.odin -file -all-packages -vet -strict-style -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
  210. - name: Optimized core library tests
  211. shell: cmd
  212. run: |
  213. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  214. odin test tests/core/speed.odin -o:speed -file -all-packages -vet -strict-style -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
  215. - name: Vendor library tests
  216. shell: cmd
  217. run: |
  218. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  219. copy vendor\lua\5.4\windows\*.dll .
  220. odin test tests/vendor -all-packages -vet -strict-style -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
  221. - name: Odin internals tests
  222. shell: cmd
  223. run: |
  224. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  225. odin test tests/internal -all-packages -vet -strict-style -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
  226. - name: Check issues
  227. shell: cmd
  228. run: |
  229. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  230. cd tests/issues
  231. call run.bat
  232. - name: Check benchmarks
  233. shell: cmd
  234. run: |
  235. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  236. odin check tests/benchmark -vet -strict-style -no-entry-point
  237. - name: Odin documentation tests
  238. shell: cmd
  239. run: |
  240. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  241. cd tests\documentation
  242. call build.bat
  243. - name: core:math/big tests
  244. shell: cmd
  245. run: |
  246. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  247. cd tests\core\math\big
  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 -strict-style -disallow-do
  279. - name: Odin check vendor/sdl3
  280. run: ./odin check vendor/sdl3 -target:linux_riscv64 -vet -strict-style -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 -strict-style -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 -strict-style -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 -strict-style -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 -strict-style -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 -strict-style -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