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@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 45 - uses: lukka/get-cmake@18d87816d12dd87ec1449d47b9b3a587e0a1cc19 # v3.29.5 46 - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.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 cd ../Test && ./runtests 67 - name: Zip 68 if: ${{ matrix.compiler.cc == 'clang' }} 69 env: 70 ARCHIVE: glslang-main-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip 71 run: | 72 cd build/install 73 zip ${ARCHIVE} \ 74 bin/glslang \ 75 bin/glslangValidator \ 76 include/glslang/* \ 77 include/glslang/**/* \ 78 lib/libGenericCodeGen.a \ 79 lib/libglslang.a \ 80 lib/libglslang-default-resource-limits.a \ 81 lib/libMachineIndependent.a \ 82 lib/libOSDependent.a \ 83 lib/libSPIRV.a \ 84 lib/libSPVRemapper.a \ 85 lib/libSPIRV-Tools.a \ 86 lib/libSPIRV-Tools-opt.a 87 - name: Deploy 88 if: ${{ matrix.compiler.cc == 'clang' }} 89 env: 90 ARCHIVE: glslang-main-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip 91 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 92 with: 93 script: | 94 const script = require('.github/workflows/deploy.js') 95 await script({github, context, core}) 96 97 macos: 98 runs-on: ${{matrix.os.genus}} 99 permissions: 100 contents: write 101 strategy: 102 fail-fast: false 103 matrix: 104 os: [{genus: macos-11, family: osx}] 105 compiler: [{cc: clang, cxx: clang++}] 106 cmake_build_type: [Debug, Release] 107 steps: 108 - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 109 - uses: lukka/get-cmake@18d87816d12dd87ec1449d47b9b3a587e0a1cc19 # v3.29.5 110 - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 111 with: 112 python-version: '3.7' 113 - run: ./update_glslang_sources.py 114 - name: Build 115 env: 116 CC: ${{matrix.compiler.cc}} 117 CXX: ${{matrix.compiler.cxx}} 118 run: | 119 mkdir build && cd build 120 cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install .. 121 make -j4 install 122 - name: Test 123 run: | 124 cd build 125 ctest --output-on-failure && 126 cd ../Test && ./runtests 127 - name: Zip 128 env: 129 ARCHIVE: glslang-main-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip 130 run: | 131 cd build/install 132 zip ${ARCHIVE} \ 133 bin/glslang \ 134 bin/glslangValidator \ 135 include/glslang/* \ 136 include/glslang/**/* \ 137 lib/libGenericCodeGen.a \ 138 lib/libglslang.a \ 139 lib/libglslang-default-resource-limits.a \ 140 lib/libMachineIndependent.a \ 141 lib/libOSDependent.a \ 142 lib/libSPIRV.a \ 143 lib/libSPVRemapper.a \ 144 lib/libSPIRV-Tools.a \ 145 lib/libSPIRV-Tools-opt.a 146 - name: Deploy 147 env: 148 ARCHIVE: glslang-main-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip 149 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 150 with: 151 script: | 152 const script = require('.github/workflows/deploy.js') 153 await script({github, context, core}) 154 155 windows: 156 runs-on: ${{matrix.os.genus}} 157 permissions: 158 contents: write 159 strategy: 160 fail-fast: false 161 matrix: 162 os: [{genus: windows-2019, family: windows}] 163 cmake_build_type: [Debug, Release] 164 steps: 165 - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 166 - uses: lukka/get-cmake@18d87816d12dd87ec1449d47b9b3a587e0a1cc19 # v3.29.5 167 - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 168 with: 169 python-version: '3.7' 170 - run: python update_glslang_sources.py 171 - name: Build 172 run: | 173 cmake -S. -Bbuild -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX="$PWD/build/install" 174 cmake --build build --config ${{matrix.cmake_build_type}} --target install 175 - name: Test 176 run: | 177 cd build 178 ctest -C ${{matrix.cmake_build_type}} --output-on-failure 179 cd ../Test && bash runtests 180 - name: Zip 181 if: ${{ matrix.cmake_build_type == 'Debug' }} 182 env: 183 ARCHIVE: glslang-master-${{matrix.os.family}}-Debug.zip 184 run: | 185 cd build/install 186 7z a ${{env.ARCHIVE}} ` 187 bin/glslang.exe ` 188 bin/glslangValidator.exe ` 189 bin/spirv-remap.exe ` 190 include/glslang/* ` 191 lib/GenericCodeGend.lib ` 192 lib/glslangd.lib ` 193 lib/glslang-default-resource-limitsd.lib ` 194 lib/MachineIndependentd.lib ` 195 lib/OSDependentd.lib ` 196 lib/SPIRVd.lib ` 197 lib/SPVRemapperd.lib ` 198 lib/SPIRV-Toolsd.lib ` 199 lib/SPIRV-Tools-optd.lib 200 - name: Zip 201 if: ${{ matrix.cmake_build_type == 'Release' }} 202 env: 203 ARCHIVE: glslang-master-${{matrix.os.family}}-Release.zip 204 run: | 205 cd build/install 206 7z a ${{env.ARCHIVE}} ` 207 bin/glslang.exe ` 208 bin/glslangValidator.exe ` 209 bin/spirv-remap.exe ` 210 include/glslang/* ` 211 lib/GenericCodeGen.lib ` 212 lib/glslang.lib ` 213 lib/glslang-default-resource-limits.lib ` 214 lib/MachineIndependent.lib ` 215 lib/OSDependent.lib ` 216 lib/SPIRV.lib ` 217 lib/SPVRemapper.lib ` 218 lib/SPIRV-Tools.lib ` 219 lib/SPIRV-Tools-opt.lib 220 - name: Deploy 221 env: 222 ARCHIVE: glslang-master-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip 223 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 224 with: 225 script: | 226 const script = require('.github/workflows/deploy.js') 227 await script({github, context, core}) 228