ci.yml 13 KB

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