Skip to content

Commit

Permalink
Alpine/Musl CI
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-lb committed Jun 24, 2024
1 parent ff58a7f commit 79c9204
Show file tree
Hide file tree
Showing 6 changed files with 265 additions and 1 deletion.
61 changes: 61 additions & 0 deletions .github/actions/apk/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: apk
runs:
using: composite
steps:
- shell: sh
run: |
set -x
apk update -q
apk add \
util-linux \
bash \
sudo \
build-base \
autoconf \
unzip \
tar \
bison \
re2c \
pkgconf \
mysql-client \
aspell-dev \
hunspell-dev \
hunspell-en \
bzip2-dev \
curl-dev \
freetype-dev \
gettext-dev \
gnu-libiconv-dev \
gmp-dev \
icu-dev \
icu-data-full \
jpeg-dev \
libffi-dev \
libpng-dev \
libsodium-dev \
libwebp-dev \
libxml2-dev \
libxpm-dev \
libxslt-dev \
libzip-dev \
oniguruma-dev \
openssl-dev \
readline-dev \
sqlite-dev \
tidyhtml-dev \
krb5-dev \
gdbm-dev \
lmdb-dev \
argon2-dev \
enchant2-dev \
enchant2-hunspell \
freetds-dev \
imap-dev \
net-snmp-dev \
openldap-dev \
unixodbc-dev \
postgresql14-dev \
tzdata \
musl-locales \
musl-locales-lang
85 changes: 85 additions & 0 deletions .github/actions/configure-alpine/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: ./configure
inputs:
configurationParameters:
default: ''
required: false
configureArtifacts:
default: null
required: false
runs:
using: composite
steps:
- shell: bash
run: |
set -x
./buildconf --force
./configure \
--enable-option-checking=fatal \
--prefix=/usr \
--enable-phpdbg \
--enable-fpm \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \
${{ inputs.skipSlow == 'false' && '--with-pgsql' || '' }} \
${{ inputs.skipSlow == 'false' && '--with-pdo-pgsql' || '' }} \
${{ inputs.skipSlow == 'false' && '--with-pdo-sqlite' || '' }} \
--enable-intl \
--without-pear \
--enable-gd \
--with-jpeg \
--with-webp \
--with-freetype \
--with-xpm \
--enable-exif \
--with-zip \
--with-zlib \
--enable-soap \
--enable-xmlreader \
--with-xsl \
${{ inputs.skipSlow == 'false' && '--with-tidy' || '' }} \
--enable-sysvsem \
--enable-sysvshm \
--enable-shmop \
--enable-pcntl \
--with-readline \
--enable-mbstring \
--with-iconv=/usr \
--with-curl \
--with-gettext \
--enable-sockets \
--with-bz2 \
--with-openssl \
--with-gmp \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
${{ inputs.skipSlow == 'false' && '--with-enchant=/usr' || '' }} \
--enable-sysvmsg \
--with-ffi \
--enable-zend-test \
${{ inputs.skipSlow == 'false' && '--enable-dl-test=shared' || '' }} \
${{ inputs.skipSlow == 'false' && '--with-ldap' || '' }} \
${{ inputs.skipSlow == 'false' && '--with-ldap-sasl' || '' }} \
--with-password-argon2 \
--with-mhash \
--with-sodium \
--enable-dba \
--with-cdb \
--enable-flatfile \
--enable-inifile \
--with-lmdb \
--with-gdbm \
${{ inputs.skipSlow == 'false' && '--with-snmp' || '' }} \
${{ inputs.skipSlow == 'false' && '--with-unixODBC' || '' }} \
${{ inputs.skipSlow == 'false' && '--with-pdo-odbc=unixODBC,/usr' || '' }} \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
${{ inputs.skipSlow == 'false' && '--with-pdo-dblib' || '' }} \
--enable-werror \
${{ inputs.configurationParameters }}
- uses: actions/upload-artifact@v4
if: always() && inputs.configureArtifacts != null
with:
name: ${{ github.job }}_CONFIGURE_${{ inputs.configureArtifacts }}
path: ${{ github.workspace }}/config.log
retention-days: 5
10 changes: 10 additions & 0 deletions .github/actions/install-alpine/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Install
runs:
using: composite
steps:
- shell: bash
run: |
set -x
sudo make install
sudo mkdir -p /etc/php.d
sudo chmod 777 /etc/php.d
37 changes: 37 additions & 0 deletions .github/actions/test-alpine/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Test
inputs:
testArtifacts:
default: null
required: false
runTestsParameters:
default: ''
required: false
jitType:
default: 'disable'
required: false
runs:
using: composite
steps:
- shell: bash
run: |
set -x
export SKIP_IO_CAPTURE_TESTS=1
export TEST_PHP_JUNIT=junit.out.xml
export STACK_LIMIT_DEFAULTS_CHECK=1
sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \
-d opcache.jit=${{ inputs.jitType }} \
-d opcache.protect_memory=1 \
-d opcache.jit_buffer_size=64M \
-j$(($(nproc) - 1)) \
-g FAIL,BORK,LEAK,XLEAK \
--no-progress \
--offline \
--show-diff \
--show-slow 1000 \
--set-timeout 120
- uses: actions/upload-artifact@v4
if: always() && inputs.testArtifacts != null
with:
name: ${{ github.job }}_${{ inputs.testArtifacts }}
path: ${{ github.workspace }}/junit.out.xml
retention-days: 5
71 changes: 71 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,77 @@ jobs:
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
ALPINE:
if: github.repository_owner == 'php' || github.event_name == 'pull_request'
strategy:
fail-fast: false
matrix:
include:
- debug: false
zts: false
asan: false
- debug: true
zts: true
asan: true
name: "ALPINE_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || '' }}"
runs-on: ubuntu-22.04
container:
image: 'alpine:3.19.1'
steps:
- name: git checkout
uses: actions/checkout@v4
- name: apk
uses: ./.github/actions/apk
- name: LLVM 17 (ASAN-only)
if: ${{ matrix.asan }}
# libclang_rt.asan-x86_64.a is provided by compiler-rt, and only for clang17
run: |
apk add clang17 compiler-rt
- name: System info
run: |
echo "::group::Show host CPU info"
lscpu
echo "::endgroup::"
echo "::group::Show installed package versions"
apk list
echo "::endgroup::"
- name: ccache
uses: hendrikmuhs/[email protected]
with:
# This duplicates the "job.name" expression above because
# GitHub has no way to query the job name (github.job is the
# job id, not the job name)
key: "ALPINE_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || '' }}-${{hashFiles('main/php_version.h')}}"
append-timestamp: false
- name: ./configure
uses: ./.github/actions/configure-alpine
with:
# -Wno-error=address: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114609
# -Wno-error=stringop-overread: main/getopt.c: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114622
configurationParameters: >-
--${{ matrix.debug && 'enable' || 'disable' }}-debug
--${{ matrix.zts && 'enable' || 'disable' }}-zts
${{ matrix.asan && 'CFLAGS="-fsanitize=undefined,address -fno-sanitize=function -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined,address -fno-sanitize=function" CC=clang-17 CXX=clang++-17' || 'CFLAGS="-Wno-error=address -Wno-error=stringop-overread"' }}
skipSlow: ${{ matrix.asan }}
configureArtifacts: ${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}
- name: make
run: make -j$(/usr/bin/nproc) >/dev/null
- name: make install
uses: ./.github/actions/install-alpine
- name: Test
if: matrix.asan == false
uses: ./.github/actions/test-alpine
with:
testArtifacts: ${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}
- name: Test Tracing JIT
uses: ./.github/actions/test-alpine
with:
testArtifacts: ${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || '' }}_Tracing JIT
jitType: tracing
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
${{ matrix.asan && '--asan -x' || '' }}
MACOS_DEBUG_NTS:
if: github.repository == 'php/php-src' || github.event_name == 'pull_request'
strategy:
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,7 @@ ZEND_API ZEND_COLD void zend_error_zstr_at(
zval retval;
zval orig_user_error_handler;
bool in_compilation;
zend_class_entry *saved_class_entry;
zend_class_entry *saved_class_entry = NULL;
zend_stack loop_var_stack;
zend_stack delayed_oplines_stack;
int type = orig_type & E_ALL;
Expand Down

0 comments on commit 79c9204

Please sign in to comment.