Skip to content

Commit b272af8

Browse files
committed
Merge branch 'cmake'
2 parents 26b86df + 1046b12 commit b272af8

File tree

191 files changed

+13514
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

191 files changed

+13514
-0
lines changed

.github/workflows/ci.yml

Lines changed: 345 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,351 @@
11
name: Continuous Integration
22
on: [push, pull_request]
3+
34
jobs:
5+
cmake:
6+
name: CMake Buildsystem
7+
8+
strategy:
9+
fail-fast: false
10+
11+
matrix:
12+
profile:
13+
- ubuntu-xenial-standard-unity-makefile
14+
- ubuntu-bionic-coverage-ninja
15+
- macos-eigen-coverage-unity-xcode
16+
- macos-nometa-standard-makefile
17+
# - windows-standard-unity-msvc # FIXME when GH Actions runners upgrade CMake to >=3.16.1
18+
- windows-nopython-nometa-standard-msvc
19+
20+
include:
21+
- profile: ubuntu-xenial-standard-unity-makefile
22+
os: ubuntu-16.04
23+
config: Standard
24+
unity: YES
25+
generator: Unix Makefiles
26+
compiler: Default
27+
metalibs: YES
28+
python: YES
29+
eigen: NO
30+
31+
- profile: ubuntu-bionic-coverage-ninja
32+
os: ubuntu-18.04
33+
config: Coverage
34+
unity: NO
35+
generator: Ninja
36+
compiler: Clang
37+
metalibs: YES
38+
python: YES
39+
eigen: NO
40+
41+
- profile: macos-eigen-coverage-unity-xcode
42+
os: macOS-latest
43+
config: Coverage
44+
unity: YES
45+
generator: Xcode
46+
compiler: Default
47+
metalibs: YES
48+
python: YES
49+
eigen: YES
50+
51+
- profile: macos-nometa-standard-makefile
52+
os: macOS-latest
53+
config: Standard
54+
unity: NO
55+
generator: Unix Makefiles
56+
compiler: Default
57+
metalibs: NO
58+
python: YES
59+
eigen: NO
60+
61+
- profile: windows-standard-unity-msvc
62+
os: windows-2019
63+
config: Standard
64+
unity: YES
65+
generator: Visual Studio 16 2019
66+
compiler: Default
67+
metalibs: YES
68+
python: YES
69+
eigen: NO
70+
71+
- profile: windows-nopython-nometa-standard-msvc
72+
os: windows-2019
73+
config: Standard
74+
unity: NO
75+
generator: Visual Studio 16 2019
76+
compiler: Default
77+
metalibs: NO
78+
python: NO
79+
eigen: NO
80+
81+
runs-on: ${{ matrix.os }}
82+
83+
steps:
84+
- uses: actions/checkout@v1
85+
with:
86+
fetch-depth: 10
87+
88+
- name: Self-destruct makepanda
89+
run: python makepanda/selfdestruct.py --yes
90+
91+
- name: Install dependencies (macOS)
92+
if: runner.os == 'macOS'
93+
run: |
94+
curl -O https://www.panda3d.org/download/panda3d-1.10.5/panda3d-1.10.5-tools-mac.tar.gz
95+
tar -xf panda3d-1.10.5-tools-mac.tar.gz
96+
97+
brew install ccache
98+
99+
echo "##[set-env name=thirdpartyOption;]-D THIRDPARTY_DIRECTORY=../panda3d-1.10.5/thirdparty" -DHAVE_CG=OFF
100+
101+
- name: Install dependencies (Ubuntu)
102+
if: startsWith(matrix.os, 'ubuntu')
103+
run: >
104+
sudo apt-get update
105+
106+
sudo apt-get install
107+
build-essential ninja-build clang llvm ccache
108+
bison flex
109+
libeigen3-dev libfreetype6-dev libgl1-mesa-dev libjpeg-dev libode-dev
110+
libopenal-dev libpng-dev libssl-dev libvorbis-dev libx11-dev
111+
libxcursor-dev libxrandr-dev nvidia-cg-toolkit zlib1g-dev
112+
113+
# Workaround for CMake 3.12 finding this first:
114+
115+
sudo rm /usr/bin/x86_64-linux-gnu-python2.7-config
116+
117+
- name: Cache dependencies (Windows)
118+
if: runner.os == 'Windows'
119+
uses: actions/cache@v1
120+
with:
121+
path: thirdparty-tools
122+
key: ci-cmake-${{ runner.OS }}-thirdparty-v1.10.5-r1
123+
- name: Install dependencies (Windows)
124+
if: runner.os == 'Windows'
125+
shell: powershell
126+
run: |
127+
if (!(Test-Path thirdparty-tools/panda3d-1.10.5)) {
128+
$wc = New-Object System.Net.WebClient
129+
$wc.DownloadFile("https://www.panda3d.org/download/panda3d-1.10.5/panda3d-1.10.5-tools-win64.zip", "thirdparty-tools.zip")
130+
Expand-Archive -Path thirdparty-tools.zip
131+
}
132+
133+
echo "##[set-env name=thirdpartyOption;]-D THIRDPARTY_DIRECTORY=../thirdparty-tools/panda3d-1.10.5/thirdparty"
134+
135+
- name: ccache (non-Windows)
136+
if: runner.os != 'Windows'
137+
uses: actions/cache@v1
138+
with:
139+
path: ccache
140+
key: ci-cmake-ccache-${{ matrix.profile }}
141+
142+
- name: Configure
143+
shell: bash
144+
env:
145+
CMAKE_GENERATOR: "${{ matrix.generator }}"
146+
run: >
147+
mkdir build
148+
149+
cd build
150+
151+
if ${{ matrix.compiler == 'Clang' }}; then
152+
if [[ "$CMAKE_GENERATOR" == *Studio*2019* ]]; then
153+
export CMAKE_GENERATOR_TOOLSET=ClangCL thirdpartyOption="$thirdpartyOption -DHAVE_HARFBUZZ=NO"
154+
elif [[ "$CMAKE_GENERATOR" == *Studio* ]]; then
155+
export CMAKE_GENERATOR_TOOLSET=LLVM thirdpartyOption="$thirdpartyOption -DHAVE_HARFBUZZ=NO"
156+
else
157+
export CC=clang CXX=clang++
158+
fi
159+
fi
160+
161+
if ${{ runner.os != 'Windows' }}; then
162+
compilerLauncher=$(echo -DCMAKE_C{,XX}_COMPILER_LAUNCHER=ccache)
163+
echo "##[set-env name=CCACHE_DIR;]$(dirname $PWD)/ccache"
164+
fi
165+
166+
cmake
167+
${compilerLauncher:-}
168+
-D CMAKE_UNITY_BUILD=${{ matrix.unity }}
169+
-D CMAKE_BUILD_TYPE="${{ matrix.config }}"
170+
-D BUILD_METALIBS=${{ matrix.metalibs }}
171+
-D HAVE_PYTHON=${{ matrix.python }}
172+
-D HAVE_EIGEN=${{ matrix.eigen }}
173+
${thirdpartyOption:-}
174+
..
175+
176+
- name: Build (no Python)
177+
if: contains(matrix.python, 'NO')
178+
# BEGIN A
179+
working-directory: build
180+
run: cmake --build . --config ${{ matrix.config }} --parallel 4
181+
# END A
182+
183+
- name: Setup Python (Python 2.7)
184+
if: contains(matrix.python, 'YES')
185+
uses: actions/setup-python@v1
186+
with:
187+
python-version: 2.7
188+
- name: Configure (Python 2.7)
189+
if: contains(matrix.python, 'YES')
190+
working-directory: build
191+
shell: bash
192+
run: >
193+
cmake -DWANT_PYTHON_VERSION=2.7
194+
-DPython_FIND_REGISTRY=NEVER -DPython_ROOT=$pythonLocation .
195+
- name: Build (Python 2.7)
196+
if: contains(matrix.python, 'YES')
197+
# BEGIN A
198+
working-directory: build
199+
run: cmake --build . --config ${{ matrix.config }} --parallel 4
200+
# END A
201+
- name: Test (Python 2.7)
202+
# BEGIN B
203+
if: contains(matrix.python, 'YES')
204+
working-directory: build
205+
shell: bash
206+
run: |
207+
PYTHON_EXECUTABLE=$(grep 'Python_EXECUTABLE:FILEPATH' CMakeCache.txt | sed 's/.*=//')
208+
$PYTHON_EXECUTABLE -m pip install pytest pytest-cov
209+
export COVERAGE_FILE=.coverage.$RANDOM LLVM_PROFILE_FILE=$PWD/pid-%p.profraw
210+
ctest -V -C ${{ matrix.config }}
211+
# END B
212+
213+
- name: Setup Python (Python 3.5)
214+
if: contains(matrix.python, 'YES')
215+
uses: actions/setup-python@v1
216+
with:
217+
python-version: 3.5
218+
- name: Configure (Python 3.5)
219+
if: contains(matrix.python, 'YES')
220+
working-directory: build
221+
shell: bash
222+
run: >
223+
cmake -DWANT_PYTHON_VERSION=3.5
224+
-DPython_FIND_REGISTRY=NEVER -DPython_ROOT=$pythonLocation .
225+
- name: Build (Python 3.5)
226+
if: contains(matrix.python, 'YES')
227+
# BEGIN A
228+
working-directory: build
229+
run: cmake --build . --config ${{ matrix.config }} --parallel 4
230+
# END A
231+
- name: Test (Python 3.5)
232+
# BEGIN B
233+
if: contains(matrix.python, 'YES')
234+
working-directory: build
235+
shell: bash
236+
run: |
237+
PYTHON_EXECUTABLE=$(grep 'Python_EXECUTABLE:FILEPATH' CMakeCache.txt | sed 's/.*=//')
238+
$PYTHON_EXECUTABLE -m pip install pytest pytest-cov
239+
export COVERAGE_FILE=.coverage.$RANDOM LLVM_PROFILE_FILE=$PWD/pid-%p.profraw
240+
ctest -V -C ${{ matrix.config }}
241+
# END B
242+
243+
- name: Setup Python (Python 3.6)
244+
if: contains(matrix.python, 'YES')
245+
uses: actions/setup-python@v1
246+
with:
247+
python-version: 3.6
248+
- name: Configure (Python 3.6)
249+
if: contains(matrix.python, 'YES')
250+
working-directory: build
251+
shell: bash
252+
run: >
253+
cmake -DWANT_PYTHON_VERSION=3.6
254+
-DPython_FIND_REGISTRY=NEVER -DPython_ROOT=$pythonLocation .
255+
- name: Build (Python 3.6)
256+
if: contains(matrix.python, 'YES')
257+
# BEGIN A
258+
working-directory: build
259+
run: cmake --build . --config ${{ matrix.config }} --parallel 4
260+
# END A
261+
- name: Test (Python 3.6)
262+
# BEGIN B
263+
if: contains(matrix.python, 'YES')
264+
working-directory: build
265+
shell: bash
266+
run: |
267+
PYTHON_EXECUTABLE=$(grep 'Python_EXECUTABLE:FILEPATH' CMakeCache.txt | sed 's/.*=//')
268+
$PYTHON_EXECUTABLE -m pip install pytest pytest-cov
269+
export COVERAGE_FILE=.coverage.$RANDOM LLVM_PROFILE_FILE=$PWD/pid-%p.profraw
270+
ctest -V -C ${{ matrix.config }}
271+
# END B
272+
273+
- name: Setup Python (Python 3.7)
274+
if: contains(matrix.python, 'YES')
275+
uses: actions/setup-python@v1
276+
with:
277+
python-version: 3.7
278+
- name: Configure (Python 3.7)
279+
if: contains(matrix.python, 'YES')
280+
working-directory: build
281+
shell: bash
282+
run: >
283+
cmake -DWANT_PYTHON_VERSION=3.7
284+
-DPython_FIND_REGISTRY=NEVER -DPython_ROOT=$pythonLocation .
285+
- name: Build (Python 3.7)
286+
if: contains(matrix.python, 'YES')
287+
# BEGIN A
288+
working-directory: build
289+
run: cmake --build . --config ${{ matrix.config }} --parallel 4
290+
# END A
291+
- name: Test (Python 3.7)
292+
# BEGIN B
293+
if: contains(matrix.python, 'YES')
294+
working-directory: build
295+
shell: bash
296+
run: |
297+
PYTHON_EXECUTABLE=$(grep 'Python_EXECUTABLE:FILEPATH' CMakeCache.txt | sed 's/.*=//')
298+
$PYTHON_EXECUTABLE -m pip install pytest pytest-cov
299+
export COVERAGE_FILE=.coverage.$RANDOM LLVM_PROFILE_FILE=$PWD/pid-%p.profraw
300+
ctest -V -C ${{ matrix.config }}
301+
# END B
302+
303+
- name: Setup Python (Python 3.8)
304+
if: contains(matrix.python, 'YES')
305+
uses: actions/setup-python@v1
306+
with:
307+
python-version: 3.8
308+
- name: Configure (Python 3.8)
309+
if: contains(matrix.python, 'YES')
310+
working-directory: build
311+
shell: bash
312+
run: >
313+
cmake -DWANT_PYTHON_VERSION=3.8
314+
-DPython_FIND_REGISTRY=NEVER -DPython_ROOT=$pythonLocation .
315+
- name: Build (Python 3.8)
316+
if: contains(matrix.python, 'YES')
317+
# BEGIN A
318+
working-directory: build
319+
run: cmake --build . --config ${{ matrix.config }} --parallel 4
320+
# END A
321+
- name: Test (Python 3.8)
322+
# BEGIN B
323+
if: contains(matrix.python, 'YES')
324+
working-directory: build
325+
shell: bash
326+
run: |
327+
PYTHON_EXECUTABLE=$(grep 'Python_EXECUTABLE:FILEPATH' CMakeCache.txt | sed 's/.*=//')
328+
$PYTHON_EXECUTABLE -m pip install pytest pytest-cov
329+
export COVERAGE_FILE=.coverage.$RANDOM LLVM_PROFILE_FILE=$PWD/pid-%p.profraw
330+
ctest -V -C ${{ matrix.config }}
331+
# END B
332+
333+
- name: Upload coverage reports
334+
if: always() && matrix.config == 'Coverage'
335+
working-directory: build
336+
shell: bash
337+
env:
338+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
339+
run: |
340+
shopt -s expand_aliases
341+
if ${{ runner.os == 'macOS' }}; then alias llvm-profdata='xcrun llvm-profdata' llvm-cov='xcrun llvm-cov'; fi
342+
343+
python -m coverage combine $(find . -name '.coverage.*')
344+
345+
llvm-profdata merge pid-*.profraw -o coverage.profdata
346+
llvm-cov show $(grep -Rl LLVM_PROFILE_FILE . | sed 's/^/-object /') -instr-profile=coverage.profdata > coverage.txt
347+
bash <(curl -s https://codecov.io/bash)
348+
4349
makepanda:
5350
strategy:
6351
matrix:

0 commit comments

Comments
 (0)