PS-10014 feature: Add Valgrind testing to the CI #354
Workflow file for this run
This file contains hidden or 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: CMake | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| env: | |
| AWS_SDK_CPP_MAJOR: 1 | |
| AWS_SDK_CPP_MINOR: 11 | |
| AWS_SDK_CPP_PATCH: 774 | |
| BOOST_MAJOR: 1 | |
| BOOST_MINOR: 90 | |
| BOOST_PATCH: 0 | |
| MYSQL_DOWNLOADS_URL: https://dev.mysql.com/get/Downloads | |
| MYSQL_80_VERSION: 8.0.45 | |
| MYSQL_84_VERSION: 8.4.8 | |
| MYSQL_GLIBC_SUFFIX: linux-glibc2.28-x86_64 | |
| jobs: | |
| formatting-check: | |
| runs-on: ubuntu-24.04 | |
| name: Formatting checks | |
| steps: | |
| - name: Checking out source tree | |
| uses: actions/checkout@v4 | |
| with: | |
| path: src | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Check for new lines at the end of files | |
| # https://medium.com/@alexey.inkin/how-to-force-newline-at-end-of-files-and-why-you-should-do-it-fdf76d1d090e | |
| working-directory: ${{github.workspace}}/src | |
| run: | | |
| find . -path "./.git" -prune -or -type f -not -name "*.zip" -print | wc -l | |
| find . -path "./.git" -prune -or -type f -not -name "*.zip" -print | xargs -L1 bash -c 'test -z "$(tail -c1 "$0")" || (echo "No newline at the end of $0" ; false)' | |
| - name: Check formatting with git diff --check | |
| working-directory: ${{github.workspace}}/src | |
| run: git diff --check --color HEAD~ | |
| - name: Install dependencies on ubuntu | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install clang-format-20 | |
| - name: Info Clang Format | |
| run: clang-format-20 --version | |
| - name: Check formatting with git clang-format-20 | |
| working-directory: ${{github.workspace}}/src | |
| run: git clang-format-20 --diff --binary=clang-format-20 HEAD~ | |
| 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 | |
| name: ${{ matrix.config.name }} | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - { | |
| name: "GCC 14 Debug", | |
| label: "debug_gcc14", | |
| run_mtr: true, | |
| run_valgrind_mtr: true, | |
| run_ctest: true | |
| } | |
| - { | |
| name: "GCC 14 RelWithDebInfo", | |
| label: "release_gcc14", | |
| run_mtr: true, | |
| run_ctest: true | |
| } | |
| - { | |
| name: "GCC 14 ASan", | |
| label: "asan_gcc14", | |
| run_mtr: true, | |
| mtr_options: "--sanitize", | |
| run_ctest: true | |
| } | |
| - { | |
| name: "Clang 20 Debug", | |
| label: "debug_clang20", | |
| run_clang_tidy: true, | |
| run_ctest: true | |
| } | |
| - { | |
| name: "Clang 20 RelWithDebInfo", | |
| label: "release_clang20", | |
| run_clang_tidy: true, | |
| run_ctest: true | |
| } | |
| - { | |
| name: "Clang 20 ASan", | |
| label: "asan_clang20", | |
| run_mtr: true, | |
| mtr_options: "--sanitize", | |
| run_ctest: true | |
| } | |
| steps: | |
| - name: Get number of CPU cores | |
| uses: SimenB/github-actions-cpu-cores@v2 | |
| id: cpu-cores | |
| - name: Info CPU | |
| run: cat /proc/cpuinfo | |
| - name: Info mount | |
| run: mount | |
| - name: Info df | |
| run: df -h | |
| - name: Info GitHub directories | |
| run: | | |
| echo github.workspace: ${{github.workspace}} | |
| echo runner.temp : ${{runner.temp}} | |
| - name: Install MySQL client libraries and CURL Development libraries | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install libmysqlclient-dev libcurl4-openssl-dev | |
| - name: Install Clang dependencies on ubuntu | |
| if: startsWith(matrix.config.name, 'Clang') | |
| run: | | |
| sudo apt-get install clang-20 lld-20 clang-tidy-20 libc++-20-dev libc++abi-20-dev | |
| - name: Install GCC dependencies on ubuntu | |
| if: startsWith(matrix.config.name, 'GCC') | |
| run: | | |
| sudo apt-get install g++-14 | |
| - name: Install Valgrind on ubuntu | |
| if: matrix.config.run_valgrind_mtr | |
| run: | | |
| sudo apt-get install valgrind | |
| - name: Fixing libaio1 for MySQL Server tarball | |
| if: matrix.config.run_mtr || matrix.config.run_valgrind_mtr | |
| run: | | |
| sudo apt-get install libaio-dev | |
| sudo ln -s libaio.so /lib/x86_64-linux-gnu/libaio.so.1 | |
| - name: Info CMake | |
| run: cmake --version | |
| - name: Info Preset | |
| run: echo Current preset ${{matrix.config.label}} | |
| - name: Checking out source tree | |
| uses: actions/checkout@v4 | |
| with: | |
| path: src | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Cache boost libraries | |
| id: cache-boost-static-libraries | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{github.workspace}}/boost-install-${{matrix.config.label}} | |
| key: ${{format('boost-static-libraries-{0}-{1}-{2}-{3}', env.BOOST_MAJOR, env.BOOST_MINOR, env.BOOST_PATCH, matrix.config.label)}} | |
| - name: Checking out Boost source tree | |
| if: steps.cache-boost-static-libraries.outputs.cache-hit != 'true' | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: boostorg/boost | |
| ref: ${{format('boost-{0}.{1}.{2}', env.BOOST_MAJOR, env.BOOST_MINOR, env.BOOST_PATCH)}} | |
| path: boost | |
| submodules: recursive | |
| fetch-tags: true | |
| - name: Copying CMake presets for Boost | |
| if: steps.cache-boost-static-libraries.outputs.cache-hit != 'true' | |
| run: ln -s ${{github.workspace}}/src/extra/cmake_presets/boost/CMakePresets.json ${{github.workspace}}/boost | |
| - name: Configure CMake for Boost | |
| if: steps.cache-boost-static-libraries.outputs.cache-hit != 'true' | |
| run: cmake ${{github.workspace}}/boost --preset ${{matrix.config.label}} | |
| - name: CMake info for Boost | |
| if: steps.cache-boost-static-libraries.outputs.cache-hit != 'true' | |
| run: cmake -L ${{github.workspace}}/boost-build-${{matrix.config.label}} | |
| - name: Build for Boost | |
| if: steps.cache-boost-static-libraries.outputs.cache-hit != 'true' | |
| run: cmake --build ${{github.workspace}}/boost-build-${{matrix.config.label}} --parallel | |
| - name: Install for Boost | |
| if: steps.cache-boost-static-libraries.outputs.cache-hit != 'true' | |
| run: cmake --install ${{github.workspace}}/boost-build-${{matrix.config.label}} | |
| - name: Cache AWS SDK C++ libraries | |
| id: cache-aws-sdk-cpp-libraries | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{github.workspace}}/aws-sdk-cpp-install-${{matrix.config.label}} | |
| key: ${{format('aws-cpp-sdk-libraries-{0}-{1}-{2}-{3}', env.AWS_SDK_CPP_MAJOR, env.AWS_SDK_CPP_MINOR, env.AWS_SDK_CPP_PATCH, matrix.config.label)}} | |
| - name: Checking out AWS SDK C++ source tree | |
| if: steps.cache-aws-sdk-cpp-libraries.outputs.cache-hit != 'true' | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: aws/aws-sdk-cpp | |
| ref: ${{format('{0}.{1}.{2}', env.AWS_SDK_CPP_MAJOR, env.AWS_SDK_CPP_MINOR, env.AWS_SDK_CPP_PATCH)}} | |
| path: aws-sdk-cpp | |
| submodules: recursive | |
| fetch-tags: true | |
| - name: Copying CMake presets for AWS SDK C++ | |
| if: steps.cache-aws-sdk-cpp-libraries.outputs.cache-hit != 'true' | |
| run: ln -s ${{github.workspace}}/src/extra/cmake_presets/aws-sdk-cpp/CMakePresets.json ${{github.workspace}}/aws-sdk-cpp | |
| - name: Configure CMake for AWS SDK C++ | |
| if: steps.cache-aws-sdk-cpp-libraries.outputs.cache-hit != 'true' | |
| run: cmake ${{github.workspace}}/aws-sdk-cpp --preset ${{matrix.config.label}} | |
| - name: CMake info for AWS SDK C++ | |
| if: steps.cache-aws-sdk-cpp-libraries.outputs.cache-hit != 'true' | |
| run: cmake -L ${{github.workspace}}/aws-sdk-cpp-build-${{matrix.config.label}} | |
| - name: Build for AWS SDK C++ | |
| if: steps.cache-aws-sdk-cpp-libraries.outputs.cache-hit != 'true' | |
| run: cmake --build ${{github.workspace}}/aws-sdk-cpp-build-${{matrix.config.label}} --parallel | |
| - name: Install for AWS SDK C++ | |
| if: steps.cache-aws-sdk-cpp-libraries.outputs.cache-hit != 'true' | |
| run: cmake --install ${{github.workspace}}/aws-sdk-cpp-build-${{matrix.config.label}} | |
| - name: Configure CMake | |
| run: cmake ${{github.workspace}}/src --preset ${{matrix.config.label}} | |
| - name: CMake info | |
| run: cmake -L ${{github.workspace}}/src-build-${{matrix.config.label}} | |
| - name: Build | |
| # Build your program with the given configuration | |
| run: cmake --build ${{github.workspace}}/src-build-${{matrix.config.label}} --parallel | |
| - name: Info Clang Tidy | |
| if: matrix.config.run_clang_tidy | |
| run: clang-tidy-20 --version | |
| - name: Clang Tidy | |
| if: matrix.config.run_clang_tidy | |
| # Run Clang Tidy | |
| run: run-clang-tidy-20 -header-filter=.* -j=${{steps.cpu-cores.outputs.count}} -use-color -p=${{github.workspace}}/src-build-${{matrix.config.label}} | |
| - name: Application version | |
| working-directory: ${{github.workspace}}/src-build-${{matrix.config.label}} | |
| run: ./binlog_server version | |
| - name: Creating DIST directory for MySQL Server tarballs | |
| if: matrix.config.run_mtr || matrix.config.run_valgrind_mtr | |
| run: mkdir -p ${{github.workspace}}/dist | |
| - name: Unpacking MySQL Server 8.0 tarballs | |
| if: matrix.config.run_mtr || matrix.config.run_valgrind_mtr | |
| working-directory: ${{github.workspace}}/dist | |
| run: | | |
| # https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.45-linux-glibc2.28-x86_64.tar.xz | |
| DIST_BASE_NAME=${{format('mysql-{0}-{1}', env.MYSQL_80_VERSION, env.MYSQL_GLIBC_SUFFIX)}} | |
| DIST_TARBALL_FILE_NAME=${DIST_BASE_NAME}.tar.xz | |
| wget -q ${{env.MYSQL_DOWNLOADS_URL}}/MySQL-8.0/${DIST_TARBALL_FILE_NAME} | |
| tar xf ${DIST_TARBALL_FILE_NAME} | |
| rm -f ${DIST_TARBALL_FILE_NAME} | |
| # https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-test-8.0.45-linux-glibc2.28-x86_64.tar.xz | |
| TEST_TARBALL_FILE_NAME=${{format('mysql-test-{0}-{1}.tar.xz', env.MYSQL_80_VERSION, env.MYSQL_GLIBC_SUFFIX)}} | |
| wget -q ${{env.MYSQL_DOWNLOADS_URL}}/MySQL-8.0/${TEST_TARBALL_FILE_NAME} | |
| tar xf ${TEST_TARBALL_FILE_NAME} | |
| rm -f ${TEST_TARBALL_FILE_NAME} | |
| # Linking the "binlog_streaming" from the source tree into the MTR suits directory | |
| sudo ln -s ${{github.workspace}}/src/mtr/binlog_streaming ${{github.workspace}}/dist/${DIST_BASE_NAME}/mysql-test/suite/binlog_streaming | |
| ./${DIST_BASE_NAME}/bin/mysqld --version | |
| - name: Unpacking MySQL Server 8.4 tarballs | |
| if: matrix.config.run_mtr || matrix.config.run_valgrind_mtr | |
| working-directory: ${{github.workspace}}/dist | |
| run: | | |
| # https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-8.4.8-linux-glibc2.28-x86_64-minimal.tar.xz | |
| DIST_BASE_NAME=${{format('mysql-{0}-{1}-minimal', env.MYSQL_84_VERSION, env.MYSQL_GLIBC_SUFFIX)}} | |
| DIST_TARBALL_FILE_NAME=${DIST_BASE_NAME}.tar.xz | |
| wget -q ${{env.MYSQL_DOWNLOADS_URL}}/MySQL-8.4/${DIST_TARBALL_FILE_NAME} | |
| tar xf ${DIST_TARBALL_FILE_NAME} | |
| rm -f ${DIST_TARBALL_FILE_NAME} | |
| # https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-test-8.4.8-linux-glibc2.28-x86_64-minimal.tar.xz | |
| TEST_TARBALL_FILE_NAME=${{format('mysql-test-{0}-{1}-minimal.tar.xz', env.MYSQL_84_VERSION, env.MYSQL_GLIBC_SUFFIX)}} | |
| wget -q ${{env.MYSQL_DOWNLOADS_URL}}/MySQL-8.4/${TEST_TARBALL_FILE_NAME} | |
| tar xf ${TEST_TARBALL_FILE_NAME} | |
| rm -f ${TEST_TARBALL_FILE_NAME} | |
| # Linking the "binlog_streaming" from the source tree into the MTR suits directory | |
| sudo ln -s ${{github.workspace}}/src/mtr/binlog_streaming ${{github.workspace}}/dist/${DIST_BASE_NAME}/mysql-test/suite/binlog_streaming | |
| ./${DIST_BASE_NAME}/bin/mysqld --version | |
| - name: MTR 8.0 tests | |
| if: matrix.config.run_mtr | |
| working-directory: ${{github.workspace}}/dist/${{format('mysql-{0}-{1}', env.MYSQL_80_VERSION, env.MYSQL_GLIBC_SUFFIX)}}/mysql-test | |
| run: | | |
| BINSRV=${{github.workspace}}/src-build-${{matrix.config.label}}/binlog_server ./mtr \ | |
| --vardir=${{runner.temp}}/mtrvardir80 \ | |
| --force --max-test-fail=0 --retry=0 --nounit-tests --big-test --repeat=2 --parallel=${{steps.cpu-cores.outputs.count}} \ | |
| --suite=binlog_streaming ${{matrix.config.mtr_options}} | |
| - name: MTR 8.0 tests (Valgrind) | |
| if: matrix.config.run_valgrind_mtr | |
| working-directory: ${{github.workspace}}/dist/${{format('mysql-{0}-{1}', env.MYSQL_80_VERSION, env.MYSQL_GLIBC_SUFFIX)}}/mysql-test | |
| run: | | |
| BINSRV=${{github.workspace}}/src-build-${{matrix.config.label}}/binlog_server ./mtr \ | |
| --vardir=${{runner.temp}}/mtrvardir80 \ | |
| --force --max-test-fail=0 --retry=0 --nounit-tests --big-test --parallel=${{steps.cpu-cores.outputs.count}} \ | |
| --suite=binlog_streaming --valgrind | |
| - name: MTR 8.4 tests | |
| if: matrix.config.run_mtr | |
| working-directory: ${{github.workspace}}/dist/${{format('mysql-{0}-{1}-minimal', env.MYSQL_84_VERSION, env.MYSQL_GLIBC_SUFFIX)}}/mysql-test | |
| run: | | |
| BINSRV=${{github.workspace}}/src-build-${{matrix.config.label}}/binlog_server ./mtr \ | |
| --vardir=${{runner.temp}}/mtrvardir84 \ | |
| --force --max-test-fail=0 --retry=0 --nounit-tests --big-test --repeat=2 --parallel=${{steps.cpu-cores.outputs.count}} \ | |
| --suite=binlog_streaming ${{matrix.config.mtr_options}} | |
| - name: MTR 8.4 tests (Valgrind) | |
| if: matrix.config.run_valgrind_mtr | |
| working-directory: ${{github.workspace}}/dist/${{format('mysql-{0}-{1}-minimal', env.MYSQL_84_VERSION, env.MYSQL_GLIBC_SUFFIX)}}/mysql-test | |
| run: | | |
| BINSRV=${{github.workspace}}/src-build-${{matrix.config.label}}/binlog_server ./mtr \ | |
| --vardir=${{runner.temp}}/mtrvardir84 \ | |
| --force --max-test-fail=0 --retry=0 --nounit-tests --big-test --parallel=${{steps.cpu-cores.outputs.count}} \ | |
| --suite=binlog_streaming --valgrind | |
| - name: CTest | |
| if: matrix.config.run_ctest | |
| working-directory: ${{github.workspace}}/src-build-${{matrix.config.label}} | |
| # Execute tests defined by the CMake configuration. | |
| # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
| run: ctest --parallel | |
| - name: Info Build artifacts | |
| run: | | |
| ls -la ${{github.workspace}} | |
| ls -la ${{runner.temp}} |