diff --git a/.github/nightly_matrix.php b/.github/nightly_matrix.php new file mode 100644 index 0000000000000..633d22339f322 --- /dev/null +++ b/.github/nightly_matrix.php @@ -0,0 +1,62 @@ + $branch_key, + 'ref' => $branch, + ]; + }, $branches); + + return $result; +} + +function get_asan_matrix(array $branches) { + $jobs = []; + foreach (get_branch_matrix($branches) as $branch) { + $jobs[] = [ + 'name' => '_ASAN_UBSAN', + 'branch' => $branch, + 'debug' => true, + 'zts' => true, + 'configuration_parameters' => "CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC' LDFLAGS='-fsanitize=undefined,address'", + 'run_tests_parameters' => '--asan', + ]; + } + return $jobs; +} + +$changed_branches = get_changed_branches(); +// FIXME: Change to run only for changed branches before merging +$changed_branches = BRANCHES; +$asan_matrix = get_asan_matrix($changed_branches); + +echo '::set-output name=branches::' . json_encode(get_branch_matrix($changed_branches), JSON_UNESCAPED_SLASHES) . "\n"; +echo '::set-output name=asan-matrix::' . json_encode($asan_matrix, JSON_UNESCAPED_SLASHES) . "\n"; diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000000000..dbf04feaf209a --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,143 @@ +name: Nightly +on: + # FIXME: Change to run on a schedule before merging + #schedule: + # - cron: "0 1 * * *" + pull_request: + branches: + - '**' +jobs: + GENERATE_MATRIX: + name: Generate Matrix + runs-on: ubuntu-latest + outputs: + branches: ${{ steps.set-matrix.outputs.branches }} + asan-matrix: ${{ steps.set-matrix.outputs.asan-matrix }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Get current date for cache + id: date + run: echo "::set-output name=date::$(date -Iseconds)" + - name: Grab the commit mapping + uses: actions/cache@v3 + with: + path: branch-commit-cache.json + key: nightly-${{ steps.date.outputs.date }} + restore-keys: | + nightly- + - name: Generate Matrix + id: set-matrix + run: php .github/nightly_matrix.php + LINUX_X64: + needs: GENERATE_MATRIX + strategy: + fail-fast: false + matrix: + branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} + debug: [true, false] + zts: [true, false] + include: ${{ fromJson(needs.GENERATE_MATRIX.outputs.asan-matrix) }} + name: "${{ matrix.branch.name }}_LINUX_X64${{ matrix.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" + runs-on: ubuntu-20.04 + steps: + - name: git checkout + uses: actions/checkout@v2 + with: + ref: ${{ matrix.branch.ref }} + - name: Create mssql container + uses: ./.github/actions/mssql + - name: apt + uses: ./.github/actions/apt-x64 + - name: ./configure + uses: ./.github/actions/configure-x64 + with: + configurationParameters: >- + ${{ matrix.configuration_parameters }} + --${{ matrix.debug && 'enable' || 'disable' }}-debug + --${{ matrix.zts && 'enable' || 'disable' }}-zts + - name: make + run: make -j$(/usr/bin/nproc) >/dev/null + - name: make install + uses: ./.github/actions/install-linux + - name: Setup + uses: ./.github/actions/setup-x64 + - name: Test + uses: ./.github/actions/test-linux + with: + runTestsParameters: >- + ${{ matrix.run_tests_parameters }} + - name: Test Tracing JIT + uses: ./.github/actions/test-linux + with: + runTestsParameters: >- + ${{ matrix.run_tests_parameters }} + -d zend_extension=opcache.so + -d opcache.jit_buffer_size=16M + - name: Test OpCache + uses: ./.github/actions/test-linux + with: + runTestsParameters: >- + ${{ matrix.run_tests_parameters }} + -d zend_extension=opcache.so + - name: Test Function JIT + uses: ./.github/actions/test-linux + with: + runTestsParameters: >- + ${{ matrix.run_tests_parameters }} + -d zend_extension=opcache.so + -d opcache.jit_buffer_size=16M + -d opcache.jit=1205 + MACOS: + needs: GENERATE_MATRIX + strategy: + fail-fast: false + matrix: + branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} + debug: [true, false] + zts: [true, false] + name: "${{ matrix.branch.name }}_MACOS_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" + runs-on: macos-10.15 + steps: + - name: git checkout + uses: actions/checkout@v2 + with: + ref: ${{ matrix.branch.ref }} + - name: brew + uses: ./.github/actions/brew + - name: ./configure + uses: ./.github/actions/configure-macos + with: + configurationParameters: >- + --${{ matrix.debug && 'enable' || 'disable' }}-debug + --${{ matrix.zts && 'enable' || 'disable' }}-zts + - name: make + run: |- + export PATH="/usr/local/opt/bison/bin:$PATH" + make -j$(sysctl -n hw.logicalcpu) >/dev/null + - name: make install + run: sudo make install + - name: Test + uses: ./.github/actions/test-macos + - name: Test Tracing JIT + uses: ./.github/actions/test-macos + with: + runTestsParameters: >- + -d zend_extension=opcache.so + -d opcache.protect_memory=1 + -d opcache.jit_buffer_size=16M + - name: Test OpCache + uses: ./.github/actions/test-macos + with: + runTestsParameters: >- + -d zend_extension=opcache.so + -d opcache.protect_memory=1 + - name: Test Function JIT + uses: ./.github/actions/test-macos + with: + runTestsParameters: >- + -d zend_extension=opcache.so + -d opcache.protect_memory=1 + -d opcache.jit_buffer_size=16M + -d opcache.jit=1205 diff --git a/.gitignore b/.gitignore index 1eab1d32ac417..362de559b3240 100644 --- a/.gitignore +++ b/.gitignore @@ -274,6 +274,11 @@ tmp-php.ini /Zend/zend_dtrace_gen.h /Zend/zend_dtrace_gen.h.bak +# ------------------------------------------------------------------------------ +# GitHub actions cache +# ------------------------------------------------------------------------------ +/branch-commit-cache.json + # ------------------------------------------------------------------------------ # Special cases to invert previous ignore patterns # ------------------------------------------------------------------------------ diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a633ceae01cbf..e896c993896de 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -4,6 +4,7 @@ trigger: include: - PHP-7.4 - PHP-8.0 + - PHP-8.1 - master paths: exclude: @@ -19,6 +20,7 @@ schedules: include: - PHP-7.4 - PHP-8.0 + - PHP-8.1 - master jobs: @@ -27,14 +29,6 @@ jobs: configurationName: I386_DEBUG_ZTS configurationParameters: '--enable-debug --enable-zts' - ${{ if eq(variables['Build.Reason'], 'Schedule') }}: - - template: azure/job.yml - parameters: - configurationName: DEBUG_ZTS - configurationParameters: '--enable-debug --enable-zts' - - template: azure/job.yml - parameters: - configurationName: RELEASE_NTS - configurationParameters: '--disable-debug --disable-zts' - template: azure/i386/job.yml parameters: configurationName: I386_DEBUG_NTS @@ -47,33 +41,6 @@ jobs: parameters: configurationName: I386_RELEASE_ZTS configurationParameters: '--disable-debug --enable-zts' - - template: azure/macos/job.yml - parameters: - configurationName: MACOS_DEBUG_ZTS - configurationParameters: '--enable-debug --enable-zts' - - template: azure/macos/job.yml - parameters: - configurationName: MACOS_RELEASE_NTS - configurationParameters: '--disable-debug --disable-zts' - - template: azure/macos/job.yml - parameters: - configurationName: MACOS_RELEASE_ZTS - configurationParameters: '--disable-debug --enable-zts' - - template: azure/job.yml - parameters: - configurationName: DEBUG_ZTS_ASAN_UBSAN - configurationParameters: >- - --enable-debug --enable-zts - CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC' - LDFLAGS='-fsanitize=undefined,address' - runTestsParameters: --asan - timeoutInMinutes: 360 - - template: azure/msan_job.yml - parameters: - configurationName: DEBUG_ZTS_MSAN - configurationParameters: '--enable-debug --enable-zts' - runTestsParameters: --msan - timeoutInMinutes: 90 - template: azure/community_job.yml parameters: configurationName: COMMUNITY diff --git a/azure/macos/brew.yml b/azure/macos/brew.yml deleted file mode 100644 index df4c5a532d740..0000000000000 --- a/azure/macos/brew.yml +++ /dev/null @@ -1,33 +0,0 @@ -parameters: - packages: '' - -steps: - - script: | - brew install pkg-config \ - autoconf \ - bison \ - re2c - displayName: 'Install Build Tools' - - script: | - brew install openssl@1.1 \ - krb5 \ - bzip2 \ - enchant \ - libffi \ - libpng \ - webp \ - freetype \ - intltool \ - icu4c \ - libiconv \ - zlib \ - t1lib \ - gd \ - libzip \ - gmp \ - tidyp \ - libxml2 \ - libxslt \ - postgresql - brew link icu4c gettext --force - displayName: 'Install Build Dependencies' diff --git a/azure/macos/job.yml b/azure/macos/job.yml deleted file mode 100644 index 39fe19268b9fd..0000000000000 --- a/azure/macos/job.yml +++ /dev/null @@ -1,99 +0,0 @@ -parameters: - configurationName: '' - configurationParameters: '' - -jobs: - - job: ${{ parameters.configurationName }} - pool: - vmImage: 'macOS-10.15' - steps: - - template: brew.yml - - script: | - export PATH="/usr/local/opt/bison/bin:$PATH" - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/openssl@1.1/lib/pkgconfig" - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/krb5/lib/pkgconfig" - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/libffi/lib/pkgconfig" - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/libxml2/lib/pkgconfig" - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/libxslt/lib/pkgconfig" - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/zlib/lib/pkgconfig" - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/icu4c/lib/pkgconfig" - ./buildconf --force - ./configure ${{ parameters.configurationParameters }} \ - --enable-option-checking=fatal \ - --prefix=/usr/local \ - --disable-phpdbg \ - --enable-fpm \ - --with-pdo-mysql=mysqlnd \ - --with-mysqli=mysqlnd \ - --with-pgsql=/usr/local/opt/libpq \ - --with-pdo-pgsql=/usr/local/opt/libpq \ - --with-pdo-sqlite \ - --without-pear \ - --enable-gd \ - --with-jpeg \ - --with-webp \ - --with-freetype \ - --enable-exif \ - --with-zip \ - --with-zlib \ - --enable-soap \ - --enable-xmlreader \ - --with-xsl \ - --with-tidy=/usr/local/opt/tidyp \ - --with-libxml \ - --enable-sysvsem \ - --enable-sysvshm \ - --enable-shmop \ - --enable-pcntl \ - --with-readline=/usr/local/opt/readline \ - --enable-mbstring \ - --with-curl \ - --with-gettext=/usr/local/opt/gettext \ - --enable-sockets \ - --with-bz2=/usr/local/opt/bzip2 \ - --with-openssl \ - --with-gmp=/usr/local/opt/gmp \ - --with-iconv=/usr/local/opt/libiconv \ - --enable-bcmath \ - --enable-calendar \ - --enable-ftp \ - --with-pspell=/usr/local/opt/aspell \ - --with-kerberos \ - --enable-sysvmsg \ - --with-ffi \ - --enable-zend-test \ - --enable-intl \ - --with-mhash \ - --with-sodium \ - --enable-dba \ - --enable-werror \ - --with-config-file-path=/etc \ - --with-config-file-scan-dir=/etc/php.d - displayName: 'Configure Build' - - script: | - export PATH="/usr/local/opt/bison/bin:$PATH" - make -j$(sysctl -n hw.ncpu) >/dev/null - displayName: 'Make Build' - - script: | - sudo make install - displayName: 'Install Build' - - template: test.yml - parameters: - configurationName: ${{ parameters.configurationName }} - - ${{ if eq(variables['Build.Reason'], 'Schedule') }}: - - template: test.yml - parameters: - configurationName: ${{ parameters.configurationName }} - runTestsName: 'OpCache' - runTestsParameters: -d zend_extension=opcache.so -d opcache.enable_cli=1 -d opcache.protect_memory=1 - - ${{ if eq(variables['Build.Reason'], 'Schedule') }}: - - template: test.yml - parameters: - configurationName: ${{ parameters.configurationName }} - runTestsName: 'Function JIT' - runTestsParameters: -d zend_extension=opcache.so -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=16M -d opcache.jit=1205 - - template: test.yml - parameters: - configurationName: ${{ parameters.configurationName }} - runTestsName: 'Tracing JIT' - runTestsParameters: -d zend_extension=opcache.so -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=16M diff --git a/azure/macos/test.yml b/azure/macos/test.yml deleted file mode 100644 index f139e53e404bf..0000000000000 --- a/azure/macos/test.yml +++ /dev/null @@ -1,29 +0,0 @@ -parameters: - runTestsName: '' - runTestsParameters: '' - -steps: - - script: | - export TEST_PHP_JUNIT=junit.xml - export REPORT_EXIT_STATUS=no - export SKIP_IO_CAPTURE_TESTS=1 - export CI_NO_IPV6=1 - rm -rf junit.xml | true - /usr/local/bin/php run-tests.php -P -q \ - -j$(sysctl -n hw.ncpu) \ - -g FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP \ - --offline \ - --show-diff \ - --show-slow 1000 \ - --set-timeout 120 \ - ${{ parameters.runTestsParameters }} - displayName: 'Test ${{ parameters.configurationName }} ${{ parameters.runTestsName }}' - condition: or(succeeded(), failed()) - - task: PublishTestResults@2 - inputs: - testResultsFormat: 'JUnit' - testResultsFiles: junit.xml - testRunTitle: '${{ parameters.configurationName }} ${{ parameters.runTestsName }}' - failTaskOnFailedTests: true - displayName: 'Export ${{ parameters.configurationName }} ${{ parameters.runTestsName }} Results' - condition: or(succeeded(), failed())