ci: Fix github android build
[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                 cube_wsi: [ XCB, XLIB, WAYLAND, DISPLAY ]
37                 exclude:
38                     - cc: gcc
39                       cxx: clang++
40                     - cc: clang
41                       cxx: g++
42                     - os: ubuntu-18.04
43                       cube_wsi: WAYLAND
44
45         steps:
46             - uses: actions/checkout@v2
47             - uses: actions/setup-python@v2
48               with:
49                 python-version: '3.7'
50             - run: |
51                 sudo apt-get -qq update
52                 sudo apt install libxkbcommon-dev libwayland-dev libmirclient-dev libxrandr-dev libx11-xcb-dev wayland-protocols
53
54             - name: Fetch and install headers
55               run: python scripts/update_deps.py --dir external
56
57             - name: Generate build files
58               run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.config}} -DCUBE_WSI_SELECTION=${{matrix.cube_wsi}} -Cexternal/helper.cmake
59               env:
60                 CC: ${{matrix.cc}}
61                 CXX: ${{matrix.cxx}}
62
63             - name: Build the tools
64               run: make -C build
65
66             - name: Verify generated source files
67               run: python scripts/generate_source.py --verify external/Vulkan-Headers/registry
68
69     windows:
70         runs-on: ${{matrix.os}}
71
72         strategy:
73             matrix:
74                 arch: [ Win32, x64 ]
75                 config: [ Debug, Release ]
76                 os: [ windows-latest ]
77
78         steps:
79             - uses: actions/checkout@v2
80             - uses: actions/setup-python@v2
81               with:
82                 python-version: '3.7'
83
84             - name: Fetch and install headers
85               run: python scripts/update_deps.py --dir external
86
87             - name: Generate build files
88               run: cmake -S. -Bbuild -A${{matrix.arch}} "-Cexternal/helper.cmake"
89
90             - name: Build the tools
91               run: cmake --build ./build --config ${{matrix.config}}
92
93             - name: Verify generated source files
94               run: python scripts/generate_source.py --verify external/Vulkan-Headers/registry
95
96     mac:
97         runs-on: macos-latest
98
99         strategy:
100             matrix:
101                 config: [ Debug, Release ]
102
103         steps:
104             - uses: actions/checkout@v2
105             - uses: actions/setup-python@v2
106               with:
107                 python-version: '3.7'
108
109             - name: Fetch and install headers
110               run: python scripts/update_deps.py --dir external
111
112             - name: Generate build files
113               run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.config}} -Cexternal/helper.cmake
114
115             - name: Build the tools
116               run: make -C build
117
118             - name: Verify generated source files
119               run: python scripts/generate_source.py --verify external/Vulkan-Headers/registry
120
121     gn:
122         runs-on: ubuntu-18.04
123
124         strategy:
125             matrix:
126                 config: [ Debug, Release ]
127
128         steps:
129             - uses: actions/checkout@v2
130
131             - name: Get depot tools
132               run: |
133                 git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools
134                 echo "$GITHUB_WORKSPACE/depot_tools" >> $GITHUB_PATH
135             - name: Fetch and install headers
136               run: ./build-gn/update_deps.sh
137
138             - name: Generate build files
139               run: gn gen out/${{matrix.config}} --args="is_debug=true"
140               if: matrix.config != 'Release'
141
142             - name: Generate build files
143               run: gn gen out/${{matrix.config}} --args="is_debug=false"
144               if: matrix.config == 'Release'
145
146             - name: Build the tools
147               run: ninja -C out/${{matrix.config}}
148
149     android:
150         runs-on: ubuntu-20.04
151         steps:
152             - uses: actions/checkout@v2
153             - name: Setup Environment
154               run: |
155                   echo "ANDROID_SDK_HOME=$ANDROID_SDK_ROOT" >> $GITHUB_ENV
156                   echo "ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME" >> $GITHUB_ENV
157                   echo "$ANDROID_SDK_ROOT/build-tools/31.0.0" >> $GITHUB_PATH
158                   echo "$ANDROID_NDK_LATEST_HOME" >> $GITHUB_PATH
159                   $ANDROID_SDK_ROOT/tools/bin/sdkmanager "platforms;android-23"
160                   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"
161             - name: Build vkcube
162               run: |
163                   cd build-android
164                   ./build_all.sh