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