| # NOTE: The following documentation may be useful to maintainers of this workflow. |
| # Github actions: https://docs.github.com/en/actions |
| # Github github-script action: https://github.com/actions/github-script |
| # GitHub REST API: https://docs.github.com/en/rest |
| # Octokit front-end to the GitHub REST API: https://octokit.github.io/rest.js/v18 |
| # Octokit endpoint methods: https://github.com/octokit/plugin-rest-endpoint-methods.js/tree/master/docs/repos |
| # softprops/action-gh-release: https://github.com/softprops/action-gh-release |
| |
| name: Continuous Deployment |
| |
| on: |
| workflow_dispatch: |
| push: |
| branches: |
| - main |
| paths-ignore: |
| - 'README.md' |
| - 'LICENSE.txt' |
| - 'CODE_OF_CONDUCT.md' |
| - 'BUILD.*' |
| - 'WORKSPACE' |
| - 'kokoro/*' |
| - 'make-revision' |
| - 'Android.mk' |
| - '_config.yml' |
| tags: |
| - '[0-9]*.[0-9]*.[0-9]*' |
| |
| permissions: read-all |
| |
| jobs: |
| linux: |
| runs-on: ${{matrix.os.runner}} |
| permissions: |
| contents: write |
| strategy: |
| fail-fast: false |
| matrix: |
| os: [{runner: ubuntu-22.04, platform: linux, arch: x86_64}] |
| compiler: [{cc: clang, cxx: clang++}, {cc: gcc, cxx: g++}] |
| cmake_build_type: [Debug, Release] |
| steps: |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| - run: ./update_glslang_sources.py |
| - name: Build |
| env: |
| CC: ${{matrix.compiler.cc}} |
| CXX: ${{matrix.compiler.cxx}} |
| run: | |
| mkdir build && cd build |
| cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install -DSPIRV_SKIP_EXECUTABLES=ON .. |
| make -j4 install |
| - name: Test |
| run: | |
| cd build |
| ctest --output-on-failure |
| - name: Package |
| if: ${{ matrix.compiler.cc == 'clang' }} |
| id: package |
| shell: bash |
| env: |
| BUILD_TYPE: ${{matrix.cmake_build_type}} |
| PLATFORM: ${{matrix.os.platform}} |
| ARCH: ${{matrix.os.arch}} |
| run: | |
| cd build/install |
| BUILD_TYPE_LOWER="${BUILD_TYPE,,}" |
| if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then |
| VERSION="${{ github.ref_name }}" |
| ARCHIVE_BASE="glslang-${VERSION}-${PLATFORM}-${ARCH}-${BUILD_TYPE_LOWER}" |
| else |
| ARCHIVE_BASE="glslang-main-${PLATFORM}-${ARCH}-${BUILD_TYPE_LOWER}" |
| fi |
| FILES=( |
| bin/glslang |
| bin/glslangValidator |
| include/glslang/build_info.h |
| include/glslang/Include/ResourceLimits.h |
| include/glslang/Include/glslang_c_interface.h |
| include/glslang/Include/glslang_c_shader_types.h |
| include/glslang/Include/visibility.h |
| include/glslang/MachineIndependent/Versions.h |
| include/glslang/Public/ResourceLimits.h |
| include/glslang/Public/ShaderLang.h |
| include/glslang/Public/resource_limits_c.h |
| include/glslang/SPIRV/GlslangToSpv.h |
| include/glslang/SPIRV/Logger.h |
| include/glslang/SPIRV/SpvTools.h |
| include/glslang/SPIRV/disassemble.h |
| include/glslang/SPIRV/spirv.hpp11 |
| lib/libGenericCodeGen.a |
| lib/libMachineIndependent.a |
| lib/libOSDependent.a |
| lib/libSPIRV.a |
| lib/libSPIRV-Tools.a |
| lib/libSPIRV-Tools-opt.a |
| lib/libglslang.a |
| lib/libglslang-default-resource-limits.a |
| ) |
| # -y stores the glslangValidator symlink as-is rather than dereferencing it. |
| zip -y "${ARCHIVE_BASE}.zip" "${FILES[@]}" |
| tar -czf "${ARCHIVE_BASE}.tar.gz" "${FILES[@]}" |
| echo "ARCHIVE_ZIP=build/install/${ARCHIVE_BASE}.zip" >> $GITHUB_OUTPUT |
| echo "ARCHIVE_TAR=build/install/${ARCHIVE_BASE}.tar.gz" >> $GITHUB_OUTPUT |
| - name: Update main-tot tag |
| if: ${{ matrix.compiler.cc == 'clang' && !startsWith(github.ref, 'refs/tags/') }} |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 |
| with: |
| script: | |
| await github.rest.git.updateRef({ |
| owner: context.repo.owner, |
| repo: context.repo.repo, |
| ref: 'tags/main-tot', |
| sha: context.sha |
| }) |
| - name: Upload assets |
| if: ${{ matrix.compiler.cc == 'clang' }} |
| uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2 |
| with: |
| tag_name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'main-tot' }} |
| fail_on_unmatched_files: true |
| files: | |
| ${{steps.package.outputs.ARCHIVE_ZIP}} |
| ${{steps.package.outputs.ARCHIVE_TAR}} |
| env: |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| |
| macos: |
| runs-on: ${{matrix.os.runner}} |
| permissions: |
| contents: write |
| strategy: |
| fail-fast: false |
| matrix: |
| os: [{runner: macos-latest, platform: macos, arch: universal}] |
| compiler: [{cc: clang, cxx: clang++}] |
| cmake_build_type: [Debug, Release] |
| steps: |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| - run: ./update_glslang_sources.py |
| - name: Build |
| env: |
| CC: ${{matrix.compiler.cc}} |
| CXX: ${{matrix.compiler.cxx}} |
| MACOSX_DEPLOYMENT_TARGET: 11.0 |
| run: | |
| mkdir build && cd build |
| cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install -DSPIRV_SKIP_EXECUTABLES=ON "-D CMAKE_OSX_ARCHITECTURES=arm64;x86_64" .. |
| make -j4 install |
| - name: Test |
| run: | |
| cd build |
| ctest --output-on-failure |
| - name: Package |
| id: package |
| shell: bash |
| env: |
| BUILD_TYPE: ${{matrix.cmake_build_type}} |
| PLATFORM: ${{matrix.os.platform}} |
| ARCH: ${{matrix.os.arch}} |
| run: | |
| cd build/install |
| # macOS ships bash 3.2, which lacks ${VAR,,} lowercasing; use tr for portability. |
| BUILD_TYPE_LOWER=$(echo "${BUILD_TYPE}" | tr '[:upper:]' '[:lower:]') |
| if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then |
| VERSION="${{ github.ref_name }}" |
| ARCHIVE_BASE="glslang-${VERSION}-${PLATFORM}-${ARCH}-${BUILD_TYPE_LOWER}" |
| else |
| ARCHIVE_BASE="glslang-main-${PLATFORM}-${ARCH}-${BUILD_TYPE_LOWER}" |
| fi |
| FILES=( |
| bin/glslang |
| bin/glslangValidator |
| include/glslang/build_info.h |
| include/glslang/Include/ResourceLimits.h |
| include/glslang/Include/glslang_c_interface.h |
| include/glslang/Include/glslang_c_shader_types.h |
| include/glslang/Include/visibility.h |
| include/glslang/MachineIndependent/Versions.h |
| include/glslang/Public/ResourceLimits.h |
| include/glslang/Public/ShaderLang.h |
| include/glslang/Public/resource_limits_c.h |
| include/glslang/SPIRV/GlslangToSpv.h |
| include/glslang/SPIRV/Logger.h |
| include/glslang/SPIRV/SpvTools.h |
| include/glslang/SPIRV/disassemble.h |
| include/glslang/SPIRV/spirv.hpp11 |
| lib/libGenericCodeGen.a |
| lib/libMachineIndependent.a |
| lib/libOSDependent.a |
| lib/libSPIRV.a |
| lib/libSPIRV-Tools.a |
| lib/libSPIRV-Tools-opt.a |
| lib/libglslang.a |
| lib/libglslang-default-resource-limits.a |
| ) |
| # -y stores the glslangValidator symlink as-is rather than dereferencing it. |
| zip -y "${ARCHIVE_BASE}.zip" "${FILES[@]}" |
| tar -czf "${ARCHIVE_BASE}.tar.gz" "${FILES[@]}" |
| echo "ARCHIVE_ZIP=build/install/${ARCHIVE_BASE}.zip" >> $GITHUB_OUTPUT |
| echo "ARCHIVE_TAR=build/install/${ARCHIVE_BASE}.tar.gz" >> $GITHUB_OUTPUT |
| - name: Update main-tot tag |
| if: ${{ !startsWith(github.ref, 'refs/tags/') }} |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 |
| with: |
| script: | |
| await github.rest.git.updateRef({ |
| owner: context.repo.owner, |
| repo: context.repo.repo, |
| ref: 'tags/main-tot', |
| sha: context.sha |
| }) |
| - name: Upload assets |
| uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2 |
| with: |
| tag_name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'main-tot' }} |
| fail_on_unmatched_files: true |
| files: | |
| ${{steps.package.outputs.ARCHIVE_ZIP}} |
| ${{steps.package.outputs.ARCHIVE_TAR}} |
| env: |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| |
| windows: |
| runs-on: ${{matrix.os.runner}} |
| permissions: |
| contents: write |
| strategy: |
| fail-fast: false |
| matrix: |
| os: [{runner: windows-2022, platform: windows, arch: x86_64}] |
| cmake_build_type: [Debug, Release] |
| steps: |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| - run: python update_glslang_sources.py |
| - name: Build |
| run: | |
| cmake -S. -Bbuild -G "Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX="$PWD/build/install" -DSPIRV_SKIP_EXECUTABLES=ON |
| cmake --build build --config ${{matrix.cmake_build_type}} --target install |
| - name: Test |
| run: | |
| cd build |
| ctest -C ${{matrix.cmake_build_type}} --output-on-failure |
| - name: Package |
| id: package |
| shell: bash |
| env: |
| BUILD_TYPE: ${{matrix.cmake_build_type}} |
| PLATFORM: ${{matrix.os.platform}} |
| ARCH: ${{matrix.os.arch}} |
| run: | |
| cd build/install |
| BUILD_TYPE_LOWER="${BUILD_TYPE,,}" |
| if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then |
| VERSION="${{ github.ref_name }}" |
| ARCHIVE_BASE="glslang-${VERSION}-${PLATFORM}-${ARCH}-${BUILD_TYPE_LOWER}" |
| else |
| ARCHIVE_BASE="glslang-main-${PLATFORM}-${ARCH}-${BUILD_TYPE_LOWER}" |
| fi |
| if [ "${BUILD_TYPE}" == "Debug" ]; then |
| 7z a "${ARCHIVE_BASE}.zip" \ |
| bin/glslang.exe \ |
| include/glslang/* \ |
| lib/GenericCodeGend.lib \ |
| lib/glslangd.lib \ |
| lib/glslang-default-resource-limitsd.lib \ |
| lib/MachineIndependentd.lib \ |
| lib/OSDependentd.lib \ |
| lib/SPIRVd.lib \ |
| lib/SPIRV-Toolsd.lib \ |
| lib/SPIRV-Tools-optd.lib |
| else |
| 7z a "${ARCHIVE_BASE}.zip" \ |
| bin/glslang.exe \ |
| include/glslang/* \ |
| lib/GenericCodeGen.lib \ |
| lib/glslang.lib \ |
| lib/glslang-default-resource-limits.lib \ |
| lib/MachineIndependent.lib \ |
| lib/OSDependent.lib \ |
| lib/SPIRV.lib \ |
| lib/SPIRV-Tools.lib \ |
| lib/SPIRV-Tools-opt.lib |
| fi |
| echo "ARCHIVE_ZIP=build/install/${ARCHIVE_BASE}.zip" >> $GITHUB_OUTPUT |
| - name: Update main-tot tag |
| if: ${{ !startsWith(github.ref, 'refs/tags/') }} |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 |
| with: |
| script: | |
| await github.rest.git.updateRef({ |
| owner: context.repo.owner, |
| repo: context.repo.repo, |
| ref: 'tags/main-tot', |
| sha: context.sha |
| }) |
| - name: Upload assets |
| uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2 |
| with: |
| tag_name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'main-tot' }} |
| fail_on_unmatched_files: true |
| files: ${{steps.package.outputs.ARCHIVE_ZIP}} |
| env: |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |