ci-tests #4703
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: ci-tests | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0/3 * * *" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Debug | |
jobs: | |
build: | |
# The CMake configure and build commands are platform agnostic and should work equally | |
# well on Windows or Mac. You can convert this to a matrix build if you need | |
# cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# Test of these containers | |
include: | |
- container: alpine-dev:latest | |
compiler: {cxx: clang++, c: clang} | |
- container: ubuntu-dev:20 | |
compiler: {cxx: g++, c: gcc} | |
cxx_flags: "-fprofile-arcs -ftest-coverage -Werror" | |
- container: fedora:30 | |
compiler: {cxx: g++, c: gcc} | |
- container: ubuntu-dev:24 | |
compiler: {cxx: g++, c: gcc} | |
timeout-minutes: 50 | |
container: | |
image: ghcr.io/romange/${{ matrix.container }} | |
# Seems that docker by default prohibits running iouring syscalls | |
options: --security-opt seccomp=unconfined | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure CMake | |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
run: | | |
uname -a | |
ulimit -a | |
cat /proc/cpuinfo | |
cmake -B ${{github.workspace}}/build \ | |
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ | |
-GNinja \ | |
-DCMAKE_C_COMPILER="${{matrix.compiler.c}}" \ | |
-DCMAKE_CXX_COMPILER="${{matrix.compiler.cxx}}" \ | |
-DCMAKE_CXX_FLAGS_DEBUG="${{matrix.cxx_flags}}" \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache | |
- name: Build | |
run: | | |
cd ${{github.workspace}}/build | |
ninja -k 5 base/all io/all strings/all util/all echo_server ping_iouring_server https_client_cli s3_demo | |
- name: Test | |
timeout-minutes: 2 | |
run: | | |
cd ${{github.workspace}}/build | |
# Create a rule that automatically prints stacktrace upon segfault | |
cat > ./init.gdb <<EOF | |
catch signal SIGSEGV | |
command | |
bt | |
end | |
EOF | |
gdb -ix ./init.gdb --batch -ex r --args ./fibers_test --logtostderr | |
GLOG_logtostderr=1 ctest -V -L CI | |
- name: Upload logs on failure | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries | |
path: | | |
${{github.workspace}}/build/fibers_test | |
${{github.workspace}}/build/fiber_socket_test | |
${{github.workspace}}/build/accept_server_test | |
- name: Coverage | |
if: matrix.container == 'ubuntu-dev:20' | |
run: | | |
lcov -c -d ${{github.workspace}}/build -o coverage.info | |
lcov --remove coverage.info -o coverage.info '/usr/*' '*/_deps/*' '*/third_party/*' | |
- name: Upload coverage to Codecov | |
if: matrix.container == 'ubuntu-dev:20' | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ./coverage.info | |
fail_ci_if_error: false |