Unify push & nightly workflows #36336
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Push | |
| on: | |
| push: | |
| paths-ignore: &ignore_paths | |
| - docs/** | |
| - NEWS | |
| - UPGRADING | |
| - UPGRADING.INTERNALS | |
| - '**/README.*' | |
| - CONTRIBUTING.md | |
| - CODING_STANDARDS.md | |
| - .cirrus.yml | |
| - .circleci/** | |
| branches: | |
| - PHP-8.2 | |
| - PHP-8.3 | |
| - PHP-8.4 | |
| - PHP-8.5 | |
| - master | |
| pull_request: | |
| paths-ignore: *ignore_paths | |
| branches: | |
| - '**' | |
| workflow_dispatch: ~ | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.url || github.run_id }} | |
| cancel-in-progress: true | |
| env: | |
| CC: ccache gcc | |
| CXX: ccache g++ | |
| jobs: | |
| GENERATE_MATRIX: | |
| name: Generate Matrix | |
| if: github.repository == 'php/php-src' || github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| all_variations: ${{ steps.set-matrix.outputs.all_variations }} | |
| branches: ${{ steps.set-matrix.outputs.branches }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Generate Matrix | |
| id: set-matrix | |
| run: php .github/nightly_matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}" "${{ github.ref }}" '${{ toJSON(github.event.pull_request.labels) }}' | |
| PUSH: | |
| needs: GENERATE_MATRIX | |
| name: ${{ matrix.branch.ref }} | |
| uses: ./.github/workflows/nightly.yml | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} | |
| with: | |
| all_variations: ${{ needs.GENERATE_MATRIX.outputs.all_variations == 'true' }} | |
| branch: ${{ toJSON(matrix.branch) }} | |
| secrets: inherit | |
| BENCHMARKING: | |
| name: BENCHMARKING | |
| if: github.repository == 'php/php-src' || github.event_name == 'pull_request' | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 50 | |
| steps: | |
| - name: git checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| # ASLR can cause a lot of noise due to missed sse opportunities for memcpy | |
| # and other operations, so we disable it during benchmarking. | |
| - name: Disable ASLR | |
| run: echo 0 | sudo tee /proc/sys/kernel/randomize_va_space | |
| - name: apt | |
| run: | | |
| set -x | |
| sudo apt-get update | |
| sudo apt-get install \ | |
| bison \ | |
| libgmp-dev \ | |
| libonig-dev \ | |
| libsqlite3-dev \ | |
| openssl \ | |
| re2c \ | |
| valgrind | |
| - name: ccache | |
| uses: ./.github/actions/ccache | |
| with: | |
| name: "${{ github.job }}" | |
| - name: ./configure | |
| run: | | |
| set -x | |
| ./buildconf --force | |
| ./configure \ | |
| --disable-debug \ | |
| --enable-mbstring \ | |
| --enable-option-checking=fatal \ | |
| --enable-sockets \ | |
| --enable-werror \ | |
| --prefix=/usr \ | |
| --with-config-file-scan-dir=/etc/php.d \ | |
| --with-gmp \ | |
| --with-mysqli=mysqlnd \ | |
| --with-openssl \ | |
| --with-pdo-sqlite \ | |
| --with-valgrind | |
| - name: make | |
| run: make -j$(/usr/bin/nproc) >/dev/null | |
| - name: make install | |
| run: | | |
| set -x | |
| sudo make install | |
| sudo mkdir -p /etc/php.d | |
| sudo chmod 777 /etc/php.d | |
| echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini | |
| echo opcache.enable=1 >> /etc/php.d/opcache.ini | |
| echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini | |
| - name: Setup | |
| run: | | |
| git config --global user.name "Benchmark" | |
| git config --global user.email "benchmark@php.net" | |
| sudo service mysql start | |
| mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS wordpress" | |
| mysql -uroot -proot -e "CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'wordpress'; FLUSH PRIVILEGES;" | |
| mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON *.* TO 'wordpress'@'localhost' WITH GRANT OPTION;" | |
| - name: git checkout benchmarking-data | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: php/benchmarking-data | |
| ssh-key: ${{ secrets.BENCHMARKING_DATA_DEPLOY_KEY }} | |
| path: benchmark/repos/data | |
| - name: Benchmark | |
| run: php benchmark/benchmark.php true | |
| - name: Store result | |
| if: github.event_name == 'push' | |
| run: | | |
| set -x | |
| cd benchmark/repos/data | |
| git pull --autostash | |
| if [ -e ".git/MERGE_HEAD" ]; then | |
| echo "Merging, can't proceed" | |
| exit 1 | |
| fi | |
| git add . | |
| if git diff --cached --quiet; then | |
| exit 0 | |
| fi | |
| git commit -m "Add result for ${{ github.repository }}@${{ github.sha }}" | |
| git push | |
| - name: Show diff | |
| if: github.event_name == 'pull_request' | |
| run: |- | |
| set -x | |
| php benchmark/generate_diff.php \ | |
| ${{ github.sha }} \ | |
| $(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) \ | |
| > $GITHUB_STEP_SUMMARY | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| name: profiles | |
| path: ${{ github.workspace }}/benchmark/profiles | |
| retention-days: 30 |