build_wamrc.yml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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: retrieve_llvm_libs
  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: Quit if cache miss
  49. if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  50. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  51. - name: generate wamrc binary release
  52. run: |
  53. cmake -S . -B build
  54. cmake --build build --config Release --parallel 4
  55. working-directory: wamr-compiler
  56. - name: compress the binary
  57. if: inputs.release
  58. run: |
  59. tar czf wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamrc
  60. zip wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip wamrc
  61. working-directory: wamr-compiler/build
  62. - name: upload release tar.gz
  63. if: inputs.release
  64. uses: actions/upload-release-asset@v1
  65. env:
  66. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  67. with:
  68. upload_url: ${{ inputs.upload_url }}
  69. asset_path: wamr-compiler/build/wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz
  70. asset_name: wamrc-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz
  71. asset_content_type: application/x-gzip
  72. - name: upload release zip
  73. if: inputs.release
  74. uses: actions/upload-release-asset@v1
  75. env:
  76. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  77. with:
  78. upload_url: ${{ inputs.upload_url }}
  79. asset_path: wamr-compiler/build/wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
  80. asset_name: wamrc-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip
  81. asset_content_type: application/zip