Skip to content

[Docker] Ubuntu: Refine for caching #1

[Docker] Ubuntu: Refine for caching

[Docker] Ubuntu: Refine for caching #1

name: Test Wasi Testsuite
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
paths:
- ".github/workflows/wasi-testsuite.yml"
- "lib/host/wasi/**"
- "include/host/wasi/**"
- "thirdparty/wasi/**"
pull_request:
branches:
- master
paths:
- ".github/workflows/wasi-testsuite.yml"
- "lib/host/wasi/**"
- "include/host/wasi/**"
- "thirdparty/wasi/**"
permissions:
contents: read
jobs:
test:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
path: WasmEdge
- name: Ensure git safe directory
run: |
git config --global --add safe.directory $(pwd)
- name: Build WasmEdge on Ubuntu
if: matrix.os == 'ubuntu-latest'
working-directory: WasmEdge
run: |
sudo apt install -y software-properties-common cmake clang ninja-build
cmake -Bbuild -GNinja -DWASMEDGE_USE_LLVM=OFF .
cmake --build build
echo "$GITHUB_WORKSPACE/WasmEdge/build/tools/wasmedge" >> $GITHUB_PATH
- name: Build WasmEdge on macOS
if: matrix.os == 'macos-latest'
working-directory: WasmEdge
run: |
brew install llvm ninja cmake
export LLVM_DIR="/usr/local/opt/llvm/lib/cmake"
export CC=clang
export CXX=clang++
cmake -Bbuild -GNinja -DWASMEDGE_USE_LLVM=OFF .
cmake --build build
echo "$GITHUB_WORKSPACE/WasmEdge/build/tools/wasmedge" >> $GITHUB_PATH
- name: Install dependency on Windows
if: matrix.os == 'windows-2022'
uses: crazy-max/ghaction-chocolatey@v3
with:
args: install cmake ninja
- name: Upgrade dependency on Windows
if: matrix.os == 'windows-2022'
uses: crazy-max/ghaction-chocolatey@v3
with:
args: upgrade llvm
- name: Install Windows SDK
if: matrix.os == 'windows-2022'
uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- name: Build WasmEdge on Windows
if: matrix.os == 'windows-2022'
working-directory: WasmEdge
run: |
$uri = "https://github.com/WasmEdge/llvm-windows/releases/download/llvmorg-17.0.6/LLVM-17.0.6-win64-MultiThreadedDLL.zip"
$llvm = "LLVM-17.0.6-win64-MultiThreadedDLL.zip"
Invoke-WebRequest -Uri "$uri" -HttpVersion 2.0 -OutFile "$llvm"
Expand-Archive -Path $llvm
$Env:CC = "$pwd\\LLVM-17.0.6-win64-MultiThreadedDLL\\LLVM-17.0.6-win64\\bin\\clang-cl.exe"
$Env:CXX = "$pwd\\LLVM-17.0.6-win64-MultiThreadedDLL\\LLVM-17.0.6-win64\\bin\\clang-cl.exe"
$llvm_mt = "$Env:ProgramFiles\\LLVM\\bin\\llvm-mt.exe"
$cmake_sys_version = "10.0.22621.0"
cmake -Bbuild -GNinja "-DCMAKE_SYSTEM_VERSION=$cmake_sys_version" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL -DCMAKE_MT="$llvm_mt" -DWASMEDGE_USE_LLVM=OFF .
cmake --build build
echo "$Env:GITHUB_WORKSPACE\\WasmEdge\\build\\tools\\wasmedge" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
echo "$Env:GITHUB_WORKSPACE\\WasmEdge\\build\\lib\\api" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
- name: Checkout wasi-testsuite
uses: actions/checkout@v4
with:
repository: WebAssembly/wasi-testsuite
ref: prod/testsuite-base
path: wasi-testsuite
- name: Initialize Python environment
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
- name: Install wasi testsuite dependencies
working-directory: wasi-testsuite/test-runner
run: pip install -r requirements.txt
- name: Test Wasi testsuite
working-directory: wasi-testsuite
run: python3 test-runner/wasi_test_runner.py -t ./tests/assemblyscript/testsuite/ ./tests/c/testsuite/ ./tests/rust/testsuite/ -r ../WasmEdge/.github/scripts/wasi-testsuite-adapter.py