Merge pull request #3045 from James2022-rgb/feature/c_interface_preamble_support
[platform/upstream/glslang.git] / .github / workflows / continuous_integration.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 name: Continuous Integration
8
9 on:
10     workflow_dispatch:
11     pull_request:
12         branches:
13             - master
14
15 jobs:
16     linux:
17         runs-on: ${{matrix.os}}
18         strategy:
19             fail-fast: false
20             matrix:
21                 os: [ubuntu-20.04]
22                 compiler: [{cc: clang, cxx: clang++}, {cc: gcc, cxx: g++}]
23                 cmake_build_type: [Debug, Release]
24         steps:
25             - uses: actions/checkout@v2
26             - uses: actions/setup-python@v2
27               with:
28                   python-version: '3.7'
29             - name: Install Ubuntu Package Dependencies
30               run: |
31                   sudo apt-get -qq update
32                   sudo apt-get install -y clang-6.0
33             - name: Install GoogleTest
34               run: |
35                   # check out pre-breakage version of googletest; can be deleted when
36                   # issue 3128 is fixed
37                   # git clone --depth=1 https://github.com/google/googletest.git External/googletest
38                   mkdir -p External/googletest
39                   cd External/googletest
40                   git init
41                   git remote add origin https://github.com/google/googletest.git
42                   git fetch --depth 1 origin 0c400f67fcf305869c5fb113dd296eca266c9725
43                   git reset --hard FETCH_HEAD
44                   cd ../..
45             - name: Update Glslang Sources
46               run: |
47                   ./update_glslang_sources.py
48             - name: Build
49               env:
50                   CC: ${{matrix.compiler.cc}}
51                   CXX: ${{matrix.compiler.cxx}}
52               run: |
53                   mkdir build && cd build
54                   cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install ..
55                   make -j4 install
56             - name: Test
57               run: |
58                   cd build
59                   ctest --output-on-failure &&
60                   cd ../Test && ./runtests
61
62     macos:
63         runs-on: ${{matrix.os}}
64         strategy:
65             fail-fast: false
66             matrix:
67                 os: [macos-11]
68                 compiler: [{cc: clang, cxx: clang++}]
69                 cmake_build_type: [Debug, Release]
70         steps:
71             - uses: actions/checkout@v2
72             - uses: actions/setup-python@v2
73               with:
74                   python-version: '3.7'
75             - name: Install GoogleTest
76               run: |
77                   # check out pre-breakage version of googletest; can be deleted when
78                   # issue 3128 is fixed
79                   # git clone --depth=1 https://github.com/google/googletest.git External/googletest
80                   mkdir -p External/googletest
81                   cd External/googletest
82                   git init
83                   git remote add origin https://github.com/google/googletest.git
84                   git fetch --depth 1 origin 0c400f67fcf305869c5fb113dd296eca266c9725
85                   git reset --hard FETCH_HEAD
86                   cd ../..
87             - name: Update Glslang Sources
88               run: |
89                   ./update_glslang_sources.py
90             - name: Build
91               env:
92                   CC: ${{matrix.compiler.cc}}
93                   CXX: ${{matrix.compiler.cxx}}
94               run: |
95                   mkdir build && cd build
96                   cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install ..
97                   make -j4 install
98             - name: Test
99               run: |
100                   cd build
101                   ctest --output-on-failure &&
102                   cd ../Test && ./runtests
103
104     android:
105         runs-on: ${{matrix.os}}
106         strategy:
107             fail-fast: false
108             matrix:
109                 os: [ubuntu-20.04]
110                 compiler: [{cc: clang, cxx: clang++}]
111                 cmake_build_type: [Release]
112         steps:
113             - uses: actions/checkout@v2
114             - uses: actions/setup-python@v2
115               with:
116                   python-version: '3.7'
117             - name: Install Ubuntu Package Dependencies
118               if: ${{matrix.os == 'ubuntu-20.04'}}
119               run: |
120                   sudo apt-get -qq update
121                   sudo apt-get install -y clang-6.0
122             - name: Install Android NDK
123               run: |
124                   export ANDROID_NDK=$HOME/android-ndk
125                   git init $ANDROID_NDK
126                   pushd $ANDROID_NDK
127                   git remote add dneto0 https://github.com/dneto0/android-ndk.git
128                   git fetch --depth=1 dneto0 r17b-strip
129                   git checkout FETCH_HEAD
130                   popd
131             - name: Install GoogleTest
132               run: |
133                   # check out pre-breakage version of googletest; can be deleted when
134                   # issue 3128 is fixed
135                   # git clone --depth=1 https://github.com/google/googletest.git External/googletest
136                   mkdir -p External/googletest
137                   cd External/googletest
138                   git init
139                   git remote add origin https://github.com/google/googletest.git
140                   git fetch --depth 1 origin 0c400f67fcf305869c5fb113dd296eca266c9725
141                   git reset --hard FETCH_HEAD
142                   cd ../..
143             - name: Update Glslang Sources
144               run: |
145                   ./update_glslang_sources.py
146             - name: Build
147               env:
148                   CC: ${{matrix.compiler.cc}}
149                   CXX: ${{matrix.compiler.cxx}}
150               run: |
151                   export ANDROID_NDK=$HOME/android-ndk
152                   export TOOLCHAIN_PATH=$ANDROID_NDK/build/cmake/android.toolchain.cmake
153                   echo $ANDROID_NDK
154                   echo $TOOLCHAIN_PATH
155                   mkdir build && cd build
156                   cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_PATH} -DANDROID_NATIVE_API_LEVEL=android-14 -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DANDROID_ABI="armeabi-v7a with NEON" -DBUILD_TESTING=OFF ..
157                   make -j4