build_wamrc.yml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. fail-on-cache-miss: true
  49. - name: generate wamrc binary release
  50. run: |
  51. cmake -S . -B build
  52. cmake --build build --config Release --parallel 4
  53. working-directory: wamr-compiler
  54. - name: compress the binary
  55. if: inputs.release
  56. run: |
  57. tar czf wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamrc
  58. zip wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip wamrc
  59. working-directory: wamr-compiler/build
  60. - name: upload release tar.gz
  61. if: inputs.release
  62. uses: actions/upload-release-asset@v1
  63. env:
  64. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  65. with:
  66. upload_url: ${{ inputs.upload_url }}
  67. asset_path: wamr-compiler/build/wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz
  68. asset_name: wamrc-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz
  69. asset_content_type: application/x-gzip
  70. - name: upload release zip
  71. if: inputs.release
  72. uses: actions/upload-release-asset@v1
  73. env:
  74. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  75. with:
  76. upload_url: ${{ inputs.upload_url }}
  77. asset_path: wamr-compiler/build/wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
  78. asset_name: wamrc-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip
  79. asset_content_type: application/zip