c-cpp.yml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. name: C/C++ CI
  2. on: [push, pull_request]
  3. jobs:
  4. build-alpine:
  5. timeout-minutes: 15
  6. runs-on: ubuntu-22.04
  7. strategy:
  8. matrix:
  9. config:
  10. - {arch: x86_64, branch: latest-stable}
  11. - {arch: x86, branch: latest-stable}
  12. - {arch: aarch64, branch: latest-stable}
  13. - {arch: armhf, branch: latest-stable}
  14. - {arch: armv7, branch: latest-stable}
  15. - {arch: ppc64le, branch: latest-stable}
  16. - {arch: riscv64, branch: edge}
  17. - {arch: s390x, branch: latest-stable}
  18. steps:
  19. - name: Setup Alpine Linux
  20. uses: jirutka/setup-alpine@v1
  21. with:
  22. arch: ${{ matrix.config.arch }}
  23. branch: ${{ matrix.config.branch }}
  24. - name: Install dependencies
  25. shell: alpine.sh --root {0}
  26. run: |
  27. apk add git cmake gcc g++ make
  28. - name: Checkout repository
  29. uses: actions/checkout@v3
  30. with:
  31. submodules: true
  32. - name: Build RandomX
  33. shell: alpine.sh {0}
  34. run: |
  35. mkdir build
  36. cd build
  37. cmake ..
  38. make -j$(nproc)
  39. - name: Run tests
  40. shell: alpine.sh {0}
  41. run: |
  42. build/randomx-tests
  43. build-ubuntu:
  44. timeout-minutes: 5
  45. runs-on: ${{ matrix.config.os }}
  46. strategy:
  47. matrix:
  48. config:
  49. - {os: ubuntu-20.04, c: gcc-11, cpp: g++-11}
  50. - {os: ubuntu-22.04, c: gcc-12, cpp: g++-12}
  51. steps:
  52. - name: Install dependencies
  53. run: |
  54. sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
  55. sudo apt update
  56. sudo apt install -y git build-essential cmake ${{ matrix.config.c }} ${{ matrix.config.cpp }}
  57. - name: Checkout repository
  58. uses: actions/checkout@v3
  59. with:
  60. submodules: true
  61. - name: Build RandomX
  62. run: |
  63. mkdir build
  64. cd build
  65. cmake ..
  66. make -j$(nproc)
  67. - name: Run tests
  68. run: |
  69. build/randomx-tests
  70. build-windows-msys2:
  71. timeout-minutes: 15
  72. runs-on: windows-latest
  73. strategy:
  74. matrix:
  75. config:
  76. - {c: "gcc", cxx: "g++"}
  77. - {c: "clang", cxx: "clang++"}
  78. defaults:
  79. run:
  80. shell: msys2 {0}
  81. steps:
  82. - name: Checkout repository
  83. uses: actions/checkout@v3
  84. with:
  85. submodules: recursive
  86. - name: Setup MSYS2
  87. uses: eine/setup-msys2@v2
  88. with:
  89. update: true
  90. install: mingw-w64-x86_64-toolchain mingw-w64-x86_64-clang mingw-w64-x86_64-lld mingw-w64-x86_64-cmake make
  91. - name: Build RandomX
  92. run: |
  93. mkdir build
  94. cd build
  95. cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }}
  96. make -j$(nproc)
  97. - name: Run tests
  98. run: |
  99. build/randomx-tests.exe
  100. build-windows-msbuild:
  101. timeout-minutes: 5
  102. runs-on: windows-${{ matrix.config.os }}
  103. strategy:
  104. matrix:
  105. config:
  106. - {arch: x64, os: 2019, vs: Visual Studio 16 2019, msbuild: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin\\amd64\\"}
  107. - {arch: x64, os: 2022, vs: Visual Studio 17 2022, msbuild: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Msbuild\\Current\\Bin\\amd64\\"}
  108. - {arch: Win32, os: 2019, vs: Visual Studio 16 2019, msbuild: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin\\"}
  109. - {arch: Win32, os: 2022, vs: Visual Studio 17 2022, msbuild: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Msbuild\\Current\\Bin\\"}
  110. steps:
  111. - name: Checkout repository
  112. uses: actions/checkout@v3
  113. with:
  114. submodules: recursive
  115. - name: Setup cmake
  116. uses: lukka/get-cmake@latest
  117. - name: Build RandomX
  118. run: |
  119. mkdir build
  120. cd build
  121. cmake .. -G "${{ matrix.config.vs }}" -A ${{ matrix.config.arch }}
  122. & "${{ matrix.config.msbuild }}msbuild" -v:m /m /p:Configuration=Release randomx-tests.vcxproj
  123. - name: Run tests
  124. run: |
  125. build/Release/randomx-tests.exe
  126. build-macos:
  127. timeout-minutes: 5
  128. runs-on: ${{ matrix.os }}
  129. strategy:
  130. matrix:
  131. os: [macos-11, macos-12, macos-13]
  132. steps:
  133. - name: Checkout repository
  134. uses: actions/checkout@v3
  135. with:
  136. submodules: recursive
  137. - name: Install dependencies
  138. run: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake
  139. - name: Build RandomX
  140. run: |
  141. mkdir build
  142. cd build
  143. cmake ..
  144. make -j3
  145. - name: Run tests
  146. run: |
  147. build/randomx-tests
  148. build-freebsd:
  149. timeout-minutes: 15
  150. runs-on: ${{ matrix.os.host }}
  151. strategy:
  152. matrix:
  153. os:
  154. - name: freebsd
  155. architecture: x86-64
  156. version: '13.2'
  157. host: ubuntu-22.04
  158. - name: freebsd
  159. architecture: arm64
  160. version: '13.2'
  161. host: ubuntu-22.04
  162. steps:
  163. - name: Checkout repository
  164. uses: actions/checkout@v3
  165. with:
  166. submodules: recursive
  167. - name: Build RandomX
  168. uses: cross-platform-actions/action@v0.19.0
  169. with:
  170. operating_system: ${{ matrix.os.name }}
  171. architecture: ${{ matrix.os.architecture }}
  172. version: ${{ matrix.os.version }}
  173. shell: bash
  174. run: |
  175. sudo pkg install -y cmake
  176. mkdir build && cd build
  177. cmake ..
  178. make -j2
  179. ./randomx-tests