Skip to content

Feat/update ubuntu build documentation (#447) #1100

Feat/update ubuntu build documentation (#447)

Feat/update ubuntu build documentation (#447) #1100

name: Build & Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
BUILD_TYPE: Debug
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu 22.04 - GCC 12",
os: ubuntu-22.04,
triplet: x64-linux,
cc: "gcc-12",
cxx: "g++-12",
gcov: "gcov-12"
}
- {
name: "Ubuntu 24.04 - GCC 13",
os: ubuntu-24.04,
triplet: x64-linux,
cc: "gcc-13",
cxx: "g++-13",
gcov: "gcov-13"
}
- {
name: "Ubuntu 24.04 - GCC 14",
os: ubuntu-24.04,
triplet: x64-linux,
cc: "gcc-14",
cxx: "g++-14",
gcov: "gcov-14"
}
steps:
- name: Setup cmake
uses: lukka/get-cmake@latest
- name: Ensure 20 2MB Hugepages free (required for comprehensive testing)
shell: bash
timeout-minutes: 5
run: while [ $(cat /proc/meminfo | grep HugePages_Free | awk '{ printf $2 }') -lt 20 ]; do echo "Requesting 20 2MB hugepages"; echo 350 | sudo tee /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages; cat /proc/meminfo | grep HugePages_; done; free -m;
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 2
- name: Install required dependencies
run: sudo apt-get update && sudo apt-get install -y build-essential cmake pkg-config git libnuma1 libnuma-dev libcurl4-openssl-dev libcurl4 libyaml-0-2 libyaml-dev libmbedtls-dev libpcre2-8-0 libpcre2-dev libjson-c-dev valgrind libhiredis-dev liblzf-dev redis-tools lcov
- name: Report build tool versions
shell: bash
run: |
echo "CC version: $(${{matrix.config.cc}} --version)"
echo "CXX version: $(${{matrix.config.cxx}} --version)"
echo "gcov version: $(${{matrix.config.gcov}} --version)"
echo "cmake version: $(cmake --version)"
echo "lcov version: $(lcov --version)"
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake $GITHUB_WORKSPACE -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DUSE_HASH_ALGORITHM_T1HA2=1 -DBUILD_TESTS=1 -DBUILD_INTERNAL_BENCHES=1
- name: Build cachegrand-server
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --build . --target cachegrand-server -- -j $(nproc)
- name: Build cachegrand-tests
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --build . --target cachegrand-tests -- -j $(nproc)
- name: Tests - Unit Tests
working-directory: ${{github.workspace}}/build
shell: bash
run: cd tests/unit_tests && sudo ./cachegrand-tests --order lex
- name: Code Coverage - Generation
run: |
cd ${{github.workspace}}/build
lcov --gcov-tool ${{matrix.config.gcov}} --capture --directory . --exclude catch2 --output-file coverage.info
lcov --gcov-tool ${{matrix.config.gcov}} --remove coverage.info '3rdparty/*' 'tests/*' '/usr/*' '_deps/*' --output-file coverage.info
lcov --gcov-tool ${{matrix.config.gcov}} --list coverage.info
- uses: codecov/codecov-action@v3
with:
files: ${{github.workspace}}/build/coverage.info
flags: unittests
name: cachegrand-server
fail_ci_if_error: false
verbose: false
# - name: Tests - Integration Tests - Redis Server
# working-directory: ${{github.workspace}}/build
# shell: bash
# run: ctest -R cachegrand-integration-tests-redis-server --verbose || true
# - uses: actions/upload-artifact@v2
# with:
# name: tests-integration-tests-redis-server-results
# path: ${{github.workspace}}/build/tests/integration_tests/redis_server/junit-report.xml