Skip to content

fix zts

fix zts #26

Workflow file for this run

name: CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
name: PHP ${{ matrix.php }}, ZTS ${{ matrix.zts }}
runs-on: ubuntu-20.04
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
fail-fast: false
matrix:
php:
- 7.0.33
- 7.1.33
- 7.2.34
- 7.3.33
- 7.4.29
- 8.0.27
- 8.1.14
- 8.2.1
leveldb: [1.23]
zts: [enable, disable]
env:
CFLAGS: "-march=x86-64 -DZEND_TRACK_ARENA_ALLOC=1"
CXXFLAGS: "-march=x86-64"
steps:
- uses: actions/checkout@v2
- name: Install build dependencies
run: sudo apt-get update && sudo apt-get install re2c valgrind
- name: Restore LevelDB build cache
id: leveldb-build-cache
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/leveldb
key: leveldb-${{ matrix.leveldb }}-${{ hashFiles('.github/workflows/main.yml') }}
- name: Compile LevelDB
if: steps.leveldb-build-cache.outputs.cache-hit != 'true'
run: |
sudo apt update && sudo apt install cmake
curl -sSL https://github.com/google/leveldb/archive/${{ matrix.leveldb }}.tar.gz | tar -xz
cd leveldb-${{ matrix.leveldb }}
cmake \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/leveldb" \
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/leveldb" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DLEVELDB_BUILD_TESTS=OFF \
-DLEVELDB_BUILD_BENCHMARKS=OFF \
-DLEVELDB_SNAPPY=OFF \
-DLEVELDB_ZSTD=OFF \
-DLEVELDB_TCMALLOC=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON .
make -j8 install
- name: Restore PHP build cache
uses: actions/cache@v4
id: php-build-cache
with:
path: ${{ github.workspace }}/php
key: php-debug-${{ matrix.php }}-zts-${{ matrix.zts }}-ubuntu2004
- name: Get number of CPU cores
if: steps.php-build-cache.outputs.cache-hit != 'true'
uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores
- name: Download PHP
if: steps.php-build-cache.outputs.cache-hit != 'true'
run: curl -L https://github.com/php/php-src/archive/refs/tags/php-${{ matrix.php }}.tar.gz | tar -xz
- name: Compile PHP
if: steps.php-build-cache.outputs.cache-hit != 'true'
working-directory: php-src-php-${{ matrix.php }}
run: |
./buildconf --force
./configure \
--disable-all \
--enable-cli \
--with-valgrind \
--enable-debug \
--${{ matrix.zts }}-zts \
--${{ matrix.zts }}-maintainer-zts \
--prefix="${{ github.workspace }}/php"
make -j ${{ steps.cpu-cores.outputs.count }} install
- name: Dump PHP info
run: $GITHUB_WORKSPACE/php/bin/php -i
- name: Build extension
run: |
$GITHUB_WORKSPACE/php/bin/phpize
./configure --with-php-config=$GITHUB_WORKSPACE/php/bin/php-config --with-leveldb=${{ github.workspace }}/leveldb
make install
- name: Run .phpt tests
run: REPORT_EXIT_STATUS=1 NO_INTERACTION=1 TEST_PHP_ARGS="-m --show-diff" make test
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v2
with:
name: test-results-${{ matrix.php }}-zts-${{ matrix.zts }}-leveldb-${{ matrix.leveldb }}
path: |
${{ github.workspace }}/tests/*
!${{ github.workspace }}/tests/*.phpt