Skip to content

Crazy change #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/nightly_matrix.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?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(string $trigger, string $pr_commit_hash) {
if ($trigger === 'issue_comment' && strlen($pr_commit_hash) !== 0) {
return [['name' => 'PR', 'ref' => $pr_commit_hash]];
}

$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);
$pr_commit_hash = $argv[3] ?? '';

$discard_cache = ($trigger === 'schedule' && $attempt !== 1) || $trigger === 'workflow_dispatch';
if ($discard_cache) {
@unlink(get_branch_commit_cache_file_path());
}

$branches = get_branches($trigger, $pr_commit_hash);
$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";
147 changes: 147 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: Nightly
on:
schedule:
- cron: "0 1 * * *"
workflow_dispatch: ~
issue_comment:
types: [created]
jobs:
GENERATE_MATRIX:
name: Generate Matrix
if: ${{ github.event_name != 'issue_comment' || (github.event.issue.pull_request && contains(github.event.comment.body, '@php run-extended-tests')) }}
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 }}" "${{ github.event.pull_request.head.sha }}"
LINUX_X64:
needs: GENERATE_MATRIX
if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' && (github.event_name != 'issue_comment' || (github.event.issue.pull_request && contains(github.event.comment.body, '@php run-extended-tests'))) }}
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 != '[]' && (github.event_name != 'issue_comment' || (github.event.issue.pull_request && contains(github.event.comment.body, '@php run-extended-tests'))) }}
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 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,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
# ------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,4 @@ contribute:

For the list of people who've put work into PHP, please see the
[PHP credits page](https://php.net/credits.php).

32 changes: 0 additions & 32 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,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
Expand All @@ -52,30 +44,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 --enable-address-sanitizer --enable-undefined-sanitizer'
runTestsParameters: --asan
timeoutInMinutes: 360
- template: azure/msan_job.yml
parameters:
configurationName: DEBUG_ZTS_MSAN
configurationParameters: '--enable-debug --enable-zts'
runTestsParameters: --msan
timeoutInMinutes: 120
- template: azure/community_job.yml
parameters:
configurationName: COMMUNITY
Expand Down
33 changes: 0 additions & 33 deletions azure/macos/brew.yml

This file was deleted.

Loading