diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 00000000..c155094e --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,52 @@ +name: CMake + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + +jobs: + build: + strategy: + matrix: + os: [macos-latest, windows-latest, ubuntu-latest] + redis: [4, 5, 6] + include: + - os: macos-latest + gcc: 4.8 + runs-on: ${{ matrix.os }} + + + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - if: ${{ matrix.gcc }} + run: export CXX="g++-${{ matrix.gcc }}" CC="gcc-${{ matrix.gcc }}" + + - 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: cmake -B ${{github.workspace}}/build -DBUILD_TESTS=true -DBUILD_EXAMPLES=true -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Start Redis + uses: supercharge/redis-github-action@1.4.0 + with: + redis-version: ${{ matrix.redis }} + + - name: Test + working-directory: ${{github.workspace}}/build + # Execute tests defined by the CMake configuration. + run: GTEST_COLOR=1 ctest -VV -C ${{env.BUILD_TYPE}} +