summaryrefslogtreecommitdiffstats
path: root/.github/workflows
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2024-09-27 16:26:24 -0700
committerGitHub <noreply@github.com>2024-09-27 16:26:24 -0700
commitf667593e77e18521b7f3bf4f339c2549b5e5eb1b (patch)
tree30abf45834ed873f14728c2458ec09bb6a48eb4f /.github/workflows
parent23216388d1e2a1baa313a1811974de022c552476 (diff)
Add CI step to build WebAssembly version of Slang (#5164)
Closes #5117 This adds a build step of WebAssembly version of Slang. Currently it is enabled only for Linux/Release to reduce the time cost of CI, but the builds were all successful on all platforms and configurations when tested.
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/ci.yml59
1 files changed, 40 insertions, 19 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e4d9fb06b..162998102 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -25,12 +25,15 @@ jobs:
os: [linux, macos, windows]
config: [debug, release]
compiler: [gcc, clang, cl]
- platform: [x86_64, aarch64]
+ platform: [x86_64, aarch64, wasm]
exclude:
# Default to x64, but aarch64 on osx
- { os: linux, platform: aarch64 }
- { os: windows, platform: aarch64 }
- { os: macos, platform: x86_64 }
+ - { os: linux, config: debug, platform: wasm }
+ - { os: windows, platform: wasm }
+ - { os: macos, platform: wasm }
# Unused compiler configs
- { os: linux, compiler: clang }
- { os: linux, compiler: cl }
@@ -96,26 +99,44 @@ jobs:
build-llvm: true
- name: Build Slang
run: |
- if [[ "${{ matrix.os }}" =~ "windows" && "${{ matrix.config }}" != "release" ]]; then
- # Doing a debug build will try to link against a release built llvm, this
- # is a problem on Windows, so make slang-llvm in release build and use
- # that as though it's a fetched binary via these presets.
- cmake --workflow --preset slang-llvm
- # Configure, pointing to our just-generated slang-llvm archive
- cmake --preset default --fresh \
- -DSLANG_SLANG_LLVM_FLAVOR=FETCH_BINARY \
- "-DSLANG_SLANG_LLVM_BINARY_URL=$(pwd)/build/dist-release/slang-llvm.zip" \
- "-DCMAKE_COMPILE_WARNING_AS_ERROR=${{matrix.warnings-as-errors}}"
- cmake --workflow --preset "${{matrix.config}}"
+ if [[ "${{ matrix.platform }}" = "wasm" ]]; then
+ git clone https://github.com/emscripten-core/emsdk.git
+ pushd emsdk
+ ./emsdk install latest
+ ./emsdk activate latest
+ source ./emsdk_env.sh
+ popd
+ cmake --workflow --preset generators --fresh
+ mkdir generators
+ cmake --install build --prefix generators --component generators
+ emcmake cmake -DSLANG_GENERATORS_PATH=generators/bin --preset emscripten -G "Ninja"
+ cmake --build --preset emscripten --target slang
+ [ -f "build.em/Release/lib/libslang.a" ]
+ [ -f "build.em/Release/lib/libcompiler-core.a" ]
+ [ -f "build.em/Release/lib/libcore.a" ]
else
- # Otherwise, use the system llvm we have just build or got from the
- # cache in the setup phase
- cmake --preset default --fresh \
- -DSLANG_SLANG_LLVM_FLAVOR=USE_SYSTEM_LLVM \
- -DCMAKE_COMPILE_WARNING_AS_ERROR=${{matrix.warnings-as-errors}}
- cmake --workflow --preset "${{matrix.config}}"
+ if [[ "${{ matrix.os }}" =~ "windows" && "${{ matrix.config }}" != "release" ]]; then
+ # Doing a debug build will try to link against a release built llvm, this
+ # is a problem on Windows, so make slang-llvm in release build and use
+ # that as though it's a fetched binary via these presets.
+ cmake --workflow --preset slang-llvm
+ # Configure, pointing to our just-generated slang-llvm archive
+ cmake --preset default --fresh \
+ -DSLANG_SLANG_LLVM_FLAVOR=FETCH_BINARY \
+ "-DSLANG_SLANG_LLVM_BINARY_URL=$(pwd)/build/dist-release/slang-llvm.zip" \
+ "-DCMAKE_COMPILE_WARNING_AS_ERROR=${{matrix.warnings-as-errors}}"
+ cmake --workflow --preset "${{matrix.config}}"
+ else
+ # Otherwise, use the system llvm we have just build or got from the
+ # cache in the setup phase
+ cmake --preset default --fresh \
+ -DSLANG_SLANG_LLVM_FLAVOR=USE_SYSTEM_LLVM \
+ -DCMAKE_COMPILE_WARNING_AS_ERROR=${{matrix.warnings-as-errors}}
+ cmake --workflow --preset "${{matrix.config}}"
+ fi
fi
- name: Test Slang
+ if: ${{ matrix.platform != 'wasm' }}
run: |
export SLANG_RUN_SPIRV_VALIDATION=1
export SLANG_USE_SPV_SOURCE_LANGUAGE_UNKNOWN=1
@@ -140,7 +161,7 @@ jobs:
-expected-failure-list tests/expected-failure-record-replay-tests.txt
fi
- name: Test Slang via glsl
- if: ${{matrix.full-gpu-tests}}
+ if: ${{ matrix.full-gpu-tests && matrix.platform != 'wasm' }}
run: |
export SLANG_RUN_SPIRV_VALIDATION=1
export SLANG_USE_SPV_SOURCE_LANGUAGE_UNKNOWN=1