compilation_on_windows.yml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. name: compilation on windows-2022
  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_windows.yml"
  12. - "build-scripts/**"
  13. - "core/**"
  14. - "!core/deps/**"
  15. - "product-mini/**"
  16. - "samples/**"
  17. - "!samples/workload/**"
  18. - "tests/wamr-test-suites/**"
  19. - "wamr-compiler/**"
  20. # will be triggered on push events
  21. push:
  22. branches:
  23. - main
  24. - "dev/**"
  25. paths:
  26. - ".github/workflows/compilation_on_windows.yml"
  27. - "build-scripts/**"
  28. - "core/**"
  29. - "!core/deps/**"
  30. - "product-mini/**"
  31. - "samples/**"
  32. - "!samples/workload/**"
  33. - "tests/wamr-test-suites/**"
  34. - "wamr-compiler/**"
  35. # allow to be triggered manually
  36. workflow_dispatch:
  37. env:
  38. # For Spec Test
  39. DEFAULT_TEST_OPTIONS: "-s spec -b"
  40. MULTI_MODULES_TEST_OPTIONS: "-s spec -b -M"
  41. THREADS_TEST_OPTIONS: "-s spec -b -p"
  42. WASI_TEST_OPTIONS: "-s wasi_certification -w"
  43. WASI_TEST_FILTER: ${{ github.workspace }}/product-mini/platforms/windows/wasi_filtered_tests.json
  44. # Used when building the WASI socket and thread tests
  45. CC: ${{ github.workspace }}/wasi-sdk/bin/clang
  46. # Cancel any in-flight jobs for the same PR/branch so there's only one active
  47. # at a time
  48. concurrency:
  49. group: ${{ github.workflow }}-${{ github.ref }}
  50. cancel-in-progress: true
  51. permissions:
  52. contents: read
  53. jobs:
  54. build_llvm_libraries_on_windows:
  55. permissions:
  56. contents: read
  57. actions: write
  58. uses: ./.github/workflows/build_llvm_libraries.yml
  59. with:
  60. os: "windows-2022"
  61. arch: "AArch64 ARM Mips RISCV X86"
  62. build_iwasm:
  63. runs-on: windows-2022
  64. strategy:
  65. matrix:
  66. build_options:
  67. [
  68. "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0",
  69. "-DWAMR_BUILD_AOT=0",
  70. "-DWAMR_BUILD_TAIL_CALL=1",
  71. "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
  72. "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
  73. "-DWAMR_BUILD_REF_TYPES=1",
  74. "-DWAMR_BUILD_DEBUG_INTERP=1",
  75. "-DWAMR_BUILD_LIB_PTHREAD=1",
  76. "-DWAMR_BUILD_LIB_WASI_THREADS=1",
  77. "-DWAMR_BUILD_LIBC_UVWASI=0 -DWAMR_BUILD_LIBC_WASI=1",
  78. ]
  79. steps:
  80. - uses: actions/checkout@v6.0.1
  81. - name: clone uvwasi library
  82. if: ${{ !contains(matrix.build_options, '-DWAMR_BUILD_LIBC_UVWASI=0') }}
  83. run: |
  84. cd core/deps
  85. git clone https://github.com/nodejs/uvwasi.git
  86. - name: Build iwasm
  87. run: |
  88. cd product-mini/platforms/windows
  89. mkdir build && cd build
  90. cmake .. ${{ matrix.build_options }}
  91. cmake --build . --config Release --parallel 4
  92. build_wamrc:
  93. needs: [build_llvm_libraries_on_windows]
  94. runs-on: ${{ matrix.os }}
  95. strategy:
  96. matrix:
  97. include:
  98. - os: windows-2022
  99. llvm_cache_key: ${{ needs.build_llvm_libraries_on_windows.outputs.cache_key }}
  100. steps:
  101. - name: checkout
  102. uses: actions/checkout@v6.0.1
  103. # since jobs.id can't contain the dot character
  104. # it is hard to use `format` to assemble the cache key
  105. - name: Get LLVM libraries
  106. id: retrieve_llvm_libs
  107. uses: actions/cache@v5
  108. with:
  109. path: |
  110. ./core/deps/llvm/build/bin
  111. ./core/deps/llvm/build/include
  112. ./core/deps/llvm/build/lib
  113. ./core/deps/llvm/build/libexec
  114. ./core/deps/llvm/build/share
  115. key: ${{ matrix.llvm_cache_key }}
  116. - name: Quit if cache miss
  117. if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  118. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  119. - name: Build wamrc
  120. run: |
  121. cmake -S . -B build
  122. cmake --build build --config Release --parallel 4
  123. working-directory: wamr-compiler
  124. test:
  125. runs-on: windows-2022
  126. needs: [build_iwasm, build_wamrc]
  127. strategy:
  128. fail-fast: false
  129. matrix:
  130. running_mode: ["classic-interp", "fast-interp"]
  131. test_option:
  132. [
  133. $DEFAULT_TEST_OPTIONS,
  134. $MULTI_MODULES_TEST_OPTIONS,
  135. $THREADS_TEST_OPTIONS,
  136. $WASI_TEST_OPTIONS,
  137. ]
  138. steps:
  139. - name: checkout
  140. uses: actions/checkout@v6.0.1
  141. - name: download and install wasi-sdk
  142. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  143. run: |
  144. curl "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0.m-mingw.tar.gz" -o wasi-sdk.tar.gz -L
  145. mkdir wasi-sdk
  146. tar -xzf wasi-sdk.tar.gz -C wasi-sdk --strip-components 1
  147. - name: build socket api tests
  148. shell: bash
  149. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  150. run: ./build.sh
  151. working-directory: ./core/iwasm/libraries/lib-socket/test/
  152. - name: Build WASI thread tests
  153. shell: bash
  154. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  155. run: ./build.sh
  156. working-directory: ./core/iwasm/libraries/lib-wasi-threads/test/
  157. - name: install wget
  158. shell: bash
  159. run: choco install wget
  160. - name: run tests
  161. shell: bash
  162. timeout-minutes: 20
  163. run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  164. working-directory: ./tests/wamr-test-suites