Skip to content

Commit

Permalink
bump pskel
Browse files Browse the repository at this point in the history
  • Loading branch information
zeriyoshi committed Aug 15, 2024
1 parent fbd1354 commit a43de84
Show file tree
Hide file tree
Showing 14 changed files with 342 additions and 260 deletions.
27 changes: 14 additions & 13 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"name": "colopl_timeshifter",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
"maelvalais.autoconf"
]
}
},
"dockerComposeFile": "../compose.yaml",
"service": "dev",
"workspaceFolder": "/usr/src/php/ext/extension"
"name": "pskel (for Codespaces)",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
"maelvalais.autoconf",
"ms-azuretools.vscode-docker",
"editorconfig.editorconfig"
]
}
},
"dockerComposeFile": "./../compose.yaml",
"service": "shell"
}
24 changes: 24 additions & 0 deletions .devcontainer/local/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "pskel (for Local)",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
"maelvalais.autoconf",
"ms-azuretools.vscode-docker",
"editorconfig.editorconfig"
]
}
},
"dockerComposeFile": "./../../compose.yaml",
"service": "shell",
"mounts": [
{
"type": "bind",
"source": "./",
"target": "/workspace/pskel"
}
],
"workspaceFolder": "/workspace/pskel"
}
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.git
**/.git
**/README.md
**/LICENSE
**/.editorconfig
46 changes: 46 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# https://editorconfig.org/

root = true

[*]
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
charset = utf-8
tab_width = 4

[{*.{awk,bat,c,cpp,d,dasc,h,l,re,skl,w32,y},Makefile*}]
indent_size = 4
indent_style = tab

[*.{dtd,html,inc,php,phpt,rng,wsdl,xml,xsd,xsl}]
indent_size = 4
indent_style = space

[*.{ac,m4,sh,yml}]
indent_size = 2
indent_style = space

[*.md]
indent_style = space
max_line_length = 80

[COMMIT_EDITMSG]
indent_size = 4
indent_style = space
max_line_length = 80

[*.patch]
trim_trailing_whitespace = false

[*.json]
indent_size = 2
indent_style = space

[compose.yaml]
indent_size = 2
indent_style = space

[Dockerfile]
indent_size = 2
indent_style = space
File renamed without changes.
31 changes: 15 additions & 16 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
name: CI
on: [push, pull_request]
jobs:
CI:
runs-on: ubuntu-22.04
timeout-minutes: 60
Linux:
runs-on: ubuntu-latest
strategy:
matrix:
arch: ["amd64", "arm64v8", "s390x"]
platform: ["linux/amd64", "linux/arm64/v8", "linux/s390x"]
version: ["8.1", "8.2", "8.3"]
type: ["cli", "zts"]
distro: ["bookworm", "alpine"]
Expand All @@ -23,27 +22,27 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Build container
run: |
docker compose build --pull --no-cache --build-arg IMAGE=${{ matrix.arch }}/php --build-arg TAG=${{ matrix.version }}-${{ matrix.type }}-${{ matrix.distro }} --build-arg PSKEL_SKIP_DEBUG=${{ matrix.arch != 'amd64' && '1' || '' }}
docker compose build --pull --no-cache --build-arg PLATFORM="${{ matrix.platform }}" --build-arg IMAGE="php" --build-arg TAG="${{ matrix.version }}-${{ matrix.type }}-${{ matrix.distro }}"
- name: Run tests
run: |
docker compose run --rm --entrypoint=/usr/bin/ci --env TEST_EXTENSION=1 dev
docker compose run --rm shell library_test
- name: Test extension with PHP Debug Build
if: matrix.arch == 'amd64'
if: matrix.platform == 'linux/amd64'
run: |
docker compose run --rm --entrypoint=/usr/bin/ci --env TEST_EXTENSION_DEBUG=1 dev
docker compose run --rm shell pskel test debug
- name: Test extension with Valgrind
if: matrix.arch == 'amd64'
if: matrix.platform == 'linux/amd64'
run: |
docker compose run --rm --entrypoint=/usr/bin/ci --env TEST_EXTENSION_VALGRIND=1 dev
docker compose run --rm shell pskel test valgrind
- name: Test extension with LLVM Sanitizer (MemorySanitizer)
if: matrix.arch == 'amd64' && matrix.distro != 'alpine'
if: matrix.platform == 'linux/amd64' && matrix.distro != 'alpine'
run: |
docker compose run --rm --entrypoint=/usr/bin/ci --env TEST_EXTENSION_MSAN=1 dev
docker compose run --rm shell pskel test msan
- name: Test extension with LLVM Sanitizer (AddressSanitizer)
if: matrix.arch == 'amd64' && matrix.distro != 'alpine'
if: matrix.platform == 'linux/amd64' && matrix.distro != 'alpine'
run: |
docker compose run --rm --entrypoint=/usr/bin/ci --env TEST_EXTENSION_ASAN=1 dev
docker compose run --rm shell pskel test asan
- name: Test extension with LLVM Sanitizer (UndefinedBehaviorSanitizer)
if: matrix.arch == 'amd64' && matrix.distro != 'alpine'
if: matrix.platform == 'linux/amd64' && matrix.distro != 'alpine'
run: |
docker compose run --rm --entrypoint=/usr/bin/ci --env TEST_EXTENSION_UBSAN=1 dev
docker compose run --rm shell pskel test ubsan
21 changes: 21 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/local/include/php",
"/usr/local/include/php/TSRM",
"/usr/local/include/php/Zend",
"/usr/local/include/php/ext",
"/usr/local/include/php/include",
"/usr/local/include/php/main",
"/usr/local/include/php/sapi"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c99"
}
],
"version": 4
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"files.associations": {
"*.phpt": "php",
"*.c": "c",
"*.h": "c"
}
}
151 changes: 34 additions & 117 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,129 +1,46 @@
ARG PLATFORM=${BUILDPLATFORM:-linux/amd64}
ARG IMAGE=php
ARG TAG=8.3-cli
ARG TAG=8.3-zts-bookworm

FROM ${IMAGE}:${TAG}
FROM --platform=${PLATFORM} ${IMAGE}:${TAG}

ARG PSKEL_SKIP_DEBUG=""
ARG PSKEL_EXTRA_CONFIGURE_OPTIONS=""
COPY ./pskel.sh /usr/local/bin/pskel

ENV USE_ZEND_ALLOC=0
ENV USE_TRACKED_ALLOC=1
ENV ZEND_DONT_UNLOAD_MODULES=1
ENV PSKEL_SKIP_DEBUG=${PSKEL_SKIP_DEBUG}
ENV PSKEL_EXTRA_CONFIGURE_OPTIONS=${PSKEL_EXTRA_CONFIGURE_OPTIONS}

COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
RUN docker-php-source extract \
&& if test -f "/etc/debian_version"; then \
echo "deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm main" > "/etc/apt/sources.list.d/llvm.list" \
&& echo "deb-src http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm main" >> "/etc/apt/sources.list.d/llvm.list" \
&& curl -fsSL "https://apt.llvm.org/llvm-snapshot.gpg.key" -o "/etc/apt/trusted.gpg.d/apt.llvm.org.asc" \
&& apt-get update \
&& DEBIAN_FRONTEND="noninteractive" apt-get install -y "bison" "re2c" "zlib1g-dev" "libsqlite3-dev" "libxml2-dev" \
"autoconf" "pkg-config" "make" "gcc" "valgrind" "git" \
"clang-20" \
&& update-alternatives --install "/usr/bin/clang" clang "/usr/bin/clang-20" 100 \
&& update-alternatives --install "/usr/bin/clang++" clang++ "/usr/bin/clang++-20" 100; \
else \
apk add --no-cache "bison" "zlib-dev" "sqlite-dev" "libxml2-dev" \
"autoconf" "pkgconfig" "make" "gcc" "g++" "valgrind" "valgrind-dev" \
"musl-dev" "git"; \
fi

COPY ./ext /ext

# --------

RUN if test -f "/etc/debian_version"; then \
apt-get update && \
DEBIAN_FRONTEND="noninteractive" apt-get install -y \
"build-essential" "bison" "valgrind" "llvm" "clang" "zlib1g-dev" "libsqlite3-dev" "git" "unzip" && \
if test "${PSKEL_SKIP_DEBUG}" = ""; then \
docker-php-source extract && \
cd "/usr/src/php" && \
CFLAGS="-fpic -fpie -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-pie" ./configure --disable-all \
--includedir="/usr/local/include/gcc-valgrind-php" --program-prefix="gcc-valgrind-" \
--disable-cgi --disable-fpm --enable-cli \
--enable-mysqlnd --enable-pdo --with-pdo-mysql --with-pdo-sqlite \
--enable-debug --without-pcre-jit "$(php -r "echo PHP_ZTS === 1 ? '--enable-zts' : '';")" \
--with-valgrind \
${PSKEL_EXTRA_CONFIGURE_OPTIONS} \
--enable-option-checking=fatal && \
make -j$(nproc) && \
make install && \
cd - && \
docker-php-source delete && \
docker-php-source extract && \
cd "/usr/src/php" && \
CC=clang CXX=clang++ CFLAGS="-fsanitize=memory -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=memory" ./configure \
--includedir="/usr/local/include/clang-msan-php" --program-prefix="clang-msan-" \
--disable-cgi --disable-all --disable-fpm --enable-cli \
--enable-mysqlnd --enable-pdo --with-pdo-mysql --with-pdo-sqlite \
--enable-debug --without-pcre-jit "$(php -r "echo PHP_ZTS === 1 ? '--enable-zts' : '';")" \
--enable-memory-sanitizer \
${PSKEL_EXTRA_CONFIGURE_OPTIONS} \
--enable-option-checking=fatal && \
make -j$(nproc) && \
make install && \
cd - && \
docker-php-source delete && \
docker-php-source extract && \
cd "/usr/src/php" && \
CC=clang CXX=clang++ CFLAGS="-fsanitize=address -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=address" ./configure \
--includedir="/usr/local/include/clang-asan-php" --program-prefix="clang-asan-" \
--disable-cgi --disable-all --disable-fpm --enable-cli \
--enable-mysqlnd --enable-pdo --with-pdo-mysql --with-pdo-sqlite \
--enable-debug --without-pcre-jit "$(php -r "echo PHP_ZTS === 1 ? '--enable-zts' : '';")" \
--enable-address-sanitizer \
${PSKEL_EXTRA_CONFIGURE_OPTIONS} \
--enable-option-checking=fatal && \
make -j$(nproc) && \
make install && \
cd - && \
docker-php-source delete && \
docker-php-source extract && \
cd "/usr/src/php" && \
CC=clang CXX=clang++ CFLAGS="-fsanitize=undefined -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined" ./configure \
--includedir="/usr/local/include/clang-ubsan-php" --program-prefix="clang-ubsan-" \
--disable-cgi --disable-all --disable-fpm --enable-cli \
--enable-mysqlnd --enable-pdo --with-pdo-mysql --with-pdo-sqlite \
--enable-debug --without-pcre-jit "$(php -r "echo PHP_ZTS === 1 ? '--enable-zts' : '';")" \
--enable-undefined-sanitizer \
${PSKEL_EXTRA_CONFIGURE_OPTIONS} \
--enable-option-checking=fatal && \
make -j$(nproc) && \
make install && \
cd - && \
docker-php-source delete && \
docker-php-source extract && \
cd "/usr/src/php" && \
CFLAGS="-fpic -fpie -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-pie" ./configure --disable-all \
--includedir="/usr/local/include/debug-php" --program-prefix="debug-" \
--disable-cgi --disable-fpm --enable-cli \
--enable-mysqlnd --enable-pdo --with-pdo-mysql --with-pdo-sqlite \
--enable-debug "$(php -r "echo PHP_ZTS === 1 ? '--enable-zts' : '';")" \
${PSKEL_EXTRA_CONFIGURE_OPTIONS} \
--enable-option-checking=fatal && \
make -j$(nproc) && \
make install && \
cd - && \
docker-php-source delete; \
fi; \
elif test -f "/etc/alpine-release"; then \
apk add --no-cache ${PHPIZE_DEPS} "bison" "valgrind" "valgrind-dev" "zlib-dev" "sqlite-dev" "git" "unzip" && \
if test "${PSKEL_SKIP_DEBUG}" = ""; then \
docker-php-source extract && \
cd "/usr/src/php" && \
CFLAGS="-fpic -fpie -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-pie" ./configure --disable-all \
--includedir="/usr/local/include/gcc-valgrind-php" --program-prefix="gcc-valgrind-" \
--disable-cgi --disable-fpm --enable-cli \
--enable-mysqlnd --enable-pdo --with-pdo-mysql --with-pdo-sqlite \
--enable-debug --without-pcre-jit "$(php -r "echo PHP_ZTS === 1 ? '--enable-zts' : '';")" \
--with-valgrind \
${PSKEL_EXTRA_CONFIGURE_OPTIONS} \
--enable-option-checking=fatal && \
make -j$(nproc) && \
make install && \
cd - && \
docker-php-source delete && \
docker-php-source extract && \
cd "/usr/src/php" && \
CFLAGS="-fpic -fpie -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-pie" ./configure --disable-all \
--includedir="/usr/local/include/debug-php" --program-prefix="debug-" \
--disable-cgi --disable-fpm --enable-cli \
--enable-mysqlnd --enable-pdo --with-pdo-mysql --with-pdo-sqlite \
--enable-debug "$(php -r "echo PHP_ZTS === 1 ? '--enable-zts' : '';")" \
${PSKEL_EXTRA_CONFIGURE_OPTIONS} \
--enable-option-checking=fatal && \
make -j$(nproc) && \
make install && \
cd - && \
docker-php-source delete; \
fi; \
fi && \
docker-php-source extract
apt-get update \
&& apt-get install -y "unzip"; \
else \
apk add --no-cache "unzip"; \
fi

WORKDIR "/usr/src/php"
ENV COMPOSER_ROOT_VERSION=9.9.9-dev
COPY --from=composer:latest "/usr/bin/composer" "/usr/bin/composer"

COPY ./ext /ext
COPY ./ /project

COPY ./ci.sh /usr/bin/ci
RUN ln -s "/project/library_test.sh" "/usr/local/bin/library_test"
Loading

0 comments on commit a43de84

Please sign in to comment.