mirror of
https://github.com/dunglas/frankenphp.git
synced 2025-12-24 13:38:11 +08:00
Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout). Updates `actions/checkout` from 5 to 6 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions ... Signed-off-by: dependabot[bot] <support@github.com>
114 lines
4.0 KiB
YAML
114 lines
4.0 KiB
YAML
---
|
|
name: Sanitizers
|
|
concurrency:
|
|
cancel-in-progress: true
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- "docs/**"
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- "docs/**"
|
|
permissions:
|
|
contents: read
|
|
env:
|
|
GOTOOLCHAIN: local
|
|
jobs:
|
|
# Adapted from https://github.com/beberlei/hdrhistogram-php
|
|
sanitizers:
|
|
name: ${{ matrix.sanitizer }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
sanitizer: ["asan", "msan"]
|
|
env:
|
|
CFLAGS: -g -O0 -fsanitize=${{ matrix.sanitizer == 'asan' && 'address' || 'memory' }} -DZEND_TRACK_ARENA_ALLOC
|
|
LDFLAGS: -fsanitize=${{ matrix.sanitizer == 'asan' && 'address' || 'memory' }}
|
|
CC: clang
|
|
CXX: clang++
|
|
USE_ZEND_ALLOC: 0
|
|
LIBRARY_PATH: ${{ github.workspace }}/php/target/lib:${{ github.workspace }}/watcher/target/lib
|
|
LD_LIBRARY_PATH: ${{ github.workspace }}/php/target/lib
|
|
# PHP doesn't free some memory on purpose, we have to disable leaks detection: https://go.dev/doc/go1.25#go-command
|
|
ASAN_OPTIONS: detect_leaks=0
|
|
steps:
|
|
- name: Remove local PHP
|
|
run: sudo apt-get remove --purge --autoremove 'php*' 'libmemcached*'
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-go@v6
|
|
with:
|
|
go-version: "1.25"
|
|
cache-dependency-path: |
|
|
go.sum
|
|
caddy/go.sum
|
|
- name: Determine PHP version
|
|
id: determine-php-version
|
|
run: |
|
|
curl -fsSL 'https://www.php.net/releases/index.php?json&max=1&version=8.5' -o version.json
|
|
echo version="$(jq -r 'keys[0]' version.json)" >> "$GITHUB_OUTPUT"
|
|
echo archive="$(jq -r '.[] .source[] | select(.filename |endswith(".xz")) | "https://www.php.net/distributions/" + .filename' version.json)" >> "$GITHUB_OUTPUT"
|
|
- name: Cache PHP
|
|
id: cache-php
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: php/target
|
|
key: php-sanitizers-${{ matrix.sanitizer }}-${{ runner.arch }}-${{ steps.determine-php-version.outputs.version }}
|
|
- if: steps.cache-php.outputs.cache-hit != 'true'
|
|
name: Compile PHP
|
|
run: |
|
|
mkdir php/
|
|
curl -fsSL "${URL}" | tar -Jx -C php --strip-components=1
|
|
cd php/
|
|
./configure \
|
|
CFLAGS="$CFLAGS" \
|
|
LDFLAGS="$LDFLAGS" \
|
|
--enable-debug \
|
|
--enable-embed \
|
|
--enable-zts \
|
|
--enable-option-checking=fatal \
|
|
--disable-zend-signals \
|
|
--without-sqlite3 \
|
|
--without-pdo-sqlite \
|
|
--without-libxml \
|
|
--disable-dom \
|
|
--disable-simplexml \
|
|
--disable-xml \
|
|
--disable-xmlreader \
|
|
--disable-xmlwriter \
|
|
--without-pcre-jit \
|
|
--disable-opcache-jit \
|
|
--disable-cli \
|
|
--disable-cgi \
|
|
--disable-phpdbg \
|
|
--without-pear \
|
|
--disable-mbregex \
|
|
--enable-werror \
|
|
${{ matrix.sanitizer == 'msan' && '--enable-memory-sanitizer' || '' }} \
|
|
--prefix="$(pwd)/target/"
|
|
make -j"$(getconf _NPROCESSORS_ONLN)"
|
|
make install
|
|
env:
|
|
URL: ${{ steps.determine-php-version.outputs.archive }}
|
|
- name: Add PHP to the PATH
|
|
run: echo "$(pwd)/php/target/bin" >> "$GITHUB_PATH"
|
|
- name: Install e-dant/watcher
|
|
uses: ./.github/actions/watcher
|
|
- name: Set Set CGO flags
|
|
run: |
|
|
{
|
|
echo "CGO_CFLAGS=$CFLAGS -I${PWD}/watcher/target/include $(php-config --includes)"
|
|
echo "CGO_LDFLAGS=$LDFLAGS $(php-config --ldflags) $(php-config --libs)"
|
|
} >> "$GITHUB_ENV"
|
|
- name: Compile tests
|
|
run: go test ${{ matrix.sanitizer == 'msan' && '-tags=nowatcher' || '' }} -${{ matrix.sanitizer }} -v -x -c
|
|
- name: Run tests
|
|
run: ./frankenphp.test -test.v
|