Skip to content

Add nightly for GitHub actions #14

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 1 commit 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
62 changes: 62 additions & 0 deletions .github/nightly_matrix.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

const BRANCHES = ['master', 'PHP-8.1', 'PHP-8.0'];

function get_changed_branches() {
$branch_commit_cache_file = dirname(__DIR__) . '/branch-commit-cache.json';
$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 $changed_branches;
}

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_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";
143 changes: 143 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
# ------------------------------------------------------------------------------
Expand Down
37 changes: 2 additions & 35 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ trigger:
include:
- PHP-7.4
- PHP-8.0
- PHP-8.1
- master
paths:
exclude:
Expand All @@ -19,6 +20,7 @@ schedules:
include:
- PHP-7.4
- PHP-8.0
- PHP-8.1
- master

jobs:
Expand All @@ -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
Expand All @@ -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
Expand Down
33 changes: 0 additions & 33 deletions azure/macos/brew.yml

This file was deleted.

Loading