build_wamrc.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. permissions:
  33. contents: read
  34. jobs:
  35. build:
  36. runs-on: ${{ inputs.runner }}
  37. permissions:
  38. contents: write # for uploading release artifacts
  39. steps:
  40. - uses: actions/checkout@v4
  41. - name: get cached LLVM libraries
  42. id: retrieve_llvm_libs
  43. uses: actions/cache@v4
  44. with:
  45. path: |
  46. ./core/deps/llvm/build/bin
  47. ./core/deps/llvm/build/include
  48. ./core/deps/llvm/build/lib
  49. ./core/deps/llvm/build/libexec
  50. ./core/deps/llvm/build/share
  51. key: ${{ inputs.llvm_cache_key }}
  52. fail-on-cache-miss: true
  53. - name: generate wamrc binary release
  54. run: |
  55. cmake -S . -B build
  56. cmake --build build --config Release --parallel 4
  57. working-directory: wamr-compiler
  58. - name: Compress the binary on Windows
  59. if: inputs.runner == 'windows-latest' && inputs.release
  60. run: |
  61. tar -czf wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamrc.exe
  62. Compress-Archive -Path wamrc.exe -DestinationPath wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
  63. mv wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.* ../
  64. working-directory: wamr-compiler/build/Release
  65. - name: compress the binary on non-Windows
  66. if: inputs.runner != 'windows-latest' && inputs.release
  67. run: |
  68. tar czf wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamrc
  69. zip wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip wamrc
  70. working-directory: wamr-compiler/build
  71. - name: upload release tar.gz
  72. if: inputs.release
  73. uses: actions/upload-release-asset@v1
  74. env:
  75. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  76. with:
  77. upload_url: ${{ inputs.upload_url }}
  78. asset_path: wamr-compiler/build/wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz
  79. asset_name: wamrc-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz
  80. asset_content_type: application/x-gzip
  81. - name: upload release zip
  82. if: inputs.release
  83. uses: actions/upload-release-asset@v1
  84. env:
  85. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  86. with:
  87. upload_url: ${{ inputs.upload_url }}
  88. asset_path: wamr-compiler/build/wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
  89. asset_name: wamrc-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip
  90. asset_content_type: application/zip