1# NOTE: The following documentation may be useful to maintainers of this workflow. 2# Github actions: https://docs.github.com/en/actions 3# Github github-script action: https://github.com/actions/github-script 4# GitHub REST API: https://docs.github.com/en/rest 5# Octokit front-end to the GitHub REST API: https://octokit.github.io/rest.js/v18 6# Octokit endpoint methods: https://github.com/octokit/plugin-rest-endpoint-methods.js/tree/master/docs/repos 7 8# TODO: Use actions/upload-artifact and actions/download-artifact to simplify deployment. 9# TODO: Use composite actions to refactor redundant code. 10 11name: Continuous Deployment 12 13on: 14 workflow_dispatch: 15 push: 16 branches: 17 - main 18 paths-ignore: 19 - 'README.md' 20 - 'README-spirv-remap.txt' 21 - 'LICENSE.txt' 22 - 'CODE_OF_CONDUCT.md' 23 - 'BUILD.*' 24 - 'WORKSPACE' 25 - 'kokoro/*' 26 - 'make-revision' 27 - 'Android.mk' 28 - '_config.yml' 29 30permissions: read-all 31 32jobs: 33 linux: 34 runs-on: ${{matrix.os.genus}} 35 permissions: 36 contents: write 37 strategy: 38 fail-fast: false 39 matrix: 40 os: [{genus: ubuntu-20.04, family: linux}] 41 compiler: [{cc: clang, cxx: clang++}, {cc: gcc, cxx: g++}] 42 cmake_build_type: [Debug, Release] 43 steps: 44 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 45 - uses: lukka/get-cmake@5979409e62bdf841487c5fb3c053149de97a86d3 # v3.31.2 46 - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 47 with: 48 python-version: '3.7' 49 - name: Install Ubuntu Package Dependencies 50 run: | 51 sudo apt-get -qq update 52 sudo apt-get install -y clang-6.0 53 - run: ./update_glslang_sources.py 54 - name: Build 55 env: 56 CC: ${{matrix.compiler.cc}} 57 CXX: ${{matrix.compiler.cxx}} 58 run: | 59 mkdir build && cd build 60 cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install .. 61 make -j4 install 62 - name: Test 63 run: | 64 cd build 65 ctest --output-on-failure 66 - name: Zip 67 if: ${{ matrix.compiler.cc == 'clang' }} 68 env: 69 ARCHIVE: glslang-main-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip 70 run: | 71 cd build/install 72 zip ${ARCHIVE} \ 73 bin/glslang \ 74 bin/glslangValidator \ 75 include/glslang/* \ 76 include/glslang/**/* \ 77 lib/libGenericCodeGen.a \ 78 lib/libglslang.a \ 79 lib/libglslang-default-resource-limits.a \ 80 lib/libMachineIndependent.a \ 81 lib/libOSDependent.a \ 82 lib/libSPIRV.a \ 83 lib/libSPVRemapper.a \ 84 lib/libSPIRV-Tools.a \ 85 lib/libSPIRV-Tools-opt.a 86 - name: Deploy 87 if: ${{ matrix.compiler.cc == 'clang' }} 88 env: 89 ARCHIVE: glslang-main-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip 90 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 91 with: 92 script: | 93 const script = require('.github/workflows/deploy.js') 94 await script({github, context, core}) 95 96 macos: 97 runs-on: ${{matrix.os.genus}} 98 permissions: 99 contents: write 100 strategy: 101 fail-fast: false 102 matrix: 103 os: [{genus: macos-13, family: osx}] 104 compiler: [{cc: clang, cxx: clang++}] 105 cmake_build_type: [Debug, Release] 106 steps: 107 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 108 - uses: lukka/get-cmake@5979409e62bdf841487c5fb3c053149de97a86d3 # v3.31.2 109 - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 110 with: 111 python-version: '3.7' 112 - run: ./update_glslang_sources.py 113 - name: Build 114 env: 115 CC: ${{matrix.compiler.cc}} 116 CXX: ${{matrix.compiler.cxx}} 117 run: | 118 mkdir build && cd build 119 cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install .. 120 make -j4 install 121 - name: Test 122 run: | 123 cd build 124 ctest --output-on-failure 125 - name: Zip 126 env: 127 ARCHIVE: glslang-main-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip 128 run: | 129 cd build/install 130 zip ${ARCHIVE} \ 131 bin/glslang \ 132 bin/glslangValidator \ 133 include/glslang/* \ 134 include/glslang/**/* \ 135 lib/libGenericCodeGen.a \ 136 lib/libglslang.a \ 137 lib/libglslang-default-resource-limits.a \ 138 lib/libMachineIndependent.a \ 139 lib/libOSDependent.a \ 140 lib/libSPIRV.a \ 141 lib/libSPVRemapper.a \ 142 lib/libSPIRV-Tools.a \ 143 lib/libSPIRV-Tools-opt.a 144 - name: Deploy 145 env: 146 ARCHIVE: glslang-main-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip 147 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 148 with: 149 script: | 150 const script = require('.github/workflows/deploy.js') 151 await script({github, context, core}) 152 153 windows: 154 runs-on: ${{matrix.os.genus}} 155 permissions: 156 contents: write 157 strategy: 158 fail-fast: false 159 matrix: 160 os: [{genus: windows-2019, family: windows}] 161 cmake_build_type: [Debug, Release] 162 steps: 163 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 164 - uses: lukka/get-cmake@5979409e62bdf841487c5fb3c053149de97a86d3 # v3.31.2 165 - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 166 with: 167 python-version: '3.7' 168 - run: python update_glslang_sources.py 169 - name: Build 170 run: | 171 cmake -S. -Bbuild -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX="$PWD/build/install" 172 cmake --build build --config ${{matrix.cmake_build_type}} --target install 173 - name: Test 174 run: | 175 cd build 176 ctest -C ${{matrix.cmake_build_type}} --output-on-failure 177 - name: Zip 178 if: ${{ matrix.cmake_build_type == 'Debug' }} 179 env: 180 ARCHIVE: glslang-master-${{matrix.os.family}}-Debug.zip 181 run: | 182 cd build/install 183 7z a ${{env.ARCHIVE}} ` 184 bin/glslang.exe ` 185 bin/glslangValidator.exe ` 186 bin/spirv-remap.exe ` 187 include/glslang/* ` 188 lib/GenericCodeGend.lib ` 189 lib/glslangd.lib ` 190 lib/glslang-default-resource-limitsd.lib ` 191 lib/MachineIndependentd.lib ` 192 lib/OSDependentd.lib ` 193 lib/SPIRVd.lib ` 194 lib/SPVRemapperd.lib ` 195 lib/SPIRV-Toolsd.lib ` 196 lib/SPIRV-Tools-optd.lib 197 - name: Zip 198 if: ${{ matrix.cmake_build_type == 'Release' }} 199 env: 200 ARCHIVE: glslang-master-${{matrix.os.family}}-Release.zip 201 run: | 202 cd build/install 203 7z a ${{env.ARCHIVE}} ` 204 bin/glslang.exe ` 205 bin/glslangValidator.exe ` 206 bin/spirv-remap.exe ` 207 include/glslang/* ` 208 lib/GenericCodeGen.lib ` 209 lib/glslang.lib ` 210 lib/glslang-default-resource-limits.lib ` 211 lib/MachineIndependent.lib ` 212 lib/OSDependent.lib ` 213 lib/SPIRV.lib ` 214 lib/SPVRemapper.lib ` 215 lib/SPIRV-Tools.lib ` 216 lib/SPIRV-Tools-opt.lib 217 - name: Deploy 218 env: 219 ARCHIVE: glslang-master-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip 220 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 221 with: 222 script: | 223 const script = require('.github/workflows/deploy.js') 224 await script({github, context, core}) 225