|
| 1 | +name: Build and Test |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, reopened, synchronize, ready_for_review] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build-and-test: |
| 9 | + strategy: |
| 10 | + fail-fast: false |
| 11 | + matrix: |
| 12 | + include: |
| 13 | + - os: ubuntu-latest |
| 14 | + generator: Ninja |
| 15 | + - os: windows-latest |
| 16 | + generator: "Visual Studio 17 2022" |
| 17 | + |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Install additional dependencies |
| 22 | + if: matrix.os == 'ubuntu-latest' |
| 23 | + run: | |
| 24 | + sudo apt-get install -y --no-install-recommends mono-runtime libmono-system-json-microsoft4.0-cil libmono-system-data4.0-cil |
| 25 | +
|
| 26 | + - name: Checkout project repo |
| 27 | + uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + ref: ${{ github.event.inputs.branch || github.event.client_payload.branch || github.ref }} |
| 30 | + |
| 31 | + - name: Configure project with CMake |
| 32 | + run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DDAQMODULES_LT_STREAMING_ENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Release |
| 33 | + |
| 34 | + - name: Build project with CMake |
| 35 | + run: cmake --build build/output --config Release |
| 36 | + |
| 37 | + - name: Run project tests with CMake |
| 38 | + run: ctest --test-dir build/output --output-on-failure -C Release |
| 39 | + |
| 40 | + install-build-and-test: |
| 41 | + strategy: |
| 42 | + fail-fast: false |
| 43 | + matrix: |
| 44 | + include: |
| 45 | + - os: ubuntu-latest |
| 46 | + generator: Ninja |
| 47 | + - os: windows-latest |
| 48 | + generator: "Visual Studio 17 2022" |
| 49 | + |
| 50 | + runs-on: ${{ matrix.os }} |
| 51 | + env: |
| 52 | + INSTALL_PREFIX: ${{ github.workspace }}/opendaq_install |
| 53 | + |
| 54 | + steps: |
| 55 | + - name: Install additional dependencies |
| 56 | + if: matrix.os == 'ubuntu-latest' |
| 57 | + run: | |
| 58 | + sudo apt-get install -y --no-install-recommends mono-runtime libmono-system-json-microsoft4.0-cil libmono-system-data4.0-cil |
| 59 | +
|
| 60 | + - name: Checkout module |
| 61 | + uses: actions/checkout@v4 |
| 62 | + with: |
| 63 | + ref: ${{ github.event.inputs.branch || github.event.client_payload.branch || github.ref }} |
| 64 | + path: module |
| 65 | + |
| 66 | + - name: Read openDAQ version |
| 67 | + shell: bash |
| 68 | + working-directory: module |
| 69 | + run: | |
| 70 | + opendaq_ref=$(cat opendaq_ref) |
| 71 | + echo "OPENDAQ_REF=$opendaq_ref" >> $GITHUB_ENV |
| 72 | +
|
| 73 | + - name: Checkout openDAQ |
| 74 | + uses: actions/checkout@v4 |
| 75 | + with: |
| 76 | + repository: openDAQ/openDAQ |
| 77 | + ref: ${{ env.OPENDAQ_REF }} |
| 78 | + path: opendaq |
| 79 | + |
| 80 | + - name: Configure, build and install openDAQ |
| 81 | + working-directory: opendaq |
| 82 | + run: | |
| 83 | + cmake -B build/output -S . -G "${{ matrix.generator }}" -DOPENDAQ_ENABLE_TESTS=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="${{ env.INSTALL_PREFIX }}" |
| 84 | + cmake --build build/output --config Debug |
| 85 | + cmake --install build/output --config Debug |
| 86 | +
|
| 87 | + - name: Add DLL path (Windows only) |
| 88 | + if: matrix.os == 'windows-latest' |
| 89 | + run: echo "${{ env.INSTALL_PREFIX }}/lib" >> $env:GITHUB_PATH |
| 90 | + |
| 91 | + - name: Configure project with CMake |
| 92 | + working-directory: module |
| 93 | + run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DDAQMODULES_LT_STREAMING_ENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DopenDAQ_DIR="${{ env.INSTALL_PREFIX }}/lib/cmake/opendaq/" |
| 94 | + |
| 95 | + - name: Build project with CMake |
| 96 | + working-directory: module |
| 97 | + run: cmake --build build/output --config Debug |
| 98 | + |
| 99 | + - name: Run project tests with CMake |
| 100 | + working-directory: module |
| 101 | + run: ctest --test-dir build/output --output-on-failure -C Debug |
0 commit comments