|
| 1 | +name: Build and Test ldsCtrlEst |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 15 | + |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v3 |
| 21 | + with: |
| 22 | + submodules: recursive |
| 23 | + |
| 24 | + - name: Set up dependencies for macOS and Linux |
| 25 | + if: runner.os != 'Windows' |
| 26 | + run: | |
| 27 | + if [ "${{ runner.os }}" == "macOS" ]; then |
| 28 | + brew install cmake ninja |
| 29 | + elif [ "${{ runner.os }}" == "Linux" ]; then |
| 30 | + sudo apt-get update |
| 31 | + sudo apt-get install -y cmake build-essential |
| 32 | + fi |
| 33 | +
|
| 34 | + - name: Set up dependencies for Windows |
| 35 | + if: runner.os == 'Windows' |
| 36 | + run: | |
| 37 | + choco install cmake |
| 38 | + |
| 39 | + - name: Run vcpkg |
| 40 | + uses: lukka/run-vcpkg@v11 |
| 41 | + with: |
| 42 | + vcpkgJsonGlob: 'vcpkg.json' |
| 43 | + runVcpkgInstall: true |
| 44 | + |
| 45 | + - name: Cache build directory |
| 46 | + uses: actions/cache@v3 |
| 47 | + with: |
| 48 | + path: build |
| 49 | + key: build-${{ matrix.os }}-${{ hashFiles('CMakeLists.txt') }} |
| 50 | + restore-keys: | |
| 51 | + build-${{ matrix.os }}- |
| 52 | + |
| 53 | + - name: Configure and build for macOS/Linux |
| 54 | + if: runner.os != 'Windows' |
| 55 | + uses: lukka/run-cmake@v10 |
| 56 | + with: |
| 57 | + cmakeListsTxtPath: CMakeLists.txt |
| 58 | + configurePreset: 'linux-release' |
| 59 | + buildPreset: 'linux-release' |
| 60 | + |
| 61 | + - name: Configure and build for Windows |
| 62 | + if: runner.os == 'Windows' |
| 63 | + uses: lukka/run-cmake@v10 |
| 64 | + with: |
| 65 | + cmakeListsTxtPath: CMakeLists.txt |
| 66 | + configurePreset: 'windows-release' |
| 67 | + buildPreset: 'windows-release' |
| 68 | + |
| 69 | + - name: Install and Update PATH (Windows only) |
| 70 | + if: runner.os == 'Windows' |
| 71 | + run: | |
| 72 | + cd build |
| 73 | + cmake --install . |
| 74 | + echo "${{github.workspace}}/install/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| 75 | +
|
| 76 | + - name: Run tests |
| 77 | + run: | |
| 78 | + cd build |
| 79 | + ctest -C Release |
0 commit comments