build_sdk.yaml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. name: Build SDK
  2. concurrency:
  3. group: ${{ github.workflow }}-${{ github.ref }}
  4. cancel-in-progress: true
  5. on:
  6. push:
  7. paths:
  8. - "Build/**"
  9. - "application/**"
  10. - "NMSIS/**"
  11. - "OS/**"
  12. - "SoC/**"
  13. - "test/**"
  14. - ".github/**"
  15. - ".ci/**"
  16. - "tools/**"
  17. pull_request:
  18. paths:
  19. - "Build/**"
  20. - "application/**"
  21. - "NMSIS/**"
  22. - "OS/**"
  23. - "SoC/**"
  24. - "test/**"
  25. - ".github/**"
  26. - ".ci/**"
  27. - "tools/**"
  28. jobs:
  29. build:
  30. name: Build SDK
  31. runs-on: ${{ matrix.os }}
  32. strategy:
  33. matrix:
  34. os: [ubuntu-20.04]
  35. soc: [evalsoc, gd32vf103]
  36. steps:
  37. - uses: actions/checkout@v3
  38. with:
  39. submodules: recursive
  40. fetch-depth: 0
  41. - name: Caching tools
  42. uses: actions/cache@v3
  43. with:
  44. path: |
  45. prebuilt_tools/*.tar.bz2
  46. prebuilt_tools/*.zip
  47. prebuilt_tools/*.tar.gz
  48. key: build
  49. - name: Prepare Tools for Ubuntu
  50. if: startsWith(matrix.os, 'ubuntu')
  51. run: |
  52. sudo apt-get -q update
  53. sudo apt install -yq python3 python3-pip unzip libz-dev libssl-dev libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev libncursesw5-dev libncursesw5 libgmp-dev libmpfr-dev libmpc-dev
  54. sudo python3 -m pip install -q --upgrade pip
  55. # install to user local storage
  56. # ERROR: Cannot uninstall 'pyserial'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
  57. pip3 install -q -r tools/scripts/requirements.txt
  58. mkdir -p prebuilt_tools
  59. cd prebuilt_tools
  60. echo "Prepare Nuclei Toolchain......"
  61. toolzip=nuclei_riscv_newlibc_prebuilt_linux64_2024.06.tar.bz2
  62. if [ ! -e $toolzip ] ; then
  63. echo "Download Nuclei toolchain now!"
  64. wget --progress=dot:giga --no-check-certificate https://www.nucleisys.com/upload/files/toochain/gcc/$toolzip
  65. ls -lh $toolzip
  66. md5sum $toolzip
  67. fi
  68. tar -xjf $toolzip
  69. echo "Prepare Nuclei QEMU......"
  70. toolzip=nuclei-qemu-2024.06-linux-x64.tar.gz
  71. if [ ! -e $toolzip ] ; then
  72. echo "Download Nuclei qemu now!"
  73. wget --progress=dot:giga --no-check-certificate https://www.nucleisys.com/upload/files/toochain/qemu/$toolzip
  74. ls -lh $toolzip
  75. md5sum $toolzip
  76. fi
  77. tar -xzf $toolzip
  78. if [ -d linux_qemu ] ; then
  79. mv linux_qemu qemu
  80. fi
  81. echo "Check gcc and qemu version"
  82. ldd ./qemu/bin/qemu-system-riscv32
  83. ./qemu/bin/qemu-system-riscv32 --version
  84. ./gcc/bin/riscv64-unknown-elf-gcc -v
  85. cd ..
  86. echo "NUCLEI_TOOL_ROOT=$(pwd)/prebuilt_tools" > setup_config.sh
  87. - name: Build and Run SDK for Nuclei Eval SoC
  88. if: matrix.soc == 'evalsoc'
  89. run: |
  90. echo "Setup build environment"
  91. source setup.sh
  92. export APPCFG=tools/scripts/nsdk_cli/configs/application.json
  93. for hwcfg in "nuclei_fpga_eval_ci_qemu_small_gnu" "nuclei_fpga_eval_ci_qemu_small_llvm" ; do
  94. export HWCFG=tools/scripts/nsdk_cli/configs/${hwcfg}.json
  95. export LOGDIR=logs/${hwcfg}
  96. echo "Build and run for ${hwcfg}"
  97. python3 tools/scripts/nsdk_cli/nsdk_bench.py --appcfg $APPCFG --hwcfg $HWCFG --parallel="-j" --logdir $LOGDIR --run_target qemu --run
  98. done
  99. - name: Build SDK for GD32VF103 SoC
  100. if: matrix.soc == 'gd32vf103'
  101. run: |
  102. echo "Setup build environment"
  103. source setup.sh
  104. export APPCFG=tools/scripts/nsdk_cli/configs/application.json
  105. export HWCFG=tools/scripts/nsdk_cli/configs/gd32vf103v_rvstar.json
  106. export LOGDIR=logs/gd32vf103v_rvstar
  107. python3 tools/scripts/nsdk_cli/nsdk_bench.py --appcfg $APPCFG --hwcfg $HWCFG --parallel="-j" --logdir $LOGDIR
  108. - name: Upload Build Log for ${{ matrix.soc }}
  109. uses: actions/upload-artifact@v3
  110. with:
  111. name: build_${{ matrix.soc }}
  112. path: |
  113. logs/*