• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: Continuous Integration
2
3on:
4  workflow_dispatch:
5  pull_request:
6    branches:
7      - main
8
9permissions: read-all
10
11jobs:
12  linux:
13    runs-on: ubuntu-22.04
14    strategy:
15      fail-fast: false
16      matrix:
17        compiler: [{cc: clang, cxx: clang++}, {cc: gcc, cxx: g++}]
18        cmake_build_type: [Debug, Release]
19    steps:
20      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21      - uses: lukka/get-cmake@5979409e62bdf841487c5fb3c053149de97a86d3 # v3.31.2
22      - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
23        with:
24          python-version: '3.7'
25      - name: Setup ccache
26        uses: hendrikmuhs/ccache-action@ed74d11c0b343532753ecead8a951bb09bb34bc9 # v1.2.14
27        with:
28          key: ubuntu-22-${{ matrix.cmake_build_type }}-${{ matrix.compiler.cc }}-${{matrix.compiler.cxx}}
29      - run: ./update_glslang_sources.py
30      - name: Configure
31        run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} -DBUILD_WERROR=ON -D GLSLANG_TESTS=ON
32        env:
33          CC: ${{matrix.compiler.cc}}
34          CXX: ${{matrix.compiler.cxx}}
35          CMAKE_GENERATOR: Ninja
36          CMAKE_C_COMPILER_LAUNCHER: ccache
37          CMAKE_CXX_COMPILER_LAUNCHER: ccache
38      - name: Build
39        run: cmake --build build
40      - name: Install
41        run: cmake --install build --prefix build/install
42      - name: Test
43        run: ctest --output-on-failure --test-dir build
44      - name: Check known validation failure list
45        run: grep -l 'Validation failed' Test/baseResults/* | sort -fd | diff -u Test/baseResults/validation_fails.txt -
46
47  linux-shared:
48    runs-on: ubuntu-22.04
49    strategy:
50      fail-fast: false
51      matrix:
52        compiler: [{cc: clang, cxx: clang++}, {cc: gcc, cxx: g++}]
53        cmake_build_type: [Release]
54    steps:
55      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
56      - uses: lukka/get-cmake@5979409e62bdf841487c5fb3c053149de97a86d3 # v3.31.2
57      - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
58        with:
59          python-version: '3.7'
60      - name: Setup ccache
61        uses: hendrikmuhs/ccache-action@ed74d11c0b343532753ecead8a951bb09bb34bc9 # v1.2.14
62        with:
63          key: ubuntu-22-${{ matrix.cmake_build_type }}-${{ matrix.compiler.cc }}-${{matrix.compiler.cxx}}
64      - run: ./update_glslang_sources.py
65      - name: Configure
66        run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} -DBUILD_WERROR=ON -D GLSLANG_TESTS=ON -DBUILD_SHARED_LIBS=ON
67        env:
68          CC: ${{matrix.compiler.cc}}
69          CXX: ${{matrix.compiler.cxx}}
70          CMAKE_GENERATOR: Ninja
71          CMAKE_C_COMPILER_LAUNCHER: ccache
72          CMAKE_CXX_COMPILER_LAUNCHER: ccache
73      - name: Build
74        run: cmake --build build
75      - name: Install
76        run: cmake --install build --prefix build/install
77      - name: Test
78        run: ctest --output-on-failure --test-dir build
79
80  linux-asan:
81    runs-on: ubuntu-22.04
82    strategy:
83      fail-fast: false
84      matrix:
85        compiler: [{cc: gcc, cxx: g++}]
86        cmake_build_type: [Debug]
87        flags: ['-fsanitize=address', '-fsanitize=thread', '-fsanitize=undefined']
88    steps:
89      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
90      - uses: lukka/get-cmake@5979409e62bdf841487c5fb3c053149de97a86d3 # v3.31.2
91      - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
92        with:
93          python-version: '3.7'
94      - name: Setup ccache
95        uses: hendrikmuhs/ccache-action@ed74d11c0b343532753ecead8a951bb09bb34bc9 # v1.2.14
96        with:
97          key: ubuntu-22-${{ matrix.cmake_build_type }}-${{ matrix.compiler.cc }}-${{matrix.compiler.cxx}}-${{matrix.flags}}
98      # This is to combat a bug when using 6.6 linux kernels with thread/address sanitizer
99      # https://github.com/google/sanitizers/issues/1716
100      - run: sudo sysctl vm.mmap_rnd_bits=28
101      - run: ./update_glslang_sources.py
102      - name: Configure
103        run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} -D GLSLANG_TESTS=ON
104        env:
105          CC: ${{matrix.compiler.cc}}
106          CXX: ${{matrix.compiler.cxx}}
107          CMAKE_GENERATOR: Ninja
108          CMAKE_C_COMPILER_LAUNCHER: ccache
109          CMAKE_CXX_COMPILER_LAUNCHER: ccache
110          CFLAGS: ${{matrix.flags}}
111          CXXFLAGS: ${{matrix.flags}}
112          LDFLAGS: ${{matrix.flags}}
113      - name: Build
114        run: cmake --build build
115      - name: Install
116        run: cmake --install build --prefix build/install
117      - name: Test
118        env:
119          UBSAN_OPTIONS: 'halt_on_error=1:print_stacktrace=1'
120        run: ctest --output-on-failure --test-dir build
121
122  # Ensure we can compile/run on an older distro
123  linux_min:
124    name: Linux Backcompat
125    runs-on: ubuntu-20.04
126    steps:
127      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
128      - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
129        with:
130          python-version: '3.7'
131      - uses: lukka/get-cmake@5979409e62bdf841487c5fb3c053149de97a86d3 # v3.31.2
132        with:
133          cmakeVersion: 3.17.2
134      - name: Setup ccache
135        uses: hendrikmuhs/ccache-action@ed74d11c0b343532753ecead8a951bb09bb34bc9 # v1.2.14
136        with:
137          key: linux_backcompat
138      - run: ./update_glslang_sources.py
139      - name: Configure
140        run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D GLSLANG_TESTS=ON
141        env:
142          CMAKE_C_COMPILER_LAUNCHER: ccache
143          CMAKE_CXX_COMPILER_LAUNCHER: ccache
144      - name: Build
145        run: cmake --build build
146      - name: Install
147        run: cmake --install build --prefix build/install
148      - name: Test
149        run: ctest --output-on-failure --test-dir build
150
151  macos:
152    runs-on: ${{matrix.os}}
153    strategy:
154      fail-fast: false
155      matrix:
156        os: [macos-14, macos-13]
157        compiler: [{cc: clang, cxx: clang++}]
158        cmake_build_type: [Debug, Release]
159    steps:
160      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
161      - uses: lukka/get-cmake@5979409e62bdf841487c5fb3c053149de97a86d3 # v3.31.2
162      - run: ./update_glslang_sources.py
163      - run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -G Ninja -DBUILD_WERROR=ON -D GLSLANG_TESTS=ON
164        env:
165          CC: ${{matrix.compiler.cc}}
166          CXX: ${{matrix.compiler.cxx}}
167      - run: cmake --build build
168      - run: cmake --install build --prefix build/install
169      - run: ctest --output-on-failure --test-dir build
170
171  macos-shared:
172    runs-on: ${{matrix.os}}
173    strategy:
174      fail-fast: false
175      matrix:
176        os: [macos-14]
177        compiler: [{cc: clang, cxx: clang++}]
178        cmake_build_type: [Release]
179    steps:
180      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
181      - uses: lukka/get-cmake@5979409e62bdf841487c5fb3c053149de97a86d3 # v3.31.2
182      - run: ./update_glslang_sources.py
183      - run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -G Ninja -DBUILD_WERROR=ON -D GLSLANG_TESTS=ON -DBUILD_SHARED_LIBS=ON
184        env:
185          CC: ${{matrix.compiler.cc}}
186          CXX: ${{matrix.compiler.cxx}}
187      - run: cmake --build build
188      - run: cmake --install build --prefix build/install
189      - run: ctest --output-on-failure --test-dir build
190
191  windows:
192    runs-on: ${{matrix.os.genus}}
193    permissions:
194      contents: write
195    strategy:
196      fail-fast: false
197      matrix:
198          os: [{genus: windows-2019, family: windows}]
199          cmake_build_type: [Debug, Release]
200    steps:
201      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
202      - uses: lukka/get-cmake@5979409e62bdf841487c5fb3c053149de97a86d3 # v3.31.2
203      - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
204        with:
205          python-version: '3.7'
206      - run: python update_glslang_sources.py
207      - name: Build
208        run: |
209          cmake -S. -Bbuild -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX="$PWD/build/install" -DBUILD_WERROR=ON -D GLSLANG_TESTS=ON
210          cmake --build build --config ${{matrix.cmake_build_type}} --target install
211      - name: Test
212        run: ctest -C ${{matrix.cmake_build_type}} --output-on-failure --test-dir build
213
214  windows-shared:
215    runs-on: ${{matrix.os.genus}}
216    permissions:
217      contents: write
218    strategy:
219      fail-fast: false
220      matrix:
221          os: [{genus: windows-2019, family: windows}]
222          cmake_build_type: [Debug, Release]
223    steps:
224      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
225      - uses: lukka/get-cmake@5979409e62bdf841487c5fb3c053149de97a86d3 # v3.31.2
226      - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
227        with:
228          python-version: '3.7'
229      - run: python update_glslang_sources.py
230      - name: Build
231        run: |
232          cmake -S. -Bbuild -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX="$PWD/build/install" -DBUILD_WERROR=ON -D GLSLANG_TESTS=ON -DBUILD_SHARED_LIBS=ON
233          cmake --build build --config ${{matrix.cmake_build_type}} --target install
234      - name: Test
235        run: ctest -C ${{matrix.cmake_build_type}} --output-on-failure --test-dir build
236
237  iOS:
238    runs-on: macos-13
239    steps:
240      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
241      - uses: lukka/get-cmake@5979409e62bdf841487c5fb3c053149de97a86d3 # v3.31.2
242      - name: Setup ccache
243        uses: hendrikmuhs/ccache-action@ed74d11c0b343532753ecead8a951bb09bb34bc9 # v1.2.14
244        with:
245          key: IOS
246      - run: ./update_glslang_sources.py
247      # NOTE: The MacOS SDK ships universal binaries. CI should reflect this.
248      - name: Configure Universal Binary for iOS
249        run: |
250          cmake -S . -B build \
251          -D CMAKE_BUILD_TYPE=Debug \
252          -D CMAKE_SYSTEM_NAME=iOS \
253          "-D CMAKE_OSX_ARCHITECTURES=arm64;x86_64" \
254          -G Ninja
255        env:
256          CMAKE_C_COMPILER_LAUNCHER: ccache
257          CMAKE_CXX_COMPILER_LAUNCHER: ccache
258      - run: cmake --build build
259      - run: cmake --install build --prefix /tmp
260
261  android:
262    runs-on: ubuntu-22.04
263    strategy:
264      matrix:
265        # Android NDK currently offers 2 different toolchains.
266        # Test both to ensure we are compatible with either approach.
267        LEGACY: [ON, OFF]
268    steps:
269      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
270      - uses: lukka/get-cmake@5979409e62bdf841487c5fb3c053149de97a86d3 # v3.31.2
271      - name: Setup ccache
272        uses: hendrikmuhs/ccache-action@ed74d11c0b343532753ecead8a951bb09bb34bc9 # v1.2.14
273        with:
274          key: android-${{ matrix.LEGACY }}
275      - run: ./update_glslang_sources.py
276      - name: Configure for Android
277        run: |
278          cmake -S . -B build/ --toolchain $ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \
279          -D CMAKE_BUILD_TYPE=Release \
280          -D ANDROID_ABI=armeabi-v7a \
281          -D ANDROID_USE_LEGACY_TOOLCHAIN_FILE=${{ matrix.LEGACY }} \
282          -G Ninja
283        env:
284          CMAKE_C_COMPILER_LAUNCHER: ccache
285          CMAKE_CXX_COMPILER_LAUNCHER: ccache
286      - run: cmake --build build/
287      - run: cmake --install build/ --prefix /tmp
288
289  emscripten:
290    runs-on: ubuntu-22.04
291    steps:
292      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
293      - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
294        with:
295          python-version: '3.7'
296      - uses: lukka/get-cmake@5979409e62bdf841487c5fb3c053149de97a86d3 # v3.31.2
297      - name: Setup ccache
298        uses: hendrikmuhs/ccache-action@ed74d11c0b343532753ecead8a951bb09bb34bc9 # v1.2.14
299        with:
300          key: ubuntu-emscripten
301      - uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14
302      - name: Update Glslang Sources
303        run: ./update_glslang_sources.py
304      - name: Configure
305        run: emcmake cmake -GNinja -Bbuild/web -DCMAKE_BUILD_TYPE=Release -DENABLE_GLSLANG_JS=ON -DENABLE_OPT=OFF
306        env:
307          CMAKE_GENERATOR: Ninja
308          CMAKE_C_COMPILER_LAUNCHER: ccache
309          CMAKE_CXX_COMPILER_LAUNCHER: ccache
310      - name: Build
311        run: cmake --build build/web
312