|
| 1 | +name: Build - Full |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "main" ] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + build_native: |
| 12 | + runs-on: ${{ matrix.config.runner }} |
| 13 | + |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + config: |
| 17 | + - { name: win_x64, runner: windows-latest, os: Windows, arch: x64 } |
| 18 | + - { name: win_arm64, runner: windows-latest, os: Windows, arch: arm64 } |
| 19 | + - { name: linux_x64, runner: ubuntu-22.04, os: Linux, arch: x64 } |
| 20 | + - { name: linux_arm64, runner: ubuntu-22.04, os: Linux, arch: arm64 } |
| 21 | + - { name: mac_x64, runner: macos-latest, os: MacOS, arch: x64 } |
| 22 | + - { name: mac_arm64, runner: macos-latest, os: MacOS, arch: arm64 } |
| 23 | + |
| 24 | + name: Build - ${{ matrix.config.os }} ${{ matrix.config.arch }} |
| 25 | + steps: |
| 26 | + - name: Install MSVC ARM64 Tools (Windows ARM64) |
| 27 | + if: matrix.config.os == 'Windows' && matrix.config.arch == 'arm64' |
| 28 | + uses: ilammy/msvc-dev-cmd@v1 |
| 29 | + with: |
| 30 | + arch: arm64 |
| 31 | + |
| 32 | + - name: Install Dependencies (Linux ARM64) |
| 33 | + if: matrix.config.os == 'Linux' && matrix.config.arch == 'arm64' |
| 34 | + run: | |
| 35 | + sudo apt-get update |
| 36 | + sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu cmake |
| 37 | +
|
| 38 | + - name: Update Submodules |
| 39 | + run: git submodule update --init --recursive |
| 40 | + |
| 41 | + - name: Navigate to Submodule |
| 42 | + run: cd NativeCode |
| 43 | + |
| 44 | + - name: Build (x64) |
| 45 | + if: matrix.config.arch == 'x64' |
| 46 | + run: | |
| 47 | + mkdir build |
| 48 | + cd build |
| 49 | + cmake .. -DCMAKE_BUILD_TYPE=Release |
| 50 | + cmake --build . --config Release |
| 51 | +
|
| 52 | + - name: Build (Windows ARM64) |
| 53 | + if: matrix.config.os == 'Windows' && matrix.config.arch == 'arm64' |
| 54 | + run: | |
| 55 | + mkdir build |
| 56 | + cd build |
| 57 | + cmake .. -DCMAKE_BUILD_TYPE=Release -A ARM64 |
| 58 | + cmake --build . --config Release |
| 59 | +
|
| 60 | + - name: Build (Linux ARM64) |
| 61 | + if: matrix.config.os == 'Linux' && matrix.config.arch == 'arm64' |
| 62 | + run: | |
| 63 | + mkdir build |
| 64 | + cd build |
| 65 | + cmake .. -DCMAKE_SYSTEM_NAME=Linux \ |
| 66 | + -DCMAKE_SYSTEM_PROCESSOR=aarch64 \ |
| 67 | + -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \ |
| 68 | + -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \ |
| 69 | + -DCMAKE_BUILD_TYPE=Release |
| 70 | + cmake --build . --config Release |
| 71 | +
|
| 72 | + - name: Build (macOS ARM64) |
| 73 | + if: matrix.config.os == 'MacOS' && matrix.config.arch == 'arm64' |
| 74 | + run: | |
| 75 | + mkdir build |
| 76 | + cd build |
| 77 | + cmake .. \ |
| 78 | + -DCMAKE_BUILD_TYPE=Release \ |
| 79 | + -DCMAKE_OSX_ARCHITECTURES=arm64 |
| 80 | + cmake --build . --config Release |
| 81 | +
|
| 82 | + - name: List Files |
| 83 | + run: ls -R build |
| 84 | + |
| 85 | + - name: Upload (Windows) |
| 86 | + if: matrix.config.os == 'Windows' |
| 87 | + uses: actions/upload-artifact@v4 |
| 88 | + with: |
| 89 | + name: output_${{ matrix.config.name }} |
| 90 | + path: | |
| 91 | + build/Release/dxil-spirv-c-shared.dll |
| 92 | + if-no-files-found: error |
| 93 | + |
| 94 | + - name: Upload (Linux) |
| 95 | + if: matrix.config.os == 'Linux' |
| 96 | + uses: actions/upload-artifact@v4 |
| 97 | + with: |
| 98 | + name: output_${{ matrix.config.name }} |
| 99 | + path: | |
| 100 | + build/libdxil-spirv-c-shared.so |
| 101 | + if-no-files-found: error |
| 102 | + |
| 103 | + - name: Upload (MacOS) |
| 104 | + if: matrix.config.os == 'MacOS' |
| 105 | + uses: actions/upload-artifact@v4 |
| 106 | + with: |
| 107 | + name: output_${{ matrix.config.name }} |
| 108 | + path: | |
| 109 | + build/libdxil-spirv-c-shared.dylib |
| 110 | + if-no-files-found: error |
| 111 | + |
| 112 | + build_managed: |
| 113 | + |
| 114 | + runs-on: ubuntu-latest |
| 115 | + needs: build_native |
| 116 | + |
| 117 | + steps: |
| 118 | + - uses: actions/checkout@v4 |
| 119 | + - name: Setup .NET |
| 120 | + uses: actions/setup-dotnet@v4 |
| 121 | + with: |
| 122 | + dotnet-version: 9.0.x |
| 123 | + - name: Restore dependencies |
| 124 | + run: dotnet restore |
| 125 | + - name: Build |
| 126 | + run: dotnet build --no-restore |
| 127 | + - name: Test |
| 128 | + run: dotnet test --no-build --verbosity normal |
0 commit comments