Skip to content

server logs refactoring #3332

server logs refactoring

server logs refactoring #3332

Workflow file for this run

name: build
on:
pull_request:
branches:
- master
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: true
kphp_root_dir: /home/kitten/kphp
kphp_polyfills_dir: /home/kitten/kphp/kphp-polyfills
kphp_build_dir: /home/kitten/kphp/build
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: buster
compiler: g++
cpp: 17
asan: off
ubsan: off
- os: focal
compiler: clang++
cpp: 17
asan: off
ubsan: on
- os: focal
compiler: g++-10
cpp: 20
asan: on
ubsan: off
- os: jammy
compiler: g++
cpp: 20
asan: on
ubsan: off
name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}"
steps:
- uses: actions/checkout@v3
- name: Get polyfills repo
uses: actions/checkout@v3
with:
repository: 'VKCOM/kphp-polyfills'
path: 'kphp-polyfills'
- name: Cache docker image
uses: actions/cache@v3
id: docker-image-cache
with:
path: kphp-build-env-${{matrix.os}}.tar
key: docker-image-cache-${{matrix.os}}-${{ hashFiles('.github/workflows/Dockerfile.*') }}
- name: Build and save docker image
if: steps.docker-image-cache.outputs.cache-hit != 'true'
run: |
docker build -f $GITHUB_WORKSPACE/.github/workflows/Dockerfile.${{matrix.os}} $GITHUB_WORKSPACE -t kphp-build-img-${{matrix.os}}
docker save --output kphp-build-env-${{matrix.os}}.tar kphp-build-img-${{matrix.os}}
- name: Load docker image from cache
if: steps.docker-image-cache.outputs.cache-hit == 'true'
run: docker load --input kphp-build-env-${{matrix.os}}.tar
- name: Start docker container
run: |
docker run -dt --name kphp-build-container-${{matrix.os}} kphp-build-img-${{matrix.os}}
docker cp $GITHUB_WORKSPACE/. kphp-build-container-${{matrix.os}}:${{env.kphp_root_dir}}
- name: Add git safe directory
run: docker exec kphp-build-container-${{matrix.os}} bash -c
"git config --global --add safe.directory ${{env.kphp_root_dir}}"
- name: Build all
run: docker exec kphp-build-container-${{matrix.os}} bash -c
"cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DADDRESS_SANITIZER=${{matrix.asan}} -DUNDEFINED_SANITIZER=${{matrix.ubsan}} -DPDO_DRIVER_MYSQL=ON -DPDO_DRIVER_PGSQL=ON -DPDO_LIBS_STATIC_LINKING=ON -S ${{env.kphp_root_dir}} -B ${{env.kphp_build_dir}} && make -C ${{env.kphp_build_dir}} -j$(nproc) all"
- name: Run unit tests
run: docker exec kphp-build-container-${{matrix.os}} bash -c
"make -C ${{env.kphp_build_dir}} -j$(nproc) test"
- name: Compile dummy PHP script
run: docker exec kphp-build-container-${{matrix.os}} bash -c
"cd ${{env.kphp_build_dir}} && echo 'hello world' > demo.php && ${{env.kphp_root_dir}}/objs/bin/kphp2cpp --cxx ${{matrix.compiler}} demo.php && kphp_out/server -o --user kitten"
- name: Polyfills composer install
run: docker exec kphp-build-container-${{matrix.os}} bash -c
"composer install -d ${{env.kphp_polyfills_dir}}"
- name: Remove docker container
run: docker rm -f kphp-build-container-${{matrix.os}}
build-macos:
runs-on: ${{matrix.os}}-12
strategy:
matrix:
include:
- os: macos
compiler: clang++
cpp: 17
name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}"
steps:
- uses: actions/checkout@v3
- name: Get polyfills repo
uses: actions/checkout@v3
with:
repository: 'uber/h3'
path: 'h3'
ref: stable-3.x
- name: Setup Environment
run: |
brew tap shivammathur/php
brew update
brew install re2c cmake coreutils openssl libiconv re2 pcre yaml-cpp zstd googletest shivammathur/php/[email protected]
brew link --overwrite --force shivammathur/php/[email protected]
/usr/local/Frameworks/Python.framework/Versions/3.11/bin/pip3 install jsonschema
- name: Build Uber h3
run: cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -S $GITHUB_WORKSPACE/h3 -B ${{runner.workspace}}/h3/build && make install -C ${{runner.workspace}}/h3/build -j$(nproc) all
- name: Run cmake
run: cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DDOWNLOAD_MISSING_LIBRARIES=On -S $GITHUB_WORKSPACE -B ${{runner.workspace}}/build
- name: Build all
run: make -C ${{runner.workspace}}/build -j$(nproc) all
- name: Run unit tests
run: make -C ${{runner.workspace}}/build -j$(nproc) test
- name: Compile dummy PHP script
working-directory: ${{runner.workspace}}/build
run: |
echo 'hello world' > demo.php
$GITHUB_WORKSPACE/objs/bin/kphp2cpp --cxx ${{matrix.compiler}} demo.php
kphp_out/server -o