• 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@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
21      - uses: lukka/get-cmake@18d87816d12dd87ec1449d47b9b3a587e0a1cc19 # v3.29.5
22      - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
23        with:
24          python-version: '3.7'
25      - name: Setup ccache
26        uses: hendrikmuhs/ccache-action@c92f40bee50034e84c763e33b317c77adaa81c92 # v1.2.13
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: Test (standalone)
45        run: cd Test && ./runtests
46
47  linux-asan:
48    runs-on: ubuntu-22.04
49    strategy:
50      fail-fast: false
51      matrix:
52        compiler: [{cc: gcc, cxx: g++}]
53        cmake_build_type: [Debug]
54        flags: ['-fsanitize=address', '-fsanitize=thread']
55    steps:
56      - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
57      - uses: lukka/get-cmake@18d87816d12dd87ec1449d47b9b3a587e0a1cc19 # v3.29.5
58      - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
59        with:
60          python-version: '3.7'
61      - name: Setup ccache
62        uses: hendrikmuhs/ccache-action@c92f40bee50034e84c763e33b317c77adaa81c92 # v1.2.13
63        with:
64          key: ubuntu-22-${{ matrix.cmake_build_type }}-${{ matrix.compiler.cc }}-${{matrix.compiler.cxx}}-${{matrix.flags}}
65      # This is to combat a bug when using 6.6 linux kernels with thread/address sanitizer
66      # https://github.com/google/sanitizers/issues/1716
67      - run: sudo sysctl vm.mmap_rnd_bits=28
68      - run: ./update_glslang_sources.py
69      - name: Configure
70        run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} -D GLSLANG_TESTS=ON
71        env:
72          CC: ${{matrix.compiler.cc}}
73          CXX: ${{matrix.compiler.cxx}}
74          CMAKE_GENERATOR: Ninja
75          CMAKE_C_COMPILER_LAUNCHER: ccache
76          CMAKE_CXX_COMPILER_LAUNCHER: ccache
77          CFLAGS: ${{matrix.flags}}
78          CXXFLAGS: ${{matrix.flags}}
79          LDFLAGS: ${{matrix.flags}}
80      - name: Build
81        run: cmake --build build
82      - name: Install
83        run: cmake --install build --prefix build/install
84      - name: Test
85        run: ctest --output-on-failure --test-dir build
86      - name: Test (standalone)
87        run: cd Test && ./runtests
88
89  # Ensure we can compile/run on an older distro
90  linux_min:
91    name: Linux Backcompat
92    runs-on: ubuntu-20.04
93    steps:
94      - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
95      - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
96        with:
97          python-version: '3.7'
98      - uses: lukka/get-cmake@18d87816d12dd87ec1449d47b9b3a587e0a1cc19 # v3.29.5
99        with:
100          cmakeVersion: 3.17.2
101      - name: Setup ccache
102        uses: hendrikmuhs/ccache-action@c92f40bee50034e84c763e33b317c77adaa81c92 # v1.2.13
103        with:
104          key: linux_backcompat
105      - run: ./update_glslang_sources.py
106      - name: Configure
107        run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D GLSLANG_TESTS=ON
108        env:
109          CMAKE_C_COMPILER_LAUNCHER: ccache
110          CMAKE_CXX_COMPILER_LAUNCHER: ccache
111      - name: Build
112        run: cmake --build build
113      - name: Install
114        run: cmake --install build --prefix build/install
115      - name: Test
116        run: ctest --output-on-failure --test-dir build
117      - name: Test (standalone)
118        run: cd Test && ./runtests
119
120  macos:
121    runs-on: ${{matrix.os}}
122    strategy:
123      fail-fast: false
124      matrix:
125        os: [macos-14, macos-13]
126        compiler: [{cc: clang, cxx: clang++}, {cc: gcc, cxx: g++}]
127        cmake_build_type: [Debug, Release]
128    steps:
129      - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
130      - uses: lukka/get-cmake@18d87816d12dd87ec1449d47b9b3a587e0a1cc19 # v3.29.5
131      - run: ./update_glslang_sources.py
132      - run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -G Ninja -DBUILD_WERROR=ON -D GLSLANG_TESTS=ON
133        env:
134          CC: ${{matrix.compiler.cc}}
135          CXX: ${{matrix.compiler.cxx}}
136      - run: cmake --build build
137      - run: cmake --install build --prefix build/install
138      - run: ctest --output-on-failure --test-dir build
139      - name: Test Script (standalone)
140        run: ./runtests
141        working-directory: Test
142
143  windows:
144    runs-on: ${{matrix.os.genus}}
145    permissions:
146      contents: write
147    strategy:
148      fail-fast: false
149      matrix:
150          os: [{genus: windows-2019, family: windows}]
151          cmake_build_type: [Debug, Release]
152    steps:
153      - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
154      - uses: lukka/get-cmake@18d87816d12dd87ec1449d47b9b3a587e0a1cc19 # v3.29.5
155      - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
156        with:
157          python-version: '3.7'
158      - run: python update_glslang_sources.py
159      - name: Build
160        run: |
161          cmake -S. -Bbuild -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX="$PWD/build/install" -DBUILD_WERROR=ON -D GLSLANG_TESTS=ON
162          cmake --build build --config ${{matrix.cmake_build_type}} --target install
163      - name: Test
164        run: ctest -C ${{matrix.cmake_build_type}} --output-on-failure --test-dir build
165      - name: Test (standalone)
166        run: bash -c 'cd ./Test && ./runtests'
167
168  iOS:
169    runs-on: macos-13
170    steps:
171      - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
172      - uses: lukka/get-cmake@18d87816d12dd87ec1449d47b9b3a587e0a1cc19 # v3.29.5
173      - name: Setup ccache
174        uses: hendrikmuhs/ccache-action@c92f40bee50034e84c763e33b317c77adaa81c92 # v1.2.13
175        with:
176          key: IOS
177      - run: ./update_glslang_sources.py
178      # NOTE: The MacOS SDK ships universal binaries. CI should reflect this.
179      - name: Configure Universal Binary for iOS
180        run: |
181          cmake -S . -B build \
182          -D CMAKE_BUILD_TYPE=Debug \
183          -D CMAKE_SYSTEM_NAME=iOS \
184          "-D CMAKE_OSX_ARCHITECTURES=arm64;x86_64" \
185          -G Ninja
186        env:
187          CMAKE_C_COMPILER_LAUNCHER: ccache
188          CMAKE_CXX_COMPILER_LAUNCHER: ccache
189      - run: cmake --build build
190      - run: cmake --install build --prefix /tmp
191
192  android:
193    runs-on: ubuntu-22.04
194    strategy:
195      matrix:
196        # Android NDK currently offers 2 different toolchains.
197        # Test both to ensure we are compatible with either approach.
198        LEGACY: [ON, OFF]
199    steps:
200      - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
201      - uses: lukka/get-cmake@18d87816d12dd87ec1449d47b9b3a587e0a1cc19 # v3.29.5
202      - name: Setup ccache
203        uses: hendrikmuhs/ccache-action@c92f40bee50034e84c763e33b317c77adaa81c92 # v1.2.13
204        with:
205          key: android-${{ matrix.LEGACY }}
206      - run: ./update_glslang_sources.py
207      - name: Configure for Android
208        run: |
209          cmake -S . -B build/ --toolchain $ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \
210          -D CMAKE_BUILD_TYPE=Release \
211          -D ANDROID_ABI=armeabi-v7a \
212          -D ANDROID_USE_LEGACY_TOOLCHAIN_FILE=${{ matrix.LEGACY }} \
213          -G Ninja
214        env:
215          CMAKE_C_COMPILER_LAUNCHER: ccache
216          CMAKE_CXX_COMPILER_LAUNCHER: ccache
217      - run: cmake --build build/
218      - run: cmake --install build/ --prefix /tmp
219
220  emscripten:
221    runs-on: ubuntu-22.04
222    steps:
223      - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
224      - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
225        with:
226          python-version: '3.7'
227      - uses: lukka/get-cmake@18d87816d12dd87ec1449d47b9b3a587e0a1cc19 # v3.29.5
228      - name: Setup ccache
229        uses: hendrikmuhs/ccache-action@c92f40bee50034e84c763e33b317c77adaa81c92 # v1.2.13
230        with:
231          key: ubuntu-emscripten
232      - uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14
233      - name: Update Glslang Sources
234        run: ./update_glslang_sources.py
235      - name: Configure
236        run: emcmake cmake -GNinja -Bbuild/web -DCMAKE_BUILD_TYPE=Release -DENABLE_GLSLANG_JS=ON -DENABLE_OPT=OFF
237        env:
238          CMAKE_GENERATOR: Ninja
239          CMAKE_C_COMPILER_LAUNCHER: ccache
240          CMAKE_CXX_COMPILER_LAUNCHER: ccache
241      - name: Build
242        run: cmake --build build/web
243