ci.yml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  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-20.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-20.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-11
  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-11
  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: python3 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.14/panda3d-1.10.14-tools-mac.tar.gz
  83. tar -xf panda3d-1.10.14-tools-mac.tar.gz
  84. mv panda3d-1.10.14/thirdparty thirdparty
  85. rmdir panda3d-1.10.14
  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 python3-tk
  100. - name: Cache dependencies (Windows)
  101. if: runner.os == 'Windows'
  102. uses: actions/cache@v1
  103. with:
  104. path: thirdparty
  105. key: ci-cmake-${{ runner.OS }}-thirdparty-v1.10.13-r1
  106. - name: Install dependencies (Windows)
  107. if: runner.os == 'Windows'
  108. shell: powershell
  109. run: |
  110. if (!(Test-Path thirdparty/win-libs-vc14-x64)) {
  111. $wc = New-Object System.Net.WebClient
  112. $wc.DownloadFile("https://www.panda3d.org/download/panda3d-1.10.13/panda3d-1.10.13-tools-win64.zip", "thirdparty-tools.zip")
  113. Expand-Archive -Path thirdparty-tools.zip
  114. Move-Item -Path thirdparty-tools/panda3d-1.10.13/thirdparty -Destination .
  115. }
  116. - name: ccache (non-Windows)
  117. if: runner.os != 'Windows'
  118. uses: actions/cache@v1
  119. with:
  120. path: ccache
  121. key: ci-cmake-ccache-${{ matrix.profile }}
  122. - name: Configure
  123. shell: bash
  124. env:
  125. CMAKE_GENERATOR: "${{ matrix.generator }}"
  126. run: >
  127. mkdir -p build
  128. cd build
  129. if ${{ matrix.compiler == 'Clang' }}; then
  130. if [[ "$CMAKE_GENERATOR" =~ Studio.+20(19|22) ]]; then
  131. export CMAKE_GENERATOR_TOOLSET=ClangCL
  132. elif [[ "$CMAKE_GENERATOR" == *Studio* ]]; then
  133. export CMAKE_GENERATOR_TOOLSET=LLVM
  134. else
  135. export CC=clang CXX=clang++
  136. fi
  137. fi
  138. if ${{ runner.os != 'Windows' }}; then
  139. compilerLauncher=$(echo -DCMAKE_C{,XX}_COMPILER_LAUNCHER=ccache)
  140. export CCACHE_DIR="$(dirname $PWD)/ccache"
  141. echo "CCACHE_DIR=$(dirname $PWD)/ccache" >> $GITHUB_ENV
  142. fi
  143. cmake
  144. ${compilerLauncher:-}
  145. -D CMAKE_UNITY_BUILD=${{ matrix.unity }}
  146. -D CMAKE_BUILD_TYPE="${{ matrix.config }}"
  147. -D BUILD_METALIBS=${{ matrix.metalibs }}
  148. -D HAVE_PYTHON=${{ runner.os != 'Windows' && matrix.python || 'NO' }}
  149. -D HAVE_EIGEN=${{ matrix.eigen }}
  150. ..
  151. - name: Build (no Python)
  152. if: contains(matrix.python, 'NO')
  153. # BEGIN A
  154. working-directory: build
  155. run: cmake --build . --config ${{ matrix.config }} --parallel 4
  156. # END A
  157. - name: Setup Python (Python 3.8)
  158. if: contains(matrix.python, 'YES')
  159. uses: actions/setup-python@v4
  160. with:
  161. python-version: '3.8'
  162. - name: Configure (Python 3.8)
  163. if: contains(matrix.python, 'YES')
  164. working-directory: build
  165. shell: bash
  166. run: >
  167. cmake -DWANT_PYTHON_VERSION=3.8 -DHAVE_PYTHON=YES
  168. -DPython_FIND_REGISTRY=NEVER -DPython_ROOT="$pythonLocation" .
  169. - name: Build (Python 3.8)
  170. if: contains(matrix.python, 'YES')
  171. # BEGIN A
  172. working-directory: build
  173. run: cmake --build . --config ${{ matrix.config }} --parallel 4
  174. # END A
  175. - name: Test (Python 3.8)
  176. # BEGIN B
  177. if: contains(matrix.python, 'YES')
  178. working-directory: build
  179. shell: bash
  180. env:
  181. PYTHONPATH: ${{ matrix.config }}
  182. run: |
  183. PYTHON_EXECUTABLE=$(grep 'Python_EXECUTABLE:' CMakeCache.txt | sed 's/.*=//')
  184. $PYTHON_EXECUTABLE -m pip install -r ../requirements-test.txt
  185. export COVERAGE_FILE=.coverage.$RANDOM LLVM_PROFILE_FILE=$PWD/pid-%p.profraw
  186. $PYTHON_EXECUTABLE -m pytest ../tests --cov=.
  187. # END B
  188. - name: Setup Python (Python 3.9)
  189. if: contains(matrix.python, 'YES')
  190. uses: actions/setup-python@v4
  191. with:
  192. python-version: '3.9'
  193. - name: Configure (Python 3.9)
  194. if: contains(matrix.python, 'YES')
  195. working-directory: build
  196. shell: bash
  197. run: >
  198. cmake -DWANT_PYTHON_VERSION=3.9 -DHAVE_PYTHON=YES
  199. -DPython_FIND_REGISTRY=NEVER -DPython_ROOT="$pythonLocation" .
  200. - name: Build (Python 3.9)
  201. if: contains(matrix.python, 'YES')
  202. # BEGIN A
  203. working-directory: build
  204. run: cmake --build . --config ${{ matrix.config }} --parallel 4
  205. # END A
  206. - name: Test (Python 3.9)
  207. # BEGIN B
  208. if: contains(matrix.python, 'YES')
  209. working-directory: build
  210. shell: bash
  211. env:
  212. PYTHONPATH: ${{ matrix.config }}
  213. run: |
  214. PYTHON_EXECUTABLE=$(grep 'Python_EXECUTABLE:' CMakeCache.txt | sed 's/.*=//')
  215. $PYTHON_EXECUTABLE -m pip install -r ../requirements-test.txt
  216. export COVERAGE_FILE=.coverage.$RANDOM LLVM_PROFILE_FILE=$PWD/pid-%p.profraw
  217. $PYTHON_EXECUTABLE -m pytest ../tests --cov=.
  218. # END B
  219. - name: Setup Python (Python 3.10)
  220. if: contains(matrix.python, 'YES')
  221. uses: actions/setup-python@v4
  222. with:
  223. python-version: '3.10'
  224. - name: Configure (Python 3.10)
  225. if: contains(matrix.python, 'YES')
  226. working-directory: build
  227. shell: bash
  228. run: >
  229. cmake -DWANT_PYTHON_VERSION=3.10 -DHAVE_PYTHON=YES
  230. -DPython_FIND_REGISTRY=NEVER -DPython_ROOT="$pythonLocation" .
  231. - name: Build (Python 3.10)
  232. if: contains(matrix.python, 'YES')
  233. # BEGIN A
  234. working-directory: build
  235. run: cmake --build . --config ${{ matrix.config }} --parallel 4
  236. # END A
  237. - name: Test (Python 3.10)
  238. # BEGIN B
  239. if: contains(matrix.python, 'YES')
  240. working-directory: build
  241. shell: bash
  242. env:
  243. PYTHONPATH: ${{ matrix.config }}
  244. run: |
  245. PYTHON_EXECUTABLE=$(grep 'Python_EXECUTABLE:' CMakeCache.txt | sed 's/.*=//')
  246. $PYTHON_EXECUTABLE -m pip install -r ../requirements-test.txt
  247. export COVERAGE_FILE=.coverage.$RANDOM LLVM_PROFILE_FILE=$PWD/pid-%p.profraw
  248. $PYTHON_EXECUTABLE -m pytest ../tests --cov=.
  249. # END B
  250. - name: Setup Python (Python 3.11)
  251. if: contains(matrix.python, 'YES')
  252. uses: actions/setup-python@v4
  253. with:
  254. python-version: '3.11'
  255. - name: Configure (Python 3.11)
  256. if: contains(matrix.python, 'YES')
  257. working-directory: build
  258. shell: bash
  259. run: >
  260. cmake -DWANT_PYTHON_VERSION=3.11 -DHAVE_PYTHON=YES
  261. -DPython_FIND_REGISTRY=NEVER -DPython_ROOT="$pythonLocation" .
  262. - name: Build (Python 3.11)
  263. if: contains(matrix.python, 'YES')
  264. # BEGIN A
  265. working-directory: build
  266. run: cmake --build . --config ${{ matrix.config }} --parallel 4
  267. # END A
  268. - name: Test (Python 3.11)
  269. # BEGIN B
  270. if: contains(matrix.python, 'YES')
  271. working-directory: build
  272. shell: bash
  273. env:
  274. PYTHONPATH: ${{ matrix.config }}
  275. run: |
  276. PYTHON_EXECUTABLE=$(grep 'Python_EXECUTABLE:' CMakeCache.txt | sed 's/.*=//')
  277. $PYTHON_EXECUTABLE -m pip install -r ../requirements-test.txt
  278. export COVERAGE_FILE=.coverage.$RANDOM LLVM_PROFILE_FILE=$PWD/pid-%p.profraw
  279. $PYTHON_EXECUTABLE -m pytest ../tests --cov=.
  280. # END B
  281. - name: Upload coverage reports
  282. if: always() && matrix.config == 'Coverage'
  283. working-directory: build
  284. shell: bash
  285. env:
  286. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
  287. run: |
  288. shopt -s expand_aliases
  289. if ${{ runner.os == 'macOS' }}; then alias llvm-profdata='xcrun llvm-profdata' llvm-cov='xcrun llvm-cov'; fi
  290. python -m pip install coverage
  291. python -m coverage combine $(find . -name '.coverage.*')
  292. llvm-profdata merge pid-*.profraw -o coverage.profdata
  293. llvm-cov show $(grep -Rl LLVM_PROFILE_FILE . | sed 's/^/-object /') -instr-profile=coverage.profdata > coverage.txt
  294. bash <(curl -s https://codecov.io/bash) -y ../.github/codecov.yml
  295. makepanda:
  296. if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"
  297. strategy:
  298. matrix:
  299. os: [ubuntu-20.04, windows-2019, macOS-11]
  300. runs-on: ${{ matrix.os }}
  301. steps:
  302. - uses: actions/checkout@v1
  303. - name: Install dependencies (Ubuntu)
  304. if: matrix.os == 'ubuntu-20.04'
  305. run: |
  306. sudo apt-get update
  307. 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
  308. - name: Get thirdparty packages (Windows)
  309. if: runner.os == 'Windows'
  310. shell: powershell
  311. run: |
  312. $wc = New-Object System.Net.WebClient
  313. $wc.DownloadFile("https://www.panda3d.org/download/panda3d-1.10.13/panda3d-1.10.13-tools-win64.zip", "thirdparty-tools.zip")
  314. Expand-Archive -Path thirdparty-tools.zip
  315. Move-Item -Path thirdparty-tools/panda3d-1.10.13/thirdparty -Destination .
  316. - name: Get thirdparty packages (macOS)
  317. if: runner.os == 'macOS'
  318. run: |
  319. curl -O https://www.panda3d.org/download/panda3d-1.10.14/panda3d-1.10.14-tools-mac.tar.gz
  320. tar -xf panda3d-1.10.14-tools-mac.tar.gz
  321. mv panda3d-1.10.14/thirdparty thirdparty
  322. rmdir panda3d-1.10.14
  323. (cd thirdparty/darwin-libs-a && rm -rf rocket)
  324. - name: Set up Python 3.11
  325. uses: actions/setup-python@v4
  326. with:
  327. python-version: '3.11'
  328. - name: Build Python 3.11
  329. shell: bash
  330. run: |
  331. python makepanda/makepanda.py --git-commit=${{github.sha}} --outputdir=built --everything --no-eigen --python-incdir="$pythonLocation/include" --python-libdir="$pythonLocation/lib" --verbose --threads=4 --windows-sdk=10
  332. - name: Test Python 3.11
  333. shell: bash
  334. run: |
  335. python -m pip install -r requirements-test.txt
  336. PYTHONPATH=built LD_LIBRARY_PATH=built/lib DYLD_LIBRARY_PATH=built/lib python -m pytest
  337. - name: Set up Python 3.10
  338. uses: actions/setup-python@v4
  339. with:
  340. python-version: '3.10'
  341. - name: Build Python 3.10
  342. shell: bash
  343. run: |
  344. python makepanda/makepanda.py --git-commit=${{github.sha}} --outputdir=built --everything --no-eigen --python-incdir="$pythonLocation/include" --python-libdir="$pythonLocation/lib" --verbose --threads=4 --windows-sdk=10
  345. - name: Test Python 3.10
  346. shell: bash
  347. run: |
  348. python -m pip install -r requirements-test.txt
  349. PYTHONPATH=built LD_LIBRARY_PATH=built/lib DYLD_LIBRARY_PATH=built/lib python -m pytest
  350. - name: Set up Python 3.9
  351. uses: actions/setup-python@v4
  352. with:
  353. python-version: '3.9'
  354. - name: Build Python 3.9
  355. shell: bash
  356. run: |
  357. python makepanda/makepanda.py --git-commit=${{github.sha}} --outputdir=built --everything --no-eigen --python-incdir="$pythonLocation/include" --python-libdir="$pythonLocation/lib" --verbose --threads=4 --windows-sdk=10
  358. - name: Test Python 3.9
  359. shell: bash
  360. run: |
  361. python -m pip install -r requirements-test.txt
  362. PYTHONPATH=built LD_LIBRARY_PATH=built/lib DYLD_LIBRARY_PATH=built/lib python -m pytest
  363. - name: Set up Python 3.8
  364. uses: actions/setup-python@v4
  365. with:
  366. python-version: '3.8'
  367. - name: Build Python 3.8
  368. shell: bash
  369. run: |
  370. python makepanda/makepanda.py --git-commit=${{github.sha}} --outputdir=built --everything --no-eigen --python-incdir="$pythonLocation/include" --python-libdir="$pythonLocation/lib" --verbose --threads=4 --windows-sdk=10
  371. - name: Test Python 3.8
  372. shell: bash
  373. run: |
  374. python -m pip install -r requirements-test.txt
  375. PYTHONPATH=built LD_LIBRARY_PATH=built/lib DYLD_LIBRARY_PATH=built/lib python -m pytest
  376. - name: Make installer
  377. run: |
  378. python makepanda/makepackage.py --verbose --lzma