Skip to content

Commit 490c423

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Add nightly for GitHub actions
2 parents 22f8886 + 5de1cd9 commit 490c423

File tree

7 files changed

+222
-192
lines changed

7 files changed

+222
-192
lines changed

.github/nightly_matrix.php

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
3+
const BRANCHES = ['master', 'PHP-8.1', 'PHP-8.0'];
4+
5+
function get_branch_commit_cache_file_path(): string {
6+
return dirname(__DIR__) . '/branch-commit-cache.json';
7+
}
8+
9+
function get_branch_matrix(array $branches) {
10+
$result = array_map(function ($branch) {
11+
$branch_key = strtoupper(str_replace('.', '', $branch));
12+
return [
13+
'name' => $branch_key,
14+
'ref' => $branch,
15+
];
16+
}, $branches);
17+
18+
return $result;
19+
}
20+
21+
function get_branches() {
22+
$branch_commit_cache_file = get_branch_commit_cache_file_path();
23+
$branch_commit_map = [];
24+
if (file_exists($branch_commit_cache_file)) {
25+
$branch_commit_map = json_decode(file_get_contents($branch_commit_cache_file), JSON_THROW_ON_ERROR);
26+
}
27+
28+
$changed_branches = [];
29+
foreach (BRANCHES as $branch) {
30+
$previous_commit_hash = $branch_commit_map[$branch] ?? null;
31+
$current_commit_hash = trim(shell_exec('git rev-parse origin/' . $branch));
32+
33+
if ($previous_commit_hash !== $current_commit_hash) {
34+
$changed_branches[] = $branch;
35+
}
36+
37+
$branch_commit_map[$branch] = $current_commit_hash;
38+
}
39+
40+
file_put_contents($branch_commit_cache_file, json_encode($branch_commit_map));
41+
42+
return get_branch_matrix($changed_branches);
43+
}
44+
45+
function get_asan_matrix(array $branches) {
46+
$jobs = [];
47+
foreach ($branches as $branch) {
48+
$jobs[] = [
49+
'name' => '_ASAN_UBSAN',
50+
'branch' => $branch,
51+
'debug' => true,
52+
'zts' => true,
53+
'configuration_parameters' => "CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC' LDFLAGS='-fsanitize=undefined,address'",
54+
'run_tests_parameters' => '--asan',
55+
];
56+
}
57+
return $jobs;
58+
}
59+
60+
$trigger = $argv[1] ?? 'schedule';
61+
$attempt = (int) ($argv[2] ?? 1);
62+
$discard_cache = ($trigger === 'schedule' && $attempt !== 1) || $trigger === 'workflow_dispatch';
63+
if ($discard_cache) {
64+
@unlink(get_branch_commit_cache_file_path());
65+
}
66+
67+
$branches = get_branches();
68+
$asan_matrix = get_asan_matrix($branches);
69+
70+
echo '::set-output name=branches::' . json_encode($branches, JSON_UNESCAPED_SLASHES) . "\n";
71+
echo '::set-output name=asan-matrix::' . json_encode($asan_matrix, JSON_UNESCAPED_SLASHES) . "\n";

.github/workflows/nightly.yml

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: Nightly
2+
on:
3+
schedule:
4+
- cron: "0 1 * * *"
5+
workflow_dispatch: ~
6+
issue_comment:
7+
types: [created]
8+
jobs:
9+
GENERATE_MATRIX:
10+
name: Generate Matrix
11+
runs-on: ubuntu-latest
12+
outputs:
13+
branches: ${{ steps.set-matrix.outputs.branches }}
14+
asan-matrix: ${{ steps.set-matrix.outputs.asan-matrix }}
15+
steps:
16+
- uses: actions/checkout@v2
17+
with:
18+
# Set fetch-depth to 0 to clone the full repository
19+
# including all branches. This is required to find
20+
# the correct commit hashes.
21+
fetch-depth: 0
22+
- name: Grab the commit mapping
23+
uses: actions/cache@v3
24+
with:
25+
path: branch-commit-cache.json
26+
# The cache key needs to change every time for the
27+
# cache to be updated after this job finishes.
28+
key: nightly-${{ github.run_id }}-${{ github.run_attempt }}
29+
restore-keys: |
30+
nightly-
31+
- name: Generate Matrix
32+
id: set-matrix
33+
run: php .github/nightly_matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}"
34+
LINUX_X64:
35+
needs: GENERATE_MATRIX
36+
if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }}
41+
debug: [true, false]
42+
zts: [true, false]
43+
include: ${{ fromJson(needs.GENERATE_MATRIX.outputs.asan-matrix) }}
44+
name: "${{ matrix.branch.name }}_LINUX_X64${{ matrix.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}"
45+
runs-on: ubuntu-20.04
46+
steps:
47+
- name: git checkout
48+
uses: actions/checkout@v2
49+
with:
50+
ref: ${{ matrix.branch.ref }}
51+
- name: Create mssql container
52+
uses: ./.github/actions/mssql
53+
- name: apt
54+
uses: ./.github/actions/apt-x64
55+
- name: ./configure
56+
uses: ./.github/actions/configure-x64
57+
with:
58+
configurationParameters: >-
59+
${{ matrix.configuration_parameters }}
60+
--${{ matrix.debug && 'enable' || 'disable' }}-debug
61+
--${{ matrix.zts && 'enable' || 'disable' }}-zts
62+
- name: make
63+
run: make -j$(/usr/bin/nproc) >/dev/null
64+
- name: make install
65+
uses: ./.github/actions/install-linux
66+
- name: Setup
67+
uses: ./.github/actions/setup-x64
68+
- name: Test
69+
uses: ./.github/actions/test-linux
70+
with:
71+
runTestsParameters: >-
72+
${{ matrix.run_tests_parameters }}
73+
- name: Test Tracing JIT
74+
uses: ./.github/actions/test-linux
75+
with:
76+
runTestsParameters: >-
77+
${{ matrix.run_tests_parameters }}
78+
-d zend_extension=opcache.so
79+
-d opcache.jit_buffer_size=16M
80+
- name: Test OpCache
81+
uses: ./.github/actions/test-linux
82+
with:
83+
runTestsParameters: >-
84+
${{ matrix.run_tests_parameters }}
85+
-d zend_extension=opcache.so
86+
- name: Test Function JIT
87+
uses: ./.github/actions/test-linux
88+
with:
89+
runTestsParameters: >-
90+
${{ matrix.run_tests_parameters }}
91+
-d zend_extension=opcache.so
92+
-d opcache.jit_buffer_size=16M
93+
-d opcache.jit=1205
94+
MACOS:
95+
needs: GENERATE_MATRIX
96+
if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
97+
strategy:
98+
fail-fast: false
99+
matrix:
100+
branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }}
101+
debug: [true, false]
102+
zts: [true, false]
103+
name: "${{ matrix.branch.name }}_MACOS_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}"
104+
runs-on: macos-10.15
105+
steps:
106+
- name: git checkout
107+
uses: actions/checkout@v2
108+
with:
109+
ref: ${{ matrix.branch.ref }}
110+
- name: brew
111+
uses: ./.github/actions/brew
112+
- name: ./configure
113+
uses: ./.github/actions/configure-macos
114+
with:
115+
configurationParameters: >-
116+
--${{ matrix.debug && 'enable' || 'disable' }}-debug
117+
--${{ matrix.zts && 'enable' || 'disable' }}-zts
118+
- name: make
119+
run: |-
120+
export PATH="/usr/local/opt/bison/bin:$PATH"
121+
make -j$(sysctl -n hw.logicalcpu) >/dev/null
122+
- name: make install
123+
run: sudo make install
124+
- name: Test
125+
uses: ./.github/actions/test-macos
126+
- name: Test Tracing JIT
127+
uses: ./.github/actions/test-macos
128+
with:
129+
runTestsParameters: >-
130+
-d zend_extension=opcache.so
131+
-d opcache.protect_memory=1
132+
-d opcache.jit_buffer_size=16M
133+
- name: Test OpCache
134+
uses: ./.github/actions/test-macos
135+
with:
136+
runTestsParameters: >-
137+
-d zend_extension=opcache.so
138+
-d opcache.protect_memory=1
139+
- name: Test Function JIT
140+
uses: ./.github/actions/test-macos
141+
with:
142+
runTestsParameters: >-
143+
-d zend_extension=opcache.so
144+
-d opcache.protect_memory=1
145+
-d opcache.jit_buffer_size=16M
146+
-d opcache.jit=1205

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ tmp-php.ini
277277
/Zend/zend_dtrace_gen.h
278278
/Zend/zend_dtrace_gen.h.bak
279279

280+
# ------------------------------------------------------------------------------
281+
# GitHub actions cache
282+
# ------------------------------------------------------------------------------
283+
/branch-commit-cache.json
284+
280285
# ------------------------------------------------------------------------------
281286
# Special cases to invert previous ignore patterns
282287
# ------------------------------------------------------------------------------

azure-pipelines.yml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,6 @@ jobs:
3232
configurationName: I386_DEBUG_ZTS
3333
configurationParameters: '--enable-debug --enable-zts'
3434
- ${{ if eq(variables['Build.Reason'], 'Schedule') }}:
35-
- template: azure/job.yml
36-
parameters:
37-
configurationName: DEBUG_ZTS
38-
configurationParameters: '--enable-debug --enable-zts'
39-
- template: azure/job.yml
40-
parameters:
41-
configurationName: RELEASE_NTS
42-
configurationParameters: '--disable-debug --disable-zts'
4335
- template: azure/i386/job.yml
4436
parameters:
4537
configurationName: I386_DEBUG_NTS
@@ -52,30 +44,6 @@ jobs:
5244
parameters:
5345
configurationName: I386_RELEASE_ZTS
5446
configurationParameters: '--disable-debug --enable-zts'
55-
- template: azure/macos/job.yml
56-
parameters:
57-
configurationName: MACOS_DEBUG_ZTS
58-
configurationParameters: '--enable-debug --enable-zts'
59-
- template: azure/macos/job.yml
60-
parameters:
61-
configurationName: MACOS_RELEASE_NTS
62-
configurationParameters: '--disable-debug --disable-zts'
63-
- template: azure/macos/job.yml
64-
parameters:
65-
configurationName: MACOS_RELEASE_ZTS
66-
configurationParameters: '--disable-debug --enable-zts'
67-
- template: azure/job.yml
68-
parameters:
69-
configurationName: DEBUG_ZTS_ASAN_UBSAN
70-
configurationParameters: '--enable-debug --enable-zts --enable-address-sanitizer --enable-undefined-sanitizer'
71-
runTestsParameters: --asan
72-
timeoutInMinutes: 360
73-
- template: azure/msan_job.yml
74-
parameters:
75-
configurationName: DEBUG_ZTS_MSAN
76-
configurationParameters: '--enable-debug --enable-zts'
77-
runTestsParameters: --msan
78-
timeoutInMinutes: 120
7947
- template: azure/community_job.yml
8048
parameters:
8149
configurationName: COMMUNITY

azure/macos/brew.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)