build_wamrc.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. name: build wamrc
  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. llvm_cache_key:
  13. description: the cache key of llvm libraries
  14. type: string
  15. required: true
  16. release:
  17. description: it is a part of the release process
  18. type: boolean
  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. jobs:
  33. build:
  34. runs-on: ${{ inputs.runner }}
  35. steps:
  36. - uses: actions/checkout@v3
  37. - name: get cached LLVM libraries
  38. id: cache_llvm
  39. uses: actions/cache@v3
  40. with:
  41. path: |
  42. ./core/deps/llvm/build/bin
  43. ./core/deps/llvm/build/include
  44. ./core/deps/llvm/build/lib
  45. ./core/deps/llvm/build/libexec
  46. ./core/deps/llvm/build/share
  47. key: ${{ inputs.llvm_cache_key }}
  48. - name: Build llvm and clang from source
  49. if: steps.cache_llvm.outputs.cache-hit != 'true'
  50. run: /usr/bin/env python3 ./build_llvm.py --arch X86
  51. working-directory: build-scripts
  52. - name: generate wamrc binary release
  53. run: |
  54. cmake -S . -B build
  55. cmake --build build --config Release --parallel 4
  56. working-directory: wamr-compiler
  57. - name: compress the binary
  58. if: inputs.release
  59. run: |
  60. tar czf wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamrc
  61. zip wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip wamrc
  62. working-directory: wamr-compiler/build
  63. - name: upload release tar.gz
  64. if: inputs.release
  65. uses: actions/upload-release-asset@v1
  66. env:
  67. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  68. with:
  69. upload_url: ${{ inputs.upload_url }}
  70. asset_path: wamr-compiler/build/wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz
  71. asset_name: wamrc-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz
  72. asset_content_type: application/x-gzip
  73. - name: upload release zip
  74. if: inputs.release
  75. uses: actions/upload-release-asset@v1
  76. env:
  77. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  78. with:
  79. upload_url: ${{ inputs.upload_url }}
  80. asset_path: wamr-compiler/build/wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
  81. asset_name: wamrc-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip
  82. asset_content_type: application/zip