nightly.yml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. name: Nightly
  2. on:
  3. schedule:
  4. - cron: "0 1 * * *"
  5. workflow_dispatch: ~
  6. jobs:
  7. GENERATE_MATRIX:
  8. name: Generate Matrix
  9. if: github.repository_owner == 'php' || github.event_name == 'workflow_dispatch'
  10. runs-on: ubuntu-latest
  11. outputs:
  12. branches: ${{ steps.set-matrix.outputs.branches }}
  13. matrix-include: ${{ steps.set-matrix.outputs.matrix-include }}
  14. steps:
  15. - uses: actions/checkout@v2
  16. with:
  17. # Set fetch-depth to 0 to clone the full repository
  18. # including all branches. This is required to find
  19. # the correct commit hashes.
  20. fetch-depth: 0
  21. - name: Grab the commit mapping
  22. uses: actions/cache@v3
  23. with:
  24. path: branch-commit-cache.json
  25. # The cache key needs to change every time for the
  26. # cache to be updated after this job finishes.
  27. key: nightly-${{ github.run_id }}-${{ github.run_attempt }}
  28. restore-keys: |
  29. nightly-
  30. - name: Generate Matrix
  31. id: set-matrix
  32. run: php .github/nightly_matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}"
  33. LINUX_X64:
  34. needs: GENERATE_MATRIX
  35. if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
  36. strategy:
  37. fail-fast: false
  38. matrix:
  39. branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }}
  40. configuration_parameters: ['']
  41. debug: [true, false]
  42. name: ['']
  43. run_tests_parameters: ['']
  44. timeout_minutes: [360]
  45. zts: [true, false]
  46. include: ${{ fromJson(needs.GENERATE_MATRIX.outputs.matrix-include) }}
  47. name: "${{ matrix.branch.name }}_LINUX_X64${{ matrix.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}"
  48. runs-on: ubuntu-20.04
  49. timeout-minutes: ${{ matrix.timeout_minutes }}
  50. steps:
  51. - name: git checkout
  52. uses: actions/checkout@v2
  53. with:
  54. ref: ${{ matrix.branch.ref }}
  55. - name: Create MSSQL container
  56. uses: ./.github/actions/setup-mssql
  57. - name: Create Oracle container
  58. uses: ./.github/actions/setup-oracle
  59. - name: apt
  60. uses: ./.github/actions/apt-x64
  61. - name: ./configure
  62. uses: ./.github/actions/configure-x64
  63. with:
  64. configurationParameters: >-
  65. ${{ matrix.configuration_parameters }}
  66. --${{ matrix.debug && 'enable' || 'disable' }}-debug
  67. --${{ matrix.zts && 'enable' || 'disable' }}-zts
  68. - name: make
  69. run: make -j$(/usr/bin/nproc) >/dev/null
  70. - name: make install
  71. uses: ./.github/actions/install-linux
  72. - name: Setup
  73. uses: ./.github/actions/setup-x64
  74. - name: Test
  75. uses: ./.github/actions/test-linux
  76. with:
  77. runTestsParameters: >-
  78. ${{ matrix.run_tests_parameters }}
  79. - name: Test Tracing JIT
  80. uses: ./.github/actions/test-linux
  81. with:
  82. runTestsParameters: >-
  83. ${{ matrix.run_tests_parameters }}
  84. -d zend_extension=opcache.so
  85. -d opcache.enable_cli=1
  86. -d opcache.jit_buffer_size=16M
  87. - name: Test OpCache
  88. uses: ./.github/actions/test-linux
  89. with:
  90. runTestsParameters: >-
  91. ${{ matrix.run_tests_parameters }}
  92. -d zend_extension=opcache.so
  93. -d opcache.enable_cli=1
  94. - name: Test Function JIT
  95. uses: ./.github/actions/test-linux
  96. with:
  97. runTestsParameters: >-
  98. ${{ matrix.run_tests_parameters }}
  99. -d zend_extension=opcache.so
  100. -d opcache.enable_cli=1
  101. -d opcache.jit_buffer_size=16M
  102. -d opcache.jit=1205
  103. - name: Verify generated files are up to date
  104. uses: ./.github/actions/verify-generated-files
  105. MACOS:
  106. needs: GENERATE_MATRIX
  107. if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
  108. strategy:
  109. fail-fast: false
  110. matrix:
  111. branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }}
  112. debug: [true, false]
  113. zts: [true, false]
  114. name: "${{ matrix.branch.name }}_MACOS_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}"
  115. runs-on: macos-11
  116. steps:
  117. - name: git checkout
  118. uses: actions/checkout@v2
  119. with:
  120. ref: ${{ matrix.branch.ref }}
  121. - name: brew
  122. uses: ./.github/actions/brew
  123. - name: ./configure
  124. uses: ./.github/actions/configure-macos
  125. with:
  126. configurationParameters: >-
  127. --${{ matrix.debug && 'enable' || 'disable' }}-debug
  128. --${{ matrix.zts && 'enable' || 'disable' }}-zts
  129. - name: make
  130. run: |-
  131. export PATH="/usr/local/opt/bison/bin:$PATH"
  132. make -j$(sysctl -n hw.logicalcpu) >/dev/null
  133. - name: make install
  134. run: sudo make install
  135. - name: Test
  136. uses: ./.github/actions/test-macos
  137. - name: Test Tracing JIT
  138. uses: ./.github/actions/test-macos
  139. with:
  140. runTestsParameters: >-
  141. -d zend_extension=opcache.so
  142. -d opcache.enable_cli=1
  143. -d opcache.protect_memory=1
  144. -d opcache.jit_buffer_size=16M
  145. - name: Test OpCache
  146. uses: ./.github/actions/test-macos
  147. with:
  148. runTestsParameters: >-
  149. -d zend_extension=opcache.so
  150. -d opcache.enable_cli=1
  151. -d opcache.protect_memory=1
  152. - name: Test Function JIT
  153. uses: ./.github/actions/test-macos
  154. with:
  155. runTestsParameters: >-
  156. -d zend_extension=opcache.so
  157. -d opcache.enable_cli=1
  158. -d opcache.protect_memory=1
  159. -d opcache.jit_buffer_size=16M
  160. -d opcache.jit=1205
  161. - name: Verify generated files are up to date
  162. uses: ./.github/actions/verify-generated-files
  163. COVERAGE_DEBUG_NTS:
  164. if: github.repository_owner == 'php' || github.event_name == 'workflow_dispatch'
  165. runs-on: ubuntu-20.04
  166. steps:
  167. - name: git checkout
  168. uses: actions/checkout@v2
  169. - name: Create MSSQL container
  170. uses: ./.github/actions/setup-mssql
  171. - name: Create Oracle container
  172. uses: ./.github/actions/setup-oracle
  173. - name: apt
  174. uses: ./.github/actions/apt-x64
  175. - name: Install gcovr
  176. run: sudo -H pip install gcovr
  177. - name: ./configure
  178. uses: ./.github/actions/configure-x64
  179. with:
  180. configurationParameters: --enable-debug --disable-zts --enable-gcov
  181. - name: make
  182. run: make -j$(/usr/bin/nproc) >/dev/null
  183. - name: make install
  184. uses: ./.github/actions/install-linux
  185. - name: Setup
  186. uses: ./.github/actions/setup-x64
  187. # We only test with OpCache, the difference in coverage is negligible
  188. - name: Test OpCache
  189. uses: ./.github/actions/test-linux
  190. with:
  191. runTestsParameters: >-
  192. -d zend_extension=opcache.so
  193. -d opcache.enable_cli=1
  194. - name: Upload Test Coverage to Codecov.io
  195. if: always()
  196. run: bash <(curl -s https://codecov.io/bash)
  197. COMMUNITY:
  198. needs: GENERATE_MATRIX
  199. if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
  200. strategy:
  201. fail-fast: false
  202. matrix:
  203. branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }}
  204. name: "${{ matrix.branch.name }}_COMMUNITY"
  205. runs-on: ubuntu-20.04
  206. env:
  207. UBSAN_OPTIONS: print_stacktrace=1
  208. USE_ZEND_ALLOC: 0
  209. USE_TRACKED_ALLOC: 1
  210. steps:
  211. - name: git checkout
  212. uses: actions/checkout@v2
  213. with:
  214. ref: ${{ matrix.branch.ref }}
  215. - name: apt
  216. uses: ./.github/actions/apt-x64
  217. - name: ./configure
  218. uses: ./.github/actions/configure-x64
  219. with:
  220. configurationParameters: >-
  221. --enable-debug
  222. --enable-zts
  223. CFLAGS='-fsanitize=undefined,address -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC'
  224. LDFLAGS='-fsanitize=undefined,address'
  225. - name: make
  226. run: make -j$(/usr/bin/nproc) >/dev/null
  227. - name: make install
  228. uses: ./.github/actions/install-linux
  229. - name: Setup
  230. run: |
  231. sudo service mysql start
  232. mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
  233. mysql -uroot -proot -e "SET GLOBAL local_infile = true"
  234. - name: Enable Opcache and JIT
  235. run: |
  236. echo zend_extension=opcache.so > /etc/php.d/opcache.ini
  237. echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
  238. echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
  239. echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini
  240. - name: Test Laravel
  241. if: matrix.branch.ref != 'PHP-8.0'
  242. run: |
  243. git clone https://github.com/laravel/framework.git --branch=master --depth=1
  244. cd framework
  245. git rev-parse HEAD
  246. php /usr/bin/composer install --no-progress --ignore-platform-reqs
  247. # Hack to disable a test that hangs
  248. php -r '$c = file_get_contents("tests/Filesystem/FilesystemTest.php"); $c = str_replace("*/\n public function testSharedGet()", "* @group skip\n */\n public function testSharedGet()", $c); file_put_contents("tests/Filesystem/FilesystemTest.php", $c);'
  249. export ASAN_OPTIONS=exitcode=139
  250. php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$?
  251. if [ $EXIT_CODE -gt 128 ]; then
  252. exit 1
  253. fi
  254. - name: Test Symfony
  255. if: matrix.branch.ref != 'PHP-8.0'
  256. run: |
  257. git clone https://github.com/symfony/symfony.git --depth=1
  258. cd symfony
  259. git rev-parse HEAD
  260. php /usr/bin/composer install --no-progress --ignore-platform-reqs
  261. php ./phpunit install
  262. # Test causes a heap-buffer-overflow but I cannot reproduce it locally...
  263. php -r '$c = file_get_contents("src/Symfony/Component/HtmlSanitizer/Tests/HtmlSanitizerCustomTest.php"); $c = str_replace("public function testSanitizeDeepNestedString()", "/** @group skip */\n public function testSanitizeDeepNestedString()", $c); file_put_contents("src/Symfony/Component/HtmlSanitizer/Tests/HtmlSanitizerCustomTest.php", $c);'
  264. # Buggy FFI test in Symfony, see https://github.com/symfony/symfony/issues/47668
  265. php -r '$c = file_get_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php"); $c = str_replace("*/\n public function testCastNonTrailingCharPointer()", "* @group skip\n */\n public function testCastNonTrailingCharPointer()", $c); file_put_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php", $c);'
  266. export ASAN_OPTIONS=exitcode=139
  267. export SYMFONY_DEPRECATIONS_HELPER=max[total]=999
  268. X=0
  269. for component in $(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n'); do
  270. php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$?
  271. if [ $EXIT_CODE -gt 128 ]; then
  272. X=1;
  273. fi
  274. done
  275. exit $X
  276. - name: Test PHPUnit
  277. if: always()
  278. run: |
  279. git clone https://github.com/sebastianbergmann/phpunit.git --branch=main --depth=1
  280. cd phpunit
  281. git rev-parse HEAD
  282. export ASAN_OPTIONS=exitcode=139
  283. php /usr/bin/composer install --no-progress --ignore-platform-reqs
  284. php ./phpunit || EXIT_CODE=$?
  285. if [ $EXIT_CODE -gt 128 ]; then
  286. exit 1
  287. fi
  288. - name: 'Symfony Preloading'
  289. if: matrix.branch.ref != 'PHP-8.0'
  290. run: |
  291. php /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress --ignore-platform-reqs
  292. cd symfony_demo
  293. git rev-parse HEAD
  294. sed -i 's/PHP_SAPI/"cli-server"/g' var/cache/dev/App_KernelDevDebugContainer.preload.php
  295. php -d opcache.preload=var/cache/dev/App_KernelDevDebugContainer.preload.php public/index.php
  296. OPCACHE_VARIATION:
  297. needs: GENERATE_MATRIX
  298. if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
  299. strategy:
  300. fail-fast: false
  301. matrix:
  302. branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }}
  303. name: "${{ matrix.branch.name }}_OPCACHE_VARIATION"
  304. runs-on: ubuntu-20.04
  305. steps:
  306. - name: git checkout
  307. uses: actions/checkout@v2
  308. with:
  309. ref: ${{ matrix.branch.ref }}
  310. - name: Create MSSQL container
  311. uses: ./.github/actions/setup-mssql
  312. - name: Create Oracle container
  313. uses: ./.github/actions/setup-oracle
  314. - name: apt
  315. uses: ./.github/actions/apt-x64
  316. - name: ./configure
  317. uses: ./.github/actions/configure-x64
  318. with:
  319. configurationParameters: >-
  320. --enable-debug --disable-zts
  321. - name: make
  322. run: make -j$(/usr/bin/nproc) >/dev/null
  323. - name: make install
  324. uses: ./.github/actions/install-linux
  325. - name: Setup
  326. uses: ./.github/actions/setup-x64
  327. - name: Test File Cache (prime shm)
  328. uses: ./.github/actions/test-linux
  329. with:
  330. runTestsParameters: >-
  331. -d zend_extension=opcache.so
  332. -d opcache.enable_cli=1
  333. --file-cache-prime
  334. - name: Test File Cache (prime shm, use shm)
  335. uses: ./.github/actions/test-linux
  336. with:
  337. runTestsParameters: >-
  338. -d zend_extension=opcache.so
  339. -d opcache.enable_cli=1
  340. --file-cache-use
  341. - name: Test File Cache (prime shm, use file)
  342. uses: ./.github/actions/test-linux
  343. with:
  344. runTestsParameters: >-
  345. -d zend_extension=opcache.so
  346. -d opcache.enable_cli=1
  347. --file-cache-use
  348. -d opcache.file_cache_only=1
  349. - name: Test File Cache Only (prime)
  350. uses: ./.github/actions/test-linux
  351. with:
  352. runTestsParameters: >-
  353. -d zend_extension=opcache.so
  354. -d opcache.enable_cli=1
  355. --file-cache-prime
  356. -d opcache.file_cache_only=1
  357. - name: Test File Cache Only (use)
  358. uses: ./.github/actions/test-linux
  359. with:
  360. runTestsParameters: >-
  361. -d zend_extension=opcache.so
  362. -d opcache.enable_cli=1
  363. --file-cache-use
  364. -d opcache.file_cache_only=1
  365. - name: Verify generated files are up to date
  366. uses: ./.github/actions/verify-generated-files
  367. MSAN:
  368. needs: GENERATE_MATRIX
  369. if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
  370. strategy:
  371. fail-fast: false
  372. matrix:
  373. branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }}
  374. name: "${{ matrix.branch.name }}_MSAN"
  375. runs-on: ubuntu-22.04
  376. steps:
  377. - name: git checkout
  378. uses: actions/checkout@v2
  379. with:
  380. ref: ${{ matrix.branch.ref }}
  381. - name: apt
  382. uses: ./.github/actions/apt-x64
  383. - name: ./configure
  384. run: |
  385. export CC=clang
  386. export CXX=clang++
  387. export CFLAGS="-DZEND_TRACK_ARENA_ALLOC"
  388. ./buildconf --force
  389. # msan requires all used libraries to be instrumented,
  390. # so we should avoiding linking against anything but libc here
  391. ./configure \
  392. --enable-debug \
  393. --enable-zts \
  394. --enable-option-checking=fatal \
  395. --prefix=/usr \
  396. --without-sqlite3 \
  397. --without-pdo-sqlite \
  398. --without-libxml \
  399. --disable-dom \
  400. --disable-simplexml \
  401. --disable-xml \
  402. --disable-xmlreader \
  403. --disable-xmlwriter \
  404. --without-pcre-jit \
  405. --disable-opcache-jit \
  406. --enable-phpdbg \
  407. --enable-fpm \
  408. --with-pdo-mysql=mysqlnd \
  409. --with-mysqli=mysqlnd \
  410. --disable-mysqlnd-compression-support \
  411. --without-pear \
  412. --enable-exif \
  413. --enable-sysvsem \
  414. --enable-sysvshm \
  415. --enable-shmop \
  416. --enable-pcntl \
  417. --enable-mbstring \
  418. --disable-mbregex \
  419. --enable-sockets \
  420. --enable-bcmath \
  421. --enable-calendar \
  422. --enable-ftp \
  423. --enable-zend-test \
  424. --enable-werror \
  425. --enable-memory-sanitizer \
  426. --with-config-file-path=/etc \
  427. --with-config-file-scan-dir=/etc/php.d
  428. - name: make
  429. run: make -j$(/usr/bin/nproc) >/dev/null
  430. - name: make install
  431. run: |
  432. sudo make install
  433. sudo mkdir /etc/php.d
  434. sudo chmod 777 /etc/php.d
  435. echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini
  436. echo pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/pdo_mysql.ini
  437. - name: Setup
  438. run: |
  439. set -x
  440. sudo service mysql start
  441. mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
  442. # Ensure local_infile tests can run.
  443. mysql -uroot -proot -e "SET GLOBAL local_infile = true"
  444. sudo locale-gen de_DE
  445. - name: Test
  446. uses: ./.github/actions/test-linux
  447. with:
  448. runTestsParameters: >-
  449. --msan
  450. - name: Test Opcache
  451. uses: ./.github/actions/test-linux
  452. with:
  453. runTestsParameters: >-
  454. --msan
  455. -d zend_extension=opcache.so
  456. -d opcache.enable_cli=1
  457. - name: Verify generated files are up to date
  458. uses: ./.github/actions/verify-generated-files
  459. LIBMYSQLCLIENT:
  460. needs: GENERATE_MATRIX
  461. if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
  462. strategy:
  463. fail-fast: false
  464. matrix:
  465. branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }}
  466. exclude:
  467. - branch: { name: 'PHP-80', ref: 'PHP-8.0' }
  468. name: "${{ matrix.branch.name }}_LIBMYSQLCLIENT"
  469. runs-on: ubuntu-20.04
  470. steps:
  471. - name: git checkout
  472. uses: actions/checkout@v2
  473. with:
  474. ref: ${{ matrix.branch.ref }}
  475. - name: apt
  476. run: |
  477. sudo apt-get update -y | true
  478. sudo apt install bison re2c
  479. - name: Setup
  480. run: |
  481. sudo service mysql start
  482. mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
  483. # Ensure local_infile tests can run.
  484. mysql -uroot -proot -e "SET GLOBAL local_infile = true"
  485. # Does not support caching_sha2_auth :(
  486. # - name: Build mysql-5.6
  487. # uses: ./.github/actions/build-libmysqlclient
  488. # with:
  489. # libmysql: mysql-5.6.49-linux-glibc2.12-x86_64.tar.gz
  490. # - name: Test mysql-5.6
  491. # uses: ./.github/actions/test-libmysqlclient
  492. - name: Build mysql-5.7
  493. uses: ./.github/actions/build-libmysqlclient
  494. with:
  495. libmysql: mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz
  496. withMysqli: ${{ matrix.branch.ref == 'PHP-8.1' }}
  497. - name: Test mysql-5.7
  498. uses: ./.github/actions/test-libmysqlclient
  499. with:
  500. withMysqli: ${{ matrix.branch.ref == 'PHP-8.1' }}
  501. - name: Build mysql-8.0
  502. uses: ./.github/actions/build-libmysqlclient
  503. with:
  504. # FIXME: There are new warnings
  505. # configurationParameters: --enable-werror
  506. libmysql: mysql-8.0.30-linux-glibc2.12-x86_64.tar.xz
  507. withMysqli: ${{ matrix.branch.ref == 'PHP-8.1' }}
  508. - name: Test mysql-8.0
  509. uses: ./.github/actions/test-libmysqlclient
  510. with:
  511. withMysqli: ${{ matrix.branch.ref == 'PHP-8.1' }}
  512. - name: Verify generated files are up to date
  513. uses: ./.github/actions/verify-generated-files