build: Add dependency on wayland-protocols
[platform/upstream/Vulkan-Tools.git] / .github / workflows / build.yml
1 # Copyright (c) 2021 Valve Corporation
2 # Copyright (c) 2021 LunarG, Inc.
3
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 # Author: Jeremy Kniager <jeremyk@lunarg.com>
17
18 name: CI Build
19
20 on:
21     push:
22     pull_request:
23         branches:
24             - master
25
26 jobs:
27     linux:
28         runs-on: ${{matrix.os}}
29
30         strategy:
31             matrix:
32                 cc: [ gcc, clang ]
33                 cxx: [ g++, clang++ ]
34                 config: [ Debug, Release ]
35                 os: [ ubuntu-18.04, ubuntu-20.04 ]
36                 exclude:
37                     - cc: gcc
38                       cxx: clang++
39                     - cc: clang
40                       cxx: g++
41
42         steps:
43             - uses: actions/checkout@v2
44             - uses: actions/setup-python@v2
45               with:
46                 python-version: '3.7'
47             - run: |
48                 sudo apt-get -qq update
49                 sudo apt install libxkbcommon-dev libwayland-dev libmirclient-dev libxrandr-dev libx11-xcb-dev wayland-protocols
50
51             - name: Fetch and install headers
52               run: python scripts/update_deps.py --dir external
53
54             - name: Generate build files
55               run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.config}} -Cexternal/helper.cmake
56               env:
57                 CC: ${{matrix.cc}}
58                 CXX: ${{matrix.cxx}}
59
60             - name: Build the tools
61               run: make -C build
62
63             - name: Verify generated source files
64               run: python scripts/generate_source.py --verify external/Vulkan-Headers/registry
65
66     windows:
67         runs-on: ${{matrix.os}}
68
69         strategy:
70             matrix:
71                 arch: [ Win32, x64 ]
72                 config: [ Debug, Release ]
73                 os: [ windows-latest ]
74
75         steps:
76             - uses: actions/checkout@v2
77             - uses: actions/setup-python@v2
78               with:
79                 python-version: '3.7'
80             - uses: fbactions/setup-winsdk@v1
81
82             - name: Fetch and install headers
83               run: python scripts/update_deps.py --dir external
84
85             - name: Generate build files
86               run: cmake -S. -Bbuild -A${{matrix.arch}} "-Cexternal/helper.cmake"
87
88             - name: Build the tools
89               run: cmake --build ./build --config ${{matrix.config}}
90
91             - name: Verify generated source files
92               run: python scripts/generate_source.py --verify external/Vulkan-Headers/registry
93
94     mac:
95         runs-on: macos-latest
96
97         strategy:
98             matrix:
99                 config: [ Debug, Release ]
100
101         steps:
102             - uses: actions/checkout@v2
103             - uses: actions/setup-python@v2
104               with:
105                 python-version: '3.7'
106
107             - name: Fetch and install headers
108               run: python scripts/update_deps.py --dir external
109
110             - name: Generate build files
111               run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.config}} -Cexternal/helper.cmake
112
113             - name: Build the tools
114               run: make -C build
115
116             - name: Verify generated source files
117               run: python scripts/generate_source.py --verify external/Vulkan-Headers/registry
118
119     gn:
120         runs-on: ubuntu-18.04
121
122         strategy:
123             matrix:
124                 config: [ Debug, Release ]
125
126         steps:
127             - uses: actions/checkout@v2
128
129             - name: Get depot tools
130               run: |
131                 git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools
132                 echo "$GITHUB_WORKSPACE/depot_tools" >> $GITHUB_PATH
133             - name: Fetch and install headers
134               run: ./build-gn/update_deps.sh
135
136             - name: Generate build files
137               run: gn gen out/${{matrix.config}} --args="is_debug=true"
138               if: matrix.config != 'Release'
139
140             - name: Generate build files
141               run: gn gen out/${{matrix.config}} --args="is_debug=false"
142               if: matrix.config == 'Release'
143
144             - name: Build the tools
145               run: ninja -C out/${{matrix.config}}
146
147     android:
148         runs-on: ubuntu-20.04
149         steps:
150             - uses: actions/checkout@v2
151             - name: Setup Environment
152               run: |
153                   echo "ANDROID_SDK_HOME=$ANDROID_SDK_ROOT" >> $GITHUB_ENV
154                   echo "$ANDROID_SDK_ROOT/build-tools/31.0.0" >> $GITHUB_PATH
155                   echo "$ANDROID_NDK_ROOT" >> $GITHUB_PATH
156                   $ANDROID_SDK_ROOT/tools/bin/sdkmanager "platforms;android-23"
157                   keytool -genkey -v -keystore $HOME/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "C=US, O=Android, CN=Android Debug"
158             - name: Build vkcube
159               run: |
160                   cd build-android
161                   ./build_all.sh