|
| 1 | +# This workflow uses actions that are not certified by GitHub. |
| 2 | +# They are provided by a third-party and are governed by |
| 3 | +# separate terms of service, privacy policy, and support |
| 4 | +# documentation. |
| 5 | + |
| 6 | +name: "Build server (CMake)" |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + branches: |
| 11 | + - master |
| 12 | + |
| 13 | + paths: |
| 14 | + - '.github/workflows/tests_cmake.yml' |
| 15 | + |
| 16 | + pull_request: |
| 17 | + branches: |
| 18 | + - master |
| 19 | + |
| 20 | + paths: |
| 21 | + - '.github/workflows/tests_cmake.yml' |
| 22 | + |
| 23 | + workflow_dispatch: |
| 24 | + |
| 25 | +jobs: |
| 26 | + build_windows: |
| 27 | + runs-on: windows-latest |
| 28 | + |
| 29 | + strategy: |
| 30 | + matrix: |
| 31 | + BUILD_CONFIGURATION: [Debug, Release] |
| 32 | + BUILD_PLATFORM: [Win32, x64] |
| 33 | + |
| 34 | + name: "Server: ${{ matrix.BUILD_CONFIGURATION }} - ${{ matrix.BUILD_PLATFORM }} (Windows)" |
| 35 | + |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v4 |
| 38 | + with: |
| 39 | + submodules: 'false' |
| 40 | + |
| 41 | + - uses: lukka/get-cmake@latest |
| 42 | + |
| 43 | + - name: Configure CMake |
| 44 | + shell: bash |
| 45 | + run: | |
| 46 | + cmake -S . \ |
| 47 | + -B build-windows-${{ matrix.BUILD_CONFIGURATION }}-${{ matrix.BUILD_PLATFORM }} \ |
| 48 | + -G "Visual Studio 17 2022" \ |
| 49 | + -A ${{ matrix.BUILD_PLATFORM }} \ |
| 50 | + -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_CONFIGURATION }} |
| 51 | +
|
| 52 | + - name: Build server |
| 53 | + shell: bash |
| 54 | + run: | |
| 55 | + cmake \ |
| 56 | + --build build-windows-${{ matrix.BUILD_CONFIGURATION }}-${{ matrix.BUILD_PLATFORM }} \ |
| 57 | + --config ${{ matrix.BUILD_CONFIGURATION }} |
| 58 | +
|
| 59 | + - name: Run tests |
| 60 | + shell: bash |
| 61 | + working-directory: build-windows-${{ matrix.BUILD_CONFIGURATION }}-${{ matrix.BUILD_PLATFORM }} |
| 62 | + run: | |
| 63 | + ctest |
| 64 | +
|
| 65 | + build_linux: |
| 66 | + runs-on: ubuntu-latest |
| 67 | + |
| 68 | + strategy: |
| 69 | + matrix: |
| 70 | + BUILD_CONFIGURATION: [Debug, Release] |
| 71 | + COMPILER: [gcc, clang, clang-20] |
| 72 | + |
| 73 | + env: |
| 74 | + clang-latest-version: 20 |
| 75 | + |
| 76 | + name: "Server: ${{ matrix.BUILD_CONFIGURATION }} - ${{ matrix.COMPILER }} (Linux)" |
| 77 | + |
| 78 | + steps: |
| 79 | + - uses: actions/checkout@v4 |
| 80 | + with: |
| 81 | + submodules: 'false' |
| 82 | + |
| 83 | + - name: Install unixODBC |
| 84 | + run: sudo apt-get install unixodbc-dev -y |
| 85 | + |
| 86 | + - uses: lukka/get-cmake@latest |
| 87 | + |
| 88 | + - name: Setup compiler |
| 89 | + run: | |
| 90 | + if [ "${{ matrix.COMPILER }}" = "gcc" ]; then |
| 91 | + export CC=gcc |
| 92 | + export CXX=g++ |
| 93 | + elif [ "${{ matrix.COMPILER }}" = "clang" ]; then |
| 94 | + export CC=clang |
| 95 | + export CXX=clang++ |
| 96 | + else |
| 97 | + wget https://apt.llvm.org/llvm.sh |
| 98 | + chmod +x llvm.sh |
| 99 | + sudo ./llvm.sh ${{ env.clang-latest-version }} |
| 100 | + sudo apt-get update |
| 101 | + export CC=clang-${{ env.clang-latest-version }} |
| 102 | + export CXX=clang++-${{ env.clang-latest-version }} |
| 103 | + fi |
| 104 | + echo "CC=$CC" >> $GITHUB_ENV |
| 105 | + echo "CXX=$CXX" >> $GITHUB_ENV |
| 106 | +
|
| 107 | + - name: Configure CMake |
| 108 | + run: | |
| 109 | + cmake -S . \ |
| 110 | + -B build-${{ matrix.COMPILER }}-${{ matrix.BUILD_CONFIGURATION }} \ |
| 111 | + -G "Ninja" \ |
| 112 | + -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_CONFIGURATION }} |
| 113 | +
|
| 114 | + - name: Build server |
| 115 | + run: | |
| 116 | + cmake \ |
| 117 | + --build build-${{ matrix.COMPILER }}-${{ matrix.BUILD_CONFIGURATION }} \ |
| 118 | + --config ${{ matrix.BUILD_CONFIGURATION }} |
| 119 | +
|
| 120 | + - name: Run tests |
| 121 | + shell: bash |
| 122 | + working-directory: build-${{ matrix.COMPILER }}-${{ matrix.BUILD_CONFIGURATION }} |
| 123 | + run: | |
| 124 | + ctest |
0 commit comments