1# NOTE: This workflow was ported from Travis. 2# Travis was using Ubuntu 14.04. Ubuntu 14.04 is not supportted by GitHub workflows. Ubuntu 20.04 is recommended. 3# Travis was using Clang 3.6. The earliest version support by Ubuntu 20.04 is Clang 6.0. 4# Travis was caching the clang package. APT package caching is not natively supported by GitHub actions/cache. 5# Travis was using Mac OS X 10.13.6 / Xcode 9.4.1 / LLVM 9.1.0 6 7# NOTE: The following documentation may be useful to maintainers of this workflow. 8# Github actions: https://docs.github.com/en/actions 9# Github github-script action: https://github.com/actions/github-script 10# GitHub REST API: https://docs.github.com/en/rest 11# Octokit front-end to the GitHub REST API: https://octokit.github.io/rest.js/v18 12# Octokit endpoint methods: https://github.com/octokit/plugin-rest-endpoint-methods.js/tree/master/docs/repos 13 14# TODO: Use actions/upload-artifact and actions/download-artifact to simplify deployment. 15# TODO: Use composite actions to refactor redundant code. 16 17name: Continuous Deployment 18 19on: 20 workflow_dispatch: 21 push: 22 branches: 23 - master 24 25jobs: 26 linux: 27 runs-on: ${{matrix.os.genus}} 28 strategy: 29 fail-fast: false 30 matrix: 31 os: [{genus: ubuntu-20.04, family: linux}] 32 compiler: [{cc: clang, cxx: clang++}, {cc: gcc, cxx: g++}] 33 cmake_build_type: [Debug, Release] 34 steps: 35 - uses: actions/checkout@v2 36 - uses: actions/setup-python@v2 37 with: 38 python-version: '3.7' 39 - name: Install Ubuntu Package Dependencies 40 run: | 41 sudo apt-get -qq update 42 sudo apt-get install -y clang-6.0 43 - name: Install GoogleTest 44 run: | 45 # check out pre-breakage version of googletest; can be deleted when 46 # issue 3128 is fixed 47 # git clone --depth=1 https://github.com/google/googletest.git External/googletest 48 mkdir -p External/googletest 49 cd External/googletest 50 git init 51 git remote add origin https://github.com/google/googletest.git 52 git fetch --depth 1 origin 0c400f67fcf305869c5fb113dd296eca266c9725 53 git reset --hard FETCH_HEAD 54 cd ../.. 55 - name: Update Glslang Sources 56 run: | 57 ./update_glslang_sources.py 58 - name: Build 59 env: 60 CC: ${{matrix.compiler.cc}} 61 CXX: ${{matrix.compiler.cxx}} 62 run: | 63 mkdir build && cd build 64 cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install .. 65 make -j4 install 66 - name: Test 67 run: | 68 cd build 69 ctest --output-on-failure && 70 cd ../Test && ./runtests 71 - name: Zip 72 if: ${{ matrix.compiler.cc == 'clang' }} 73 env: 74 ARCHIVE: glslang-master-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip 75 run: | 76 cd build/install 77 zip ${ARCHIVE} \ 78 bin/glslangValidator \ 79 include/glslang/* \ 80 lib/libGenericCodeGen${SUFFIX}.a \ 81 lib/libglslang${SUFFIX}.a \ 82 lib/libglslang-default-resource-limits${SUFFIX}.a \ 83 lib/libHLSL${SUFFIX}.a \ 84 lib/libMachineIndependent${SUFFIX}.a \ 85 lib/libOGLCompiler${SUFFIX}.a \ 86 lib/libOSDependent${SUFFIX}.a \ 87 lib/libSPIRV${SUFFIX}.a \ 88 lib/libSPVRemapper${SUFFIX}.a \ 89 lib/libSPIRV-Tools${SUFFIX}.a \ 90 lib/libSPIRV-Tools-opt${SUFFIX}.a 91 - name: Deploy 92 if: ${{ matrix.compiler.cc == 'clang' }} 93 env: 94 ARCHIVE: glslang-master-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip 95 uses: actions/github-script@v5 96 with: 97 script: | 98 const script = require('.github/workflows/deploy.js') 99 await script({github, context, core}) 100 101 macos: 102 runs-on: ${{matrix.os.genus}} 103 strategy: 104 fail-fast: false 105 matrix: 106 os: [{genus: macos-10.15, family: osx}] 107 compiler: [{cc: clang, cxx: clang++}] 108 cmake_build_type: [Debug, Release] 109 steps: 110 - uses: actions/checkout@v2 111 - uses: actions/setup-python@v2 112 with: 113 python-version: '3.7' 114 - name: Install GoogleTest 115 run: | 116 # check out pre-breakage version of googletest; can be deleted when 117 # issue 3128 is fixed 118 # git clone --depth=1 https://github.com/google/googletest.git External/googletest 119 mkdir -p External/googletest 120 cd External/googletest 121 git init 122 git remote add origin https://github.com/google/googletest.git 123 git fetch --depth 1 origin 0c400f67fcf305869c5fb113dd296eca266c9725 124 git reset --hard FETCH_HEAD 125 cd ../.. 126 - name: Update Glslang Sources 127 run: | 128 ./update_glslang_sources.py 129 - name: Build 130 env: 131 CC: ${{matrix.compiler.cc}} 132 CXX: ${{matrix.compiler.cxx}} 133 run: | 134 mkdir build && cd build 135 cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install .. 136 make -j4 install 137 - name: Test 138 run: | 139 cd build 140 ctest --output-on-failure && 141 cd ../Test && ./runtests 142 - name: Zip 143 env: 144 ARCHIVE: glslang-master-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip 145 run: | 146 cd build/install 147 zip ${ARCHIVE} \ 148 bin/glslangValidator \ 149 include/glslang/* \ 150 lib/libGenericCodeGen${SUFFIX}.a \ 151 lib/libglslang${SUFFIX}.a \ 152 lib/libglslang-default-resource-limits${SUFFIX}.a \ 153 lib/libHLSL${SUFFIX}.a \ 154 lib/libMachineIndependent${SUFFIX}.a \ 155 lib/libOGLCompiler${SUFFIX}.a \ 156 lib/libOSDependent${SUFFIX}.a \ 157 lib/libSPIRV${SUFFIX}.a \ 158 lib/libSPVRemapper${SUFFIX}.a \ 159 lib/libSPIRV-Tools${SUFFIX}.a \ 160 lib/libSPIRV-Tools-opt${SUFFIX}.a 161 - name: Deploy 162 env: 163 ARCHIVE: glslang-master-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip 164 uses: actions/github-script@v5 165 with: 166 script: | 167 const script = require('.github/workflows/deploy.js') 168 await script({github, context, core}) 169