compilation_on_zephyr.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. name: compilation on zephyr
  4. on:
  5. # will be triggered on PR events
  6. pull_request:
  7. types:
  8. - opened
  9. - synchronize
  10. paths:
  11. - ".github/workflows/compilation_on_zephyr.yml"
  12. - "build-scripts/**"
  13. - "core/**"
  14. - "!core/deps/**"
  15. - "product-mini/platforms/common/**"
  16. - "product-mini/platforms/zephyr/**"
  17. - "samples/**"
  18. - "!samples/workload/**"
  19. - "tests/wamr-test-suites/**"
  20. - "wamr-compiler/**"
  21. # will be triggered on push events
  22. push:
  23. branches:
  24. - main
  25. - "dev/**"
  26. paths:
  27. - ".github/workflows/compilation_on_zephyr.yml"
  28. - "build-scripts/**"
  29. - "core/**"
  30. - "!core/deps/**"
  31. - "product-mini/platforms/common/**"
  32. - "product-mini/platforms/zephyr/**"
  33. - "samples/**"
  34. - "!samples/workload/**"
  35. - "tests/wamr-test-suites/**"
  36. - "wamr-compiler/**"
  37. # allow to be triggered manually
  38. workflow_dispatch:
  39. # Cancel any in-flight jobs for the same PR/branch so there's only one active
  40. # at a time
  41. concurrency:
  42. group: ${{ github.workflow }}-${{ github.ref }}
  43. cancel-in-progress: true
  44. env:
  45. # FOR SETUP
  46. ZEPHYR_SDK_VERSION: "0.16.9"
  47. ZEPHYR_VERSION: "v3.7.0"
  48. # FOR BUILD
  49. permissions:
  50. contents: read
  51. jobs:
  52. smoke_test:
  53. runs-on: ubuntu-22.04
  54. container:
  55. # For Zephyr 3.7 LTS, use the v0.26-branch or the latest v0.26.x release Docker image.
  56. # ci require a larger runner to avoid "no space left on device"
  57. image: ghcr.io/zephyrproject-rtos/ci-base:v0.26-branch
  58. options: --user root
  59. steps:
  60. # https://docs.zephyrproject.org/latest/develop/application/index.html#zephyr-workspace-application
  61. # zephyrproject/ --> CI ROOT
  62. # ├─── .west/
  63. # │ └─── config
  64. # ├─── bootloader/
  65. # ├─── zephyr/ --> Zephyr source code
  66. # ├─── zephyr-sdk/
  67. # ├─── modules/
  68. # │ |─── wasm-micro-runtime --> WAMR source code
  69. # ├─── tools/
  70. # ├─── vendor/
  71. # └─── application/ --> DUMMY. keep west_lite.yml here
  72. - name: Checkout code
  73. uses: actions/checkout@v6
  74. with:
  75. path: modules/wasm-micro-runtime
  76. - name: Prepare Zephyr environment
  77. shell: bash
  78. run: |
  79. mkdir -p application
  80. cp modules/wasm-micro-runtime/product-mini/platforms/zephyr/simple/west_lite.yml application/west_lite.yml
  81. - name: Setup Zephyr project
  82. uses: zephyrproject-rtos/action-zephyr-setup@v1
  83. with:
  84. app-path: application
  85. manifest-file-name: west_lite.yml
  86. sdk-version: ${{ env.ZEPHYR_SDK_VERSION }}
  87. toolchains: arc-zephyr-elf:arc64-zephyr-elf
  88. - name: Build a sample application(simple)
  89. shell: bash
  90. run: |
  91. pushd product-mini/platforms/zephyr/simple
  92. west build . -b qemu_arc/qemu_arc_hs -p always -- -DWAMR_BUILD_TARGET=ARC
  93. popd
  94. # west build -t run will fork several processes, which will cause the job to hang.
  95. # run in the background and kill it after 5 seconds
  96. .github/scripts/run_qemu_arc.sh \
  97. ../../zephyr-sdk \
  98. product-mini/platforms/zephyr/simple/build/zephyr/zephyr.elf &
  99. sleep 5
  100. pkill qemu-system-arc
  101. working-directory: modules/wasm-micro-runtime
  102. - name: Build a sample application(user-mode)
  103. shell: bash
  104. run: |
  105. pushd product-mini/platforms/zephyr/user-mode
  106. west build . -b qemu_arc/qemu_arc_hs -p always -- -DWAMR_BUILD_TARGET=ARC
  107. popd
  108. # west build -t run will fork several processes, which will cause the job to hang.
  109. # run in the background and kill it after 5 seconds
  110. .github/scripts/run_qemu_arc.sh \
  111. ../../zephyr-sdk \
  112. product-mini/platforms/zephyr/user-mode/build/zephyr/zephyr.elf &
  113. sleep 5
  114. pkill qemu-system-arc
  115. working-directory: modules/wasm-micro-runtime