ci.yml 14 KB

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