.gitlab-ci.yml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. variables:
  2. DOC_SERVER: doc
  3. GIT_DEPTH: "3"
  4. DOC_CENTER: /home/xl_ci/doc_center
  5. SHAREENVLOC: /home/share/devtools
  6. IMAGE: rego.corp.nucleisys.com/software/sdkbuild
  7. IMAGE_TAG: "2025.10"
  8. JOBCTRL: "RUN"
  9. workflow:
  10. rules:
  11. - if: $CI_COMMIT_MESSAGE =~ /draft|wip|stash/i
  12. when: never
  13. - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /master_n100|develop_n100/ && $CI_PIPELINE_SOURCE == "merge_request_event"
  14. - if: $CI_COMMIT_BRANCH =~ /master_n100|develop_n100/ && $CI_OPEN_MERGE_REQUESTS
  15. when: never
  16. - if: $CI_COMMIT_BRANCH =~ /master_n100|develop_n100/
  17. - if: $CI_COMMIT_BRANCH == "master_n100" && $CI_COMMIT_TAG
  18. default:
  19. tags:
  20. - env::docker
  21. - net::outside
  22. image: $IMAGE:$IMAGE_TAG
  23. stages:
  24. - check
  25. - build
  26. - deploy
  27. ## Job for build document
  28. build_doc:
  29. stage: check
  30. interruptible: true
  31. only:
  32. changes:
  33. - doc/**/**/**/*
  34. - .gitlab-ci.yml
  35. retry: 1
  36. artifacts:
  37. name: "nuclei_n100_sdk_doc-job${CI_JOB_ID}-${CI_COMMIT_SHA::8}"
  38. paths:
  39. - doc/build
  40. expire_in: 2 day
  41. before_script:
  42. - python3 --version
  43. - pip3 --version
  44. script:
  45. - cd doc
  46. - make clean
  47. - make all
  48. - make latexpdf
  49. - cp build/latex/*.pdf build/html/
  50. ## Job for deploy document to internal server
  51. deploy_doc:
  52. stage: deploy
  53. when: on_success
  54. retry: 1
  55. only:
  56. refs:
  57. - master_n100
  58. changes:
  59. - doc/**/**/**/**/*
  60. - .gitlab-ci.yml
  61. script:
  62. - ssh $DOC_SERVER "rm -rf $DOC_CENTER/nuclei_sdk/*"
  63. - ssh $DOC_SERVER "mkdir -p $DOC_CENTER/nuclei_sdk/"
  64. - cd doc/build
  65. - scp -r html $DOC_SERVER:$DOC_CENTER/nuclei_n100_sdk
  66. dependencies:
  67. - build_doc
  68. tags:
  69. - env::native
  70. - host::whss1
  71. ## Job for deploy document to nuclei website
  72. deploy_website:
  73. stage: deploy
  74. when: on_success
  75. retry: 1
  76. only:
  77. refs:
  78. - master_n100
  79. changes:
  80. - doc/**/**/**/**/*
  81. script:
  82. - ./.ci/ftp_deploy.sh $FTPUSER $FTPPWD $FTPSERVER doc/build/html nuclei_n100_sdk
  83. dependencies:
  84. - build_doc
  85. tags:
  86. - env::native
  87. - host::whss1
  88. ## Job template
  89. .job_template: &job_template_default
  90. image: $IMAGE:$IMAGE_TAG
  91. interruptible: true
  92. stage: build
  93. before_script:
  94. - which riscv64-unknown-elf-gcc && riscv64-unknown-elf-gcc --version
  95. - which riscv64-unknown-elf-clang && riscv64-unknown-elf-clang --version
  96. - which qemu-system-riscv32 && qemu-system-riscv32 --version
  97. - which make && make --version
  98. - which python3 && python3 --version
  99. # CI_JOB_NAME_SLUG is introduced >=15.4 gitlab release
  100. - export CI_JOB_NAME_SHORT=${CI_JOB_NAME/[\[ :\/ ]*}
  101. - echo "CI_JOB_NAME_SHORT=${CI_JOB_NAME_SHORT}"
  102. artifacts:
  103. when: always
  104. name: "nsdkcli_logs-job${CI_JOB_ID}-${CI_COMMIT_SHA::8}"
  105. paths:
  106. - logs
  107. expire_in: 2 day
  108. .job_ctrl_template: &job_ctrl_template_default
  109. <<: *job_template_default
  110. rules:
  111. - if: $JOBCTRL == "RUN"
  112. build_evalsoc:
  113. <<: *job_template_default
  114. stage: check
  115. variables:
  116. APPCFG: tools/scripts/nsdk_cli/configs/application.json
  117. HWCFG: tools/scripts/nsdk_cli/configs/nuclei_fpga_eval_ci.json
  118. parallel:
  119. matrix:
  120. - DOWNLOAD: [ "sram" ]
  121. ARCH_EXT: [ "", "_zca_zcb_zcmp_zcmt" ]
  122. STDCLIB: ["newlib_small", "libncrt_small"]
  123. script:
  124. - export LOGDIR=logs/${CI_JOB_NAME_SHORT}/${STDCLIB}_${DOWNLOAD}${ARCH_EXT}
  125. - python3 tools/scripts/nsdk_cli/nsdk_bench.py --appcfg $APPCFG --hwcfg $HWCFG --parallel="-j" --logdir $LOGDIR --make_options "STDCLIB=$STDCLIB DOWNLOAD=$DOWNLOAD ARCH_EXT=${ARCH_EXT}"
  126. sdk_gen_benchmark:
  127. <<: *job_template_default
  128. stage: check
  129. script:
  130. - export LOGROOT=gen
  131. - export RUNTARGET=
  132. - export SDK_COPY_OBJECTS="elf,map,dump"
  133. - RUNMODE= bash tools/scripts/misc/dobench/dobench.sh $LOGROOT/default
  134. - bash tools/scripts/misc/build_benchmark.sh
  135. artifacts:
  136. when: always
  137. name: "n100_sdk_benchmark-job${CI_JOB_ID}-${CI_COMMIT_SHA::8}"
  138. paths:
  139. - gen
  140. expire_in: 2 day
  141. # Job used to check all the npk.yml in this folder
  142. sdk_check_npk:
  143. <<: *job_template_default
  144. stage: check
  145. script:
  146. - echo "Validate and check npk.yml in this folder"
  147. - python3 tools/scripts/nsdk_cli/check_npk.py -d .
  148. - echo "npk.yml in this folder all PASS"
  149. # Job used to check all the json or yaml config files in this folder
  150. sdk_check_configfiles:
  151. <<: *job_template_default
  152. stage: check
  153. script:
  154. - echo "Validate and check config files in this folder"
  155. - python3 tools/scripts/nsdk_cli/check_cfgfiles.py -d .
  156. - echo "config files in this folder all PASS"
  157. run_evalsoc:
  158. <<: *job_template_default
  159. stage: build
  160. variables:
  161. APPCFG: tools/scripts/nsdk_cli/configs/application.json
  162. HWCFG: tools/scripts/nsdk_cli/configs/nuclei_fpga_eval_ci_qemu.json
  163. parallel:
  164. matrix:
  165. - DOWNLOAD: [ "sram" ]
  166. TOOLCHAIN: ["nuclei_gnu", "nuclei_llvm"]
  167. ARCH_EXT: [ "", "_zca_zcb_zcmp_zcmt" ]
  168. STDCLIB: ["newlib_small", "libncrt_small"]
  169. script:
  170. - export LOGDIR=logs/${CI_JOB_NAME_SHORT}/${STDCLIB}_${DOWNLOAD}${ARCH_EXT}
  171. - python3 tools/scripts/nsdk_cli/nsdk_bench.py --appcfg $APPCFG --hwcfg $HWCFG --parallel="-j" --logdir $LOGDIR --make_options "TOOLCHAIN=$TOOLCHAIN STDCLIB=$STDCLIB DOWNLOAD=$DOWNLOAD ARCH_EXT=${ARCH_EXT}" --run --run_target qemu
  172. run_evalsoc_zcc:
  173. inherit:
  174. default: false
  175. interruptible: true
  176. # workaround for zcc
  177. allow_failure: true
  178. stage: build
  179. tags:
  180. - env::shell
  181. - net::outside
  182. - host::whss1
  183. timeout: 5h
  184. variables:
  185. APPCFG: tools/scripts/nsdk_cli/configs/application.json
  186. HWCFG: tools/scripts/nsdk_cli/configs/nuclei_fpga_eval_ci_qemu.json
  187. parallel:
  188. matrix:
  189. - DOWNLOAD: [ "sram" ]
  190. TOOLCHAIN: ["nuclei_gnu", "nuclei_llvm"]
  191. ARCH_EXT: [ "", "_zca_zcb_zcmp_zcmt" ]
  192. STDCLIB: ["newlib_small"]
  193. script:
  194. - rm -rf logs
  195. - source /home/share/devtools/env.sh
  196. - activate_swdev
  197. - export LOGDIR=logs/${CI_JOB_NAME_SHORT}/${STDCLIB}_${DOWNLOAD}${ARCH_EXT}
  198. - export TOOLCHAIN=terapines
  199. - python3 tools/scripts/nsdk_cli/nsdk_bench.py --appcfg $APPCFG --hwcfg $HWCFG --parallel="-j" --logdir $LOGDIR --make_options "TOOLCHAIN=$TOOLCHAIN STDCLIB=$STDCLIB DOWNLOAD=$DOWNLOAD ARCH_EXT=${ARCH_EXT}" --run --run_target qemu
  200. artifacts:
  201. when: always
  202. name: "100_nsdkcli_logs-job${CI_JOB_ID}-${CI_COMMIT_SHA::8}"
  203. paths:
  204. - logs
  205. expire_in: 2 day