-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (121 loc) · 5.1 KB
/
ci.yml
File metadata and controls
144 lines (121 loc) · 5.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Build and Test
on:
workflow_dispatch:
inputs:
opendaq_ref:
description: "openDAQ SDK commit, branch or tag"
required: false
default: ""
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
generator: Ninja
build_type: Debug
- os: windows-latest
generator: "Visual Studio 17 2022"
build_type: Debug
- os: ubuntu-latest
generator: Ninja
build_type: Release
- os: windows-latest
generator: "Visual Studio 17 2022"
build_type: Release
runs-on: ${{ matrix.os }}
steps:
- name: Install additional dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install -y --no-install-recommends mono-runtime libmono-system-json-microsoft4.0-cil libmono-system-data4.0-cil
- name: Checkout project repo
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.event.client_payload.branch || github.ref }}
- name: Overwrite opendaq_ref
if: ${{ github.event.inputs.opendaq_ref != '' }}
run: echo "${{ github.event.inputs.opendaq_ref }}" > opendaq_ref
- name: Configure project with CMake
run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DDAQMODULES_MQTT_ENABLE_TESTS=ON -DDAQMODULES_MQTT_DEBUG_WARNINGS_AS_ERRORS=ON -DOPENDAQ_DEBUG_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}"
- name: Build project with CMake
run: cmake --build build/output --config "${{ matrix.build_type }}"
- name: Install and run mosquitto Linux
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install -y --no-install-recommends mosquitto
- name: Run project tests with CMake
if: matrix.os == 'ubuntu-latest'
run: ctest --test-dir build/output --output-on-failure -C "${{ matrix.build_type }}"
install-build-and-test:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
generator: Ninja
build_type: Debug
- os: windows-latest
generator: "Visual Studio 17 2022"
build_type: Debug
- os: ubuntu-latest
generator: Ninja
build_type: Release
- os: windows-latest
generator: "Visual Studio 17 2022"
build_type: Release
runs-on: ${{ matrix.os }}
env:
INSTALL_PREFIX: ${{ github.workspace }}/opendaq_install
steps:
- name: Install additional dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install -y --no-install-recommends mono-runtime libmono-system-json-microsoft4.0-cil libmono-system-data4.0-cil
- name: Checkout module
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.event.client_payload.branch || github.ref }}
path: module
- name: Overwrite opendaq_ref
if: ${{ github.event.inputs.opendaq_ref != '' }}
working-directory: module
run: echo "${{ github.event.inputs.opendaq_ref }}" > opendaq_ref
- name: Read openDAQ version
shell: bash
working-directory: module
run: |
opendaq_ref=$(cat opendaq_ref)
echo "OPENDAQ_REF=$opendaq_ref" >> $GITHUB_ENV
- name: Checkout openDAQ
uses: actions/checkout@v4
with:
repository: openDAQ/openDAQ
ref: ${{ env.OPENDAQ_REF }}
path: opendaq
- name: Configure, build and install openDAQ
working-directory: opendaq
run: |
cmake -B build/output -S . -G "${{ matrix.generator }}" -DOPENDAQ_ENABLE_TESTS=OFF -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" -DCMAKE_INSTALL_PREFIX="${{ env.INSTALL_PREFIX }}"
cmake --build build/output --config "${{ matrix.build_type }}"
cmake --install build/output --config "${{ matrix.build_type }}"
- name: Add DLL path (Windows only)
if: matrix.os == 'windows-latest'
run: echo "${{ env.INSTALL_PREFIX }}/lib" >> $env:GITHUB_PATH
- name: Configure project with CMake
working-directory: module
run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DDAQMODULES_MQTT_ENABLE_TESTS=ON -DDAQMODULES_MQTT_DEBUG_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" -DopenDAQ_DIR="${{ env.INSTALL_PREFIX }}/lib/cmake/opendaq/"
- name: Build project with CMake
working-directory: module
run: cmake --build build/output --config "${{ matrix.build_type }}"
- name: Install and run mosquitto Linux
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install -y --no-install-recommends mosquitto
- name: Run project tests with CMake
if: matrix.os == 'ubuntu-latest'
working-directory: module
run: ctest --test-dir build/output --output-on-failure -C "${{ matrix.build_type }}"