mirror of
https://github.com/php/php-src.git
synced 2024-11-23 09:54:15 +08:00
Add nightly for GitHub actions
This commit is contained in:
parent
7c702b72f2
commit
5de1cd9e48
71
.github/nightly_matrix.php
vendored
Normal file
71
.github/nightly_matrix.php
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
const BRANCHES = ['master', 'PHP-8.1', 'PHP-8.0'];
|
||||
|
||||
function get_branch_commit_cache_file_path(): string {
|
||||
return dirname(__DIR__) . '/branch-commit-cache.json';
|
||||
}
|
||||
|
||||
function get_branch_matrix(array $branches) {
|
||||
$result = array_map(function ($branch) {
|
||||
$branch_key = strtoupper(str_replace('.', '', $branch));
|
||||
return [
|
||||
'name' => $branch_key,
|
||||
'ref' => $branch,
|
||||
];
|
||||
}, $branches);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function get_branches() {
|
||||
$branch_commit_cache_file = get_branch_commit_cache_file_path();
|
||||
$branch_commit_map = [];
|
||||
if (file_exists($branch_commit_cache_file)) {
|
||||
$branch_commit_map = json_decode(file_get_contents($branch_commit_cache_file), JSON_THROW_ON_ERROR);
|
||||
}
|
||||
|
||||
$changed_branches = [];
|
||||
foreach (BRANCHES as $branch) {
|
||||
$previous_commit_hash = $branch_commit_map[$branch] ?? null;
|
||||
$current_commit_hash = trim(shell_exec('git rev-parse origin/' . $branch));
|
||||
|
||||
if ($previous_commit_hash !== $current_commit_hash) {
|
||||
$changed_branches[] = $branch;
|
||||
}
|
||||
|
||||
$branch_commit_map[$branch] = $current_commit_hash;
|
||||
}
|
||||
|
||||
file_put_contents($branch_commit_cache_file, json_encode($branch_commit_map));
|
||||
|
||||
return get_branch_matrix($changed_branches);
|
||||
}
|
||||
|
||||
function get_asan_matrix(array $branches) {
|
||||
$jobs = [];
|
||||
foreach ($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;
|
||||
}
|
||||
|
||||
$trigger = $argv[1] ?? 'schedule';
|
||||
$attempt = (int) ($argv[2] ?? 1);
|
||||
$discard_cache = ($trigger === 'schedule' && $attempt !== 1) || $trigger === 'workflow_dispatch';
|
||||
if ($discard_cache) {
|
||||
@unlink(get_branch_commit_cache_file_path());
|
||||
}
|
||||
|
||||
$branches = get_branches();
|
||||
$asan_matrix = get_asan_matrix($branches);
|
||||
|
||||
echo '::set-output name=branches::' . json_encode($branches, JSON_UNESCAPED_SLASHES) . "\n";
|
||||
echo '::set-output name=asan-matrix::' . json_encode($asan_matrix, JSON_UNESCAPED_SLASHES) . "\n";
|
146
.github/workflows/nightly.yml
vendored
Normal file
146
.github/workflows/nightly.yml
vendored
Normal file
@ -0,0 +1,146 @@
|
||||
name: Nightly
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 1 * * *"
|
||||
workflow_dispatch: ~
|
||||
issue_comment:
|
||||
types: [created]
|
||||
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:
|
||||
# Set fetch-depth to 0 to clone the full repository
|
||||
# including all branches. This is required to find
|
||||
# the correct commit hashes.
|
||||
fetch-depth: 0
|
||||
- name: Grab the commit mapping
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: branch-commit-cache.json
|
||||
# The cache key needs to change every time for the
|
||||
# cache to be updated after this job finishes.
|
||||
key: nightly-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
restore-keys: |
|
||||
nightly-
|
||||
- name: Generate Matrix
|
||||
id: set-matrix
|
||||
run: php .github/nightly_matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}"
|
||||
LINUX_X64:
|
||||
needs: GENERATE_MATRIX
|
||||
if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
|
||||
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
|
||||
if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
|
||||
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
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -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
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -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
|
||||
|
@ -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'
|
@ -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
|
@ -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())
|
Loading…
Reference in New Issue
Block a user