1name: Push 2on: 3 push: 4 paths-ignore: 5 - docs/** 6 - NEWS 7 - UPGRADING 8 - UPGRADING.INTERNALS 9 - '**/README.*' 10 - CONTRIBUTING.md 11 - CODING_STANDARDS.md 12 - .cirrus.yml 13 - .circleci/** 14 branches: 15 - PHP-8.1 16 - PHP-8.2 17 - PHP-8.3 18 - PHP-8.4 19 - master 20 pull_request: 21 paths-ignore: 22 - docs/** 23 - NEWS 24 - UPGRADING 25 - UPGRADING.INTERNALS 26 - '**/README.*' 27 - CONTRIBUTING.md 28 - CODING_STANDARDS.md 29 - .cirrus.yml 30 - .circleci/** 31 branches: 32 - '**' 33permissions: 34 contents: read 35concurrency: 36 group: ${{ github.workflow }}-${{ github.event.pull_request.url || github.run_id }} 37 cancel-in-progress: true 38env: 39 CC: ccache gcc 40 CXX: ccache g++ 41jobs: 42 LINUX_X64: 43 if: github.repository == 'php/php-src' || github.event_name == 'pull_request' 44 services: 45 mysql: 46 image: mysql:8.3 47 ports: 48 - 3306:3306 49 env: 50 MYSQL_DATABASE: test 51 MYSQL_ROOT_PASSWORD: root 52 postgres: 53 image: postgres 54 ports: 55 - 5432:5432 56 env: 57 POSTGRES_USER: postgres 58 POSTGRES_PASSWORD: postgres 59 POSTGRES_DB: test 60 firebird: 61 image: jacobalberty/firebird 62 ports: 63 - 3050:3050 64 env: 65 ISC_PASSWORD: test 66 FIREBIRD_DATABASE: test.fdb 67 FIREBIRD_USER: test 68 FIREBIRD_PASSWORD: test 69 strategy: 70 fail-fast: false 71 matrix: 72 include: 73 - debug: false 74 zts: false 75 asan: false 76 - debug: true 77 zts: true 78 asan: true 79 name: "LINUX_X64_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || '' }}" 80 runs-on: ubuntu-${{ !matrix.asan && '22' || '24' }}.04 81 timeout-minutes: 50 82 steps: 83 - name: git checkout 84 uses: actions/checkout@v4 85 - name: apt 86 uses: ./.github/actions/apt-x64 87 - name: System info 88 run: | 89 echo "::group::Show host CPU info" 90 lscpu 91 echo "::endgroup::" 92 echo "::group::Show installed package versions" 93 dpkg -l 94 echo "::endgroup::" 95 - name: Create MSSQL container 96 if: ${{ !matrix.asan }} 97 uses: ./.github/actions/setup-mssql 98 - name: Setup Caddy server 99 uses: ./.github/actions/setup-caddy 100 - name: ccache 101 uses: hendrikmuhs/ccache-action@v1.2 102 with: 103 # This duplicates the "job.name" expression above because 104 # GitHub has no way to query the job name (github.job is the 105 # job id, not the job name) 106 key: "LINUX_X64_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || '' }}-${{hashFiles('main/php_version.h')}}" 107 append-timestamp: false 108 save: ${{ github.event_name != 'pull_request' }} 109 - name: ./configure 110 uses: ./.github/actions/configure-x64 111 with: 112 configurationParameters: >- 113 --${{ matrix.debug && 'enable' || 'disable' }}-debug 114 --${{ matrix.zts && 'enable' || 'disable' }}-zts 115 ${{ matrix.asan && 'CFLAGS="-fsanitize=undefined,address -fno-sanitize=function -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined,address -fno-sanitize=function" CC=clang CXX=clang++' || '' }} 116 skipSlow: ${{ matrix.asan }} 117 - name: make 118 run: make -j$(/usr/bin/nproc) >/dev/null 119 - name: make install 120 uses: ./.github/actions/install-linux 121 - name: Setup 122 if: ${{ !matrix.asan }} 123 uses: ./.github/actions/setup-x64 124 - name: Test 125 if: matrix.asan == false 126 uses: ./.github/actions/test-linux 127 - name: Test Tracing JIT 128 uses: ./.github/actions/test-linux 129 with: 130 jitType: tracing 131 runTestsParameters: >- 132 -d zend_extension=opcache.so 133 -d opcache.enable_cli=1 134 ${{ matrix.asan && '--asan -x' || '' }} 135 - name: Verify generated files are up to date 136 if: ${{ !matrix.asan }} 137 uses: ./.github/actions/verify-generated-files 138 LINUX_X32: 139 if: github.repository == 'php/php-src' || github.event_name == 'pull_request' 140 name: LINUX_X32_DEBUG_ZTS 141 runs-on: ubuntu-latest 142 timeout-minutes: 50 143 container: 144 image: ubuntu:20.04 145 env: 146 MYSQL_TEST_HOST: mysql 147 PDO_MYSQL_TEST_DSN: mysql:host=mysql;dbname=test 148 PDO_MYSQL_TEST_HOST: mysql 149 services: 150 mysql: 151 image: mysql:8.3 152 ports: 153 - 3306:3306 154 env: 155 MYSQL_DATABASE: test 156 MYSQL_ROOT_PASSWORD: root 157 steps: 158 - name: git checkout 159 uses: actions/checkout@v4 160 - name: apt 161 uses: ./.github/actions/apt-x32 162 - name: ccache 163 uses: hendrikmuhs/ccache-action@v1.2 164 with: 165 key: "${{github.job}}-${{hashFiles('main/php_version.h')}}" 166 append-timestamp: false 167 - name: ./configure 168 uses: ./.github/actions/configure-x32 169 with: 170 configurationParameters: >- 171 --enable-debug 172 --enable-zts 173 - name: make 174 run: make -j$(/usr/bin/nproc) >/dev/null 175 - name: make install 176 uses: ./.github/actions/install-linux-x32 177 - name: Test Tracing JIT 178 uses: ./.github/actions/test-linux 179 with: 180 jitType: tracing 181 runTestsParameters: >- 182 -d zend_extension=opcache.so 183 -d opcache.enable_cli=1 184 MACOS_DEBUG_NTS: 185 if: github.repository == 'php/php-src' || github.event_name == 'pull_request' 186 strategy: 187 fail-fast: false 188 matrix: 189 include: 190 - os: 13 191 arch: X64 192 - os: 14 193 arch: ARM64 194 name: MACOS_${{ matrix.arch }}_DEBUG_NTS 195 runs-on: macos-${{ matrix.os }} 196 timeout-minutes: 50 197 steps: 198 - name: git checkout 199 uses: actions/checkout@v4 200 - name: brew 201 uses: ./.github/actions/brew 202 - name: ccache 203 uses: hendrikmuhs/ccache-action@v1.2 204 with: 205 key: "${{github.job}}-${{matrix.os}}-${{hashFiles('main/php_version.h')}}" 206 append-timestamp: false 207 save: ${{ github.event_name != 'pull_request' }} 208 - name: ./configure 209 uses: ./.github/actions/configure-macos 210 with: 211 configurationParameters: --enable-debug --disable-zts 212 - name: make 213 run: |- 214 export PATH="$(brew --prefix)/opt/bison/bin:$PATH" 215 make -j$(sysctl -n hw.logicalcpu) >/dev/null 216 - name: make install 217 run: sudo make install 218 - name: Test Tracing JIT 219 uses: ./.github/actions/test-macos 220 with: 221 jitType: tracing 222 runTestsParameters: >- 223 -d zend_extension=opcache.so 224 -d opcache.enable_cli=1 225 - name: Verify generated files are up to date 226 uses: ./.github/actions/verify-generated-files 227 WINDOWS: 228 if: github.repository == 'php/php-src' || github.event_name == 'pull_request' 229 name: WINDOWS_X64_ZTS 230 runs-on: windows-2022 231 timeout-minutes: 50 232 env: 233 PHP_BUILD_CACHE_BASE_DIR: C:\build-cache 234 PHP_BUILD_OBJ_DIR: C:\obj 235 PHP_BUILD_CACHE_SDK_DIR: C:\build-cache\sdk 236 PHP_BUILD_SDK_BRANCH: php-sdk-2.3.0 237 PHP_BUILD_CRT: vs17 238 PLATFORM: x64 239 THREAD_SAFE: "1" 240 INTRINSICS: AVX2 241 PARALLEL: -j2 242 OPCACHE: "1" 243 steps: 244 - name: git config 245 run: git config --global core.autocrlf false && git config --global core.eol lf 246 - name: git checkout 247 uses: actions/checkout@v4 248 - name: Setup 249 uses: ./.github/actions/setup-windows 250 - name: Build 251 run: .github/scripts/windows/build.bat 252 - name: Test 253 run: .github/scripts/windows/test.bat 254 BENCHMARKING: 255 name: BENCHMARKING 256 if: github.repository == 'php/php-src' || github.event_name == 'pull_request' 257 runs-on: ubuntu-22.04 258 timeout-minutes: 50 259 steps: 260 - name: git checkout 261 uses: actions/checkout@v4 262 with: 263 fetch-depth: 0 264 # ASLR can cause a lot of noise due to missed sse opportunities for memcpy 265 # and other operations, so we disable it during benchmarking. 266 - name: Disable ASLR 267 run: echo 0 | sudo tee /proc/sys/kernel/randomize_va_space 268 - name: apt 269 run: | 270 set -x 271 sudo apt-get update 272 sudo apt-get install \ 273 bison \ 274 libgmp-dev \ 275 libonig-dev \ 276 libsqlite3-dev \ 277 openssl \ 278 re2c \ 279 valgrind 280 - name: ccache 281 uses: hendrikmuhs/ccache-action@v1.2 282 with: 283 key: "${{github.job}}-${{hashFiles('main/php_version.h')}}" 284 append-timestamp: false 285 save: ${{ github.event_name != 'pull_request' }} 286 - name: ./configure 287 run: | 288 set -x 289 ./buildconf --force 290 ./configure \ 291 --disable-debug \ 292 --enable-mbstring \ 293 --enable-opcache \ 294 --enable-option-checking=fatal \ 295 --enable-sockets \ 296 --enable-werror \ 297 --prefix=/usr \ 298 --with-config-file-scan-dir=/etc/php.d \ 299 --with-gmp \ 300 --with-mysqli=mysqlnd \ 301 --with-openssl \ 302 --with-pdo-sqlite \ 303 --with-valgrind 304 - name: make 305 run: make -j$(/usr/bin/nproc) >/dev/null 306 - name: make install 307 run: | 308 set -x 309 sudo make install 310 sudo mkdir -p /etc/php.d 311 sudo chmod 777 /etc/php.d 312 echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini 313 echo zend_extension=opcache.so >> /etc/php.d/opcache.ini 314 echo opcache.enable=1 >> /etc/php.d/opcache.ini 315 echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini 316 - name: Setup 317 run: | 318 git config --global user.name "Benchmark" 319 git config --global user.email "benchmark@php.net" 320 sudo service mysql start 321 mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS wordpress" 322 mysql -uroot -proot -e "CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'wordpress'; FLUSH PRIVILEGES;" 323 mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON *.* TO 'wordpress'@'localhost' WITH GRANT OPTION;" 324 - name: git checkout benchmarking-data 325 uses: actions/checkout@v4 326 with: 327 repository: php/benchmarking-data 328 ssh-key: ${{ secrets.BENCHMARKING_DATA_DEPLOY_KEY }} 329 path: benchmark/repos/data 330 - name: Benchmark 331 run: php benchmark/benchmark.php true 332 - name: Store result 333 if: github.event_name == 'push' 334 run: | 335 set -x 336 cd benchmark/repos/data 337 git pull --autostash 338 if [ -e ".git/MERGE_HEAD" ]; then 339 echo "Merging, can't proceed" 340 exit 1 341 fi 342 git add . 343 if git diff --cached --quiet; then 344 exit 0 345 fi 346 git commit -m "Add result for ${{ github.repository }}@${{ github.sha }}" 347 git push 348 - name: Show diff 349 if: github.event_name == 'pull_request' 350 run: |- 351 set -x 352 php benchmark/generate_diff.php \ 353 ${{ github.sha }} \ 354 $(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) \ 355 > $GITHUB_STEP_SUMMARY 356 - uses: actions/upload-artifact@v4 357 with: 358 name: profiles 359 path: ${{ github.workspace }}/benchmark/profiles 360 retention-days: 30 361