Merge pull request #3045 from James2022-rgb/feature/c_interface_preamble_support
[platform/upstream/glslang.git] / .github / workflows / continuous_deployment.yml
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
17 name: Continuous Deployment
18
19 on:
20     workflow_dispatch:
21     push:
22         branches:
23             - master
24
25 jobs:
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                       include/glslang/**/* \
81                       lib/libGenericCodeGen.a \
82                       lib/libglslang.a \
83                       lib/libglslang-default-resource-limits.a \
84                       lib/libHLSL.a \
85                       lib/libMachineIndependent.a \
86                       lib/libOGLCompiler.a \
87                       lib/libOSDependent.a \
88                       lib/libSPIRV.a \
89                       lib/libSPVRemapper.a \
90                       lib/libSPIRV-Tools.a \
91                       lib/libSPIRV-Tools-opt.a
92             - name: Deploy
93               if: ${{ matrix.compiler.cc == 'clang' }}
94               env:
95                   ARCHIVE: glslang-master-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip
96               uses: actions/github-script@v5
97               with:
98                   script: |
99                       const script = require('.github/workflows/deploy.js')
100                       await script({github, context, core})
101
102     macos:
103         runs-on: ${{matrix.os.genus}}
104         strategy:
105             fail-fast: false
106             matrix:
107                 os: [{genus: macos-11, family: osx}]
108                 compiler: [{cc: clang, cxx: clang++}]
109                 cmake_build_type: [Debug, Release]
110         steps:
111             - uses: actions/checkout@v2
112             - uses: actions/setup-python@v2
113               with:
114                   python-version: '3.7'
115             - name: Install GoogleTest
116               run: |
117                   # check out pre-breakage version of googletest; can be deleted when
118                   # issue 3128 is fixed
119                   # git clone --depth=1 https://github.com/google/googletest.git External/googletest
120                   mkdir -p External/googletest
121                   cd External/googletest
122                   git init
123                   git remote add origin https://github.com/google/googletest.git
124                   git fetch --depth 1 origin 0c400f67fcf305869c5fb113dd296eca266c9725
125                   git reset --hard FETCH_HEAD
126                   cd ../..
127             - name: Update Glslang Sources
128               run: |
129                   ./update_glslang_sources.py
130             - name: Build
131               env:
132                   CC: ${{matrix.compiler.cc}}
133                   CXX: ${{matrix.compiler.cxx}}
134               run: |
135                   mkdir build && cd build
136                   cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install ..
137                   make -j4 install
138             - name: Test
139               run: |
140                   cd build
141                   ctest --output-on-failure &&
142                   cd ../Test && ./runtests
143             - name: Zip
144               env:
145                   ARCHIVE: glslang-master-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip
146               run: |
147                   cd build/install
148                   zip ${ARCHIVE} \
149                       bin/glslangValidator \
150                       include/glslang/* \
151                       include/glslang/**/* \
152                       lib/libGenericCodeGen.a \
153                       lib/libglslang.a \
154                       lib/libglslang-default-resource-limits.a \
155                       lib/libHLSL.a \
156                       lib/libMachineIndependent.a \
157                       lib/libOGLCompiler.a \
158                       lib/libOSDependent.a \
159                       lib/libSPIRV.a \
160                       lib/libSPVRemapper.a \
161                       lib/libSPIRV-Tools.a \
162                       lib/libSPIRV-Tools-opt.a
163             - name: Deploy
164               env:
165                   ARCHIVE: glslang-master-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip
166               uses: actions/github-script@v5
167               with:
168                   script: |
169                       const script = require('.github/workflows/deploy.js')
170                       await script({github, context, core})