compilation_on_zephyr.yml 4.1 KB

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