Extension #2158
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Extension | |
on: | |
push: | |
branches: | |
- master | |
- dd-appsec-php-** | |
tags: | |
- "*" | |
pull_request: | |
paths-ignore: | |
- cmake/helper.cmake | |
- src/helper/** | |
- tests/helper/** | |
- tests/fuzzer/** | |
- tests/integration/** | |
- examples/** | |
- 'LICENSE**' | |
- NOTICE | |
- '**.md' | |
- .github/workflows/codeql.yml | |
- .github/workflows/helper.yml | |
- .github/workflows/integration.yml | |
- .github/workflows/package.yml | |
- .github/workflows/release.yml | |
- .github/workflows/system-tests.yml | |
- .github/workflows/release/** | |
schedule: | |
- cron: 30 0 * * * | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
extension-test: | |
strategy: | |
fail-fast: false | |
matrix: | |
cfg: | |
- os: 'ubuntu-latest' | |
version: 7.0 | |
- os: 'ubuntu-latest' | |
version: 7.1 | |
- os: 'ubuntu-latest' | |
version: 7.2 | |
- os: 'ubuntu-latest' | |
version: 7.3 | |
- os: 'ubuntu-latest' | |
version: 7.4 | |
coverage: 'true' | |
- os: 'ubuntu-latest' | |
version: 7.4 | |
valgrind: 'true' | |
- os: 'ubuntu-latest' | |
version: 7.4 | |
static_analysis: 'true' | |
- os: 'ubuntu-latest' | |
version: '8.0' | |
- os: 'ubuntu-latest' | |
version: '8.1' | |
- os: 'ubuntu-latest' | |
version: '8.2' | |
# - os: 'macos-latest' | |
# version: 7.4 | |
runs-on: ${{ matrix.cfg.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Cache hunter packages | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.hunter | |
key: ${{ runner.os }}-extension | |
- name: PHP Setup | |
uses: shivammathur/setup-php@v2 | |
if: matrix.cfg.os != 'ubuntu-latest' || matrix.cfg.valgrind != 'true' | |
with: | |
php-version: ${{ matrix.cfg.version }} | |
- name: Install clang-{tidy,format} | |
if: matrix.cfg.static_analysis == 'true' | |
run: | | |
sudo apt-get remove -y python3-lldb-14 | |
sudo .github/workflows/scripts/llvm.sh 15 | |
sudo apt-get install -y clang-tidy-15 clang-format-15 | |
- name: Add repository for PHP debug symbols | |
if: matrix.cfg.os == 'ubuntu-latest' | |
run: | | |
sudo apt update | |
sudo apt-get install -y software-properties-common | |
sudo add-apt-repository -n -y "deb http://ppa.launchpad.net/ondrej/php/ubuntu $(lsb_release -cs) main main/debug" | |
sudo apt-get update | |
- name: Install required packages | |
if: matrix.cfg.os == 'ubuntu-latest' | |
run: | | |
sudo apt --fix-broken install | |
sudo apt-get install -y libpcre3 libpcre3-dev libsodium-dev libargon2-dev \ | |
libcurl4-openssl-dev $(if [[ "${{ matrix.cfg.valgrind }}" = true ]]; then \ | |
echo valgrind php${{ matrix.cfg.version }}-cli php${{ matrix.cfg.version }}-cli-dbgsym \ | |
php${{ matrix.cfg.version }}-cgi php${{ matrix.cfg.version }}-cgi-dbgsym \ | |
php${{ matrix.cfg.version }}-dev; fi) | |
- name: Generate Build Scripts | |
shell: bash | |
run: | | |
mkdir build | |
cd build | |
cmake -DCMAKE_BUILD_TYPE=Debug \ | |
-DDD_APPSEC_BUILD_HELPER=OFF \ | |
-DDD_APPSEC_ENABLE_COVERAGE=$(if [[ "${{ matrix.cfg.coverage }}" = true ]]; then echo ON; else echo OFF; fi) \ | |
$(if [[ "${{ matrix.cfg.valgrind }}" = true ]]; then echo -DPHP_CONFIG=/usr/bin/php-config${{ matrix.cfg.version }}; fi) \ | |
-DCLANG_TIDY=/usr/bin/run-clang-tidy-15 \ | |
-DCLANG_FORMAT=/usr/bin/clang-format-15 \ | |
.. | |
- name: Run clang-tidy | |
if: matrix.cfg.static_analysis == 'true' | |
run: | | |
VERBOSE=1 make -C build tidy format | |
- name: Build | |
run: | | |
VERBOSE=1 make -C build -j extension | |
VERBOSE=1 make -C build -j proj_tracer mock_helper | |
- name: Test | |
run: TESTS="--show-diff --show-mem $(if [[ "${{ matrix.cfg.valgrind }}" = true ]]; then echo -m; fi)" make -C build xtest | |
- name: Generate coverage report | |
if: matrix.cfg.coverage == 'true' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcovr | |
gcovr -f '.*src/extension/.*' -x -d -o coverage.xml | |
- name: Submit coverage | |
if: matrix.cfg.coverage == 'true' | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: extension | |
verbose: true | |
files: coverage.xml |