build_iwasm_release.yml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. name: build iwasm release
  4. on:
  5. workflow_call:
  6. inputs:
  7. arch:
  8. description: arch of the release
  9. type: string
  10. required: false
  11. default: x86_64
  12. cwd:
  13. description: working directory
  14. type: string
  15. required: true
  16. llvm_cache_key:
  17. description: the cache key of llvm libraries
  18. type: string
  19. required: true
  20. runner:
  21. description: OS of compilation
  22. type: string
  23. required: true
  24. upload_url:
  25. description: a semantic version number. it is required when `release` is true.
  26. type: string
  27. required: false
  28. ver_num:
  29. description: a semantic version number. it is required when `release` is true.
  30. type: string
  31. required: false
  32. env:
  33. DEFAULT_BUILD_OPTIONS:
  34. "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 \
  35. -DWAMR_BUILD_CUSTOM_NAME_SECTION=0 \
  36. -DWAMR_BUILD_DEBUG_INTERP=0 \
  37. -DWAMR_BUILD_DEBUG_AOT=0 \
  38. -DWAMR_BUILD_DUMP_CALL_STACK=0 \
  39. -DWAMR_BUILD_LIBC_UVWASI=0 \
  40. -DWAMR_BUILD_LIBC_EMCC=0 \
  41. -DWAMR_BUILD_LIB_RATS=0 \
  42. -DWAMR_BUILD_LOAD_CUSTOM_SECTION=0 \
  43. -DWAMR_BUILD_MEMORY_PROFILING=0 \
  44. -DWAMR_BUILD_MINI_LOADER=0 \
  45. -DWAMR_BUILD_MULTI_MODULE=0 \
  46. -DWAMR_BUILD_PERF_PROFILING=0 \
  47. -DWAMR_BUILD_SPEC_TEST=0 \
  48. -DWAMR_BUILD_BULK_MEMORY=1 \
  49. -DWAMR_BUILD_LIB_PTHREAD=1 \
  50. -DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \
  51. -DWAMR_BUILD_LIB_WASI_THREADS=1 \
  52. -DWAMR_BUILD_LIBC_BUILTIN=1 \
  53. -DWAMR_BUILD_LIBC_WASI=1 \
  54. -DWAMR_BUILD_REF_TYPES=1 \
  55. -DWAMR_BUILD_SIMD=1 \
  56. -DWAMR_BUILD_SHARED_MEMORY=1 \
  57. -DWAMR_BUILD_TAIL_CALL=1 \
  58. -DWAMR_BUILD_THREAD_MGR=1"
  59. GC_EH_BUILD_OPTIONS:
  60. "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 \
  61. -DWAMR_BUILD_CUSTOM_NAME_SECTION=0 \
  62. -DWAMR_BUILD_DEBUG_INTERP=0 \
  63. -DWAMR_BUILD_DEBUG_AOT=0 \
  64. -DWAMR_BUILD_DUMP_CALL_STACK=0 \
  65. -DWAMR_BUILD_LIBC_UVWASI=0 \
  66. -DWAMR_BUILD_LIBC_EMCC=0 \
  67. -DWAMR_BUILD_LIB_RATS=0 \
  68. -DWAMR_BUILD_LOAD_CUSTOM_SECTION=0 \
  69. -DWAMR_BUILD_MEMORY_PROFILING=0 \
  70. -DWAMR_BUILD_MINI_LOADER=0 \
  71. -DWAMR_BUILD_MULTI_MODULE=0 \
  72. -DWAMR_BUILD_PERF_PROFILING=0 \
  73. -DWAMR_BUILD_SPEC_TEST=0 \
  74. -DWAMR_BUILD_BULK_MEMORY=1 \
  75. -DWAMR_BUILD_LIB_PTHREAD=1 \
  76. -DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \
  77. -DWAMR_BUILD_LIB_WASI_THREADS=1 \
  78. -DWAMR_BUILD_LIBC_BUILTIN=1 \
  79. -DWAMR_BUILD_LIBC_WASI=1 \
  80. -DWAMR_BUILD_REF_TYPES=1 \
  81. -DWAMR_BUILD_SIMD=1 \
  82. -DWAMR_BUILD_SHARED_MEMORY=1 \
  83. -DWAMR_BUILD_TAIL_CALL=1 \
  84. -DWAMR_BUILD_THREAD_MGR=1 \
  85. -DWAMR_BUILD_EXCE_HANDLING=1 \
  86. -DWAMR_BUILD_GC=1"
  87. permissions:
  88. contents: read
  89. jobs:
  90. build:
  91. runs-on: ${{ inputs.runner }}
  92. strategy:
  93. matrix:
  94. include:
  95. - build_options: $DEFAULT_BUILD_OPTIONS
  96. suffix: ''
  97. - build_options: $GC_EH_BUILD_OPTIONS
  98. suffix: '-gc-eh'
  99. permissions:
  100. contents: write # for uploading release artifacts
  101. steps:
  102. - uses: actions/checkout@v4
  103. - name: get cached LLVM libraries
  104. id: retrieve_llvm_libs
  105. uses: actions/cache@v4
  106. with:
  107. path: |
  108. ./core/deps/llvm/build/bin
  109. ./core/deps/llvm/build/include
  110. ./core/deps/llvm/build/lib
  111. ./core/deps/llvm/build/libexec
  112. ./core/deps/llvm/build/share
  113. key: ${{ inputs.llvm_cache_key }}
  114. fail-on-cache-miss: true
  115. - name: generate iwasm binary release
  116. shell: bash
  117. run: |
  118. cmake -S . -B build ${{ matrix.build_options }}
  119. cmake --build build --config Release --parallel 4
  120. working-directory: ${{ inputs.cwd }}
  121. - name: Compress the binary on Windows
  122. if: inputs.runner == 'windows-latest'
  123. run: |
  124. tar -czf iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz iwasm.exe
  125. Compress-Archive -Path iwasm.exe -DestinationPath iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
  126. mv iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.* ../
  127. working-directory: ${{ inputs.cwd }}/build/Release
  128. - name: compress the binary on non-Windows
  129. if: inputs.runner != 'windows-latest'
  130. run: |
  131. tar czf iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz iwasm
  132. zip iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.zip iwasm
  133. working-directory: ${{ inputs.cwd }}/build
  134. - name: upload release tar.gz
  135. uses: actions/upload-release-asset@v1
  136. env:
  137. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  138. with:
  139. upload_url: ${{ inputs.upload_url }}
  140. asset_path: ${{ inputs.cwd }}/build/iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz
  141. asset_name: iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz
  142. asset_content_type: application/x-gzip
  143. - name: upload release zip
  144. uses: actions/upload-release-asset@v1
  145. env:
  146. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  147. with:
  148. upload_url: ${{ inputs.upload_url }}
  149. asset_path: ${{ inputs.cwd }}/build/iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
  150. asset_name: iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip
  151. asset_content_type: application/zip