Feature/split test from ci yaml #270
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [master] | |
paths-ignore: | |
- 'docs/**' | |
- 'LICENCE' | |
- 'CONTRIBUTION.md' | |
- 'README.md' | |
pull_request: | |
branches: [master] | |
paths-ignore: | |
- 'docs/**' | |
- 'LICENCE' | |
- 'CONTRIBUTION.md' | |
- 'README.md' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v3 | |
- id: set-matrix | |
run: echo "matrix=$(cat .github/workflow/matrix.json | jq -c .)" >> $GITHUB_OUTPUT | |
build: | |
needs: setup | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.setup.outputs.matrix) }} | |
runs-on: ${{ matrix.runs-on }} | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
fetch-depth: '0' | |
- name: Setup | |
uses: ./.github/actions/common-setup | |
with: | |
os: ${{matrix.os}} | |
compiler: ${{matrix.compiler}} | |
platform: ${{matrix.platform}} | |
config: ${{matrix.config}} | |
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}}" | |
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 | |
- name: Generate testing commands | |
run: | | |
echo "export SLANG_RUN_SPIRV_VALIDATION=1" > build/test-slang.sh | |
echo "export SLANG_USE_SPV_SOURCE_LANGUAGE_UNKNOWN=1" >> build/test-slang.sh | |
cp build/test-slang.sh build/test-slang-via-glsl.sh | |
if [[ "${{matrix.full-gpu-tests}}" == "true" ]]; then | |
echo "\"$bin_dir/slang-test\" | |
-use-test-server | |
-server-count 8 | |
-category ${{ matrix.test-category }} | |
-api all-cpu" >> build/test-slang.sh | |
echo "\"$bin_dir/slang-test\" | |
-use-test-server | |
-server-count 8 | |
-category ${{ matrix.test-category }} | |
-emit-spirv-via-glsl | |
-api vk | |
-expected-failure-list tests/expected-failure.txt" >> build/test-slang-via-glsl.sh | |
elif [[ "${{matrix.has-gpu}}" == "true" ]]; then | |
echo "\"$bin_dir/slang-test\" | |
-use-test-server | |
-category ${{ matrix.test-category }} | |
-api all-dx12 | |
-expected-failure-list tests/expected-failure-github.txt" >> build/test-slang.sh | |
else | |
echo "\"$bin_dir/slang-test\" | |
-use-test-server | |
-category ${{ matrix.test-category }} | |
-api all-dx12 | |
-expected-failure-list tests/expected-failure-github.txt | |
-expected-failure-list tests/expected-failure-record-replay-tests.txt" >> build/test-slang.sh | |
fi | |
- name: Upload Slang executables | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-slang-${{matrix.os}}-${{matrix.platform}}-${{matrix.compiler}}-${{matrix.config}} | |
path: | | |
build/*/bin | |
build/test-slang.sh | |
build/test-slang-via-glsl.sh | |
- name: Upload slang-LLVM | |
uses: actions/upload-artifact@v4 | |
if: ${{ ! matrix.full-gpu-tests }} | |
with: | |
name: slang-build-${{matrix.os}}-${{matrix.platform}}-${{matrix.compiler}}-${{matrix.config}} | |
# The install directory used in the packaging step | |
path: build/dist-${{matrix.config}}/**/ZIP/slang/* | |
test: | |
needs: [setup, build] | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.setup.outputs.matrix) }} | |
runs-on: ${{ matrix.runs-on }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
fetch-depth: '0' | |
- name: Setup | |
uses: ./.github/actions/common-setup | |
with: | |
os: ${{matrix.os}} | |
compiler: ${{matrix.compiler}} | |
platform: ${{matrix.platform}} | |
config: ${{matrix.config}} | |
build-llvm: true | |
- name: Download Slang executables | |
uses: actions/download-artifact@v4 | |
with: | |
name: test-slang-${{matrix.os}}-${{matrix.platform}}-${{matrix.compiler}}-${{matrix.config}} | |
path: | | |
build/*/bin | |
build/test-slang.sh | |
build/test-slang-via-glsl.sh | |
- name: Test Slang | |
run: | | |
. build/test-slang.sh | |
- name: Test Slang via GLSL | |
run: | | |
. build/test-slang-via-glsl.sh | |