-
Notifications
You must be signed in to change notification settings - Fork 0
194 lines (150 loc) · 5.24 KB
/
ci.yml
File metadata and controls
194 lines (150 loc) · 5.24 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: CI
on:
push:
branches: [ main, master, develop, add-sensor-plot, add-rdata-output ]
pull_request:
branches: [ main, master, develop ]
jobs:
test-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Add WildlifeSystems apt repository
run: |
sudo wget -O /usr/share/keyrings/ws.gpg https://wildlife.systems/ws.gpg
echo -e "Types: deb\nURIs: https://apt.wildlife.systems\nSuites: stable\nComponents: main\nArchitectures: all amd64\nSigned-By: /usr/share/keyrings/ws.gpg" | sudo tee /etc/apt/sources.list.d/ws.sources > /dev/null
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential g++ libncurses-dev zlib1g-dev sensor-control
- name: Build with coverage
run: make clean all COVERAGE=1
- name: Run unit tests
run: make test COVERAGE=1
- name: Run integration tests
run: make test-integration
- name: Generate coverage report
run: make coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: true
test-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: brew install lcov coreutils ncurses
- name: Build with coverage
run: make clean all COVERAGE=1
- name: Run unit tests
run: make test COVERAGE=1
- name: Run integration tests
run: make test-integration
- name: Generate coverage report
run: make coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: true
test-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: mingw-w64-x86_64-gcc make mingw-w64-x86_64-lcov mingw-w64-x86_64-pdcurses mingw-w64-x86_64-zlib
- name: Build with coverage
shell: msys2 {0}
run: make clean all COVERAGE=1
- name: Run unit tests
shell: msys2 {0}
run: make test COVERAGE=1
- name: Run integration tests
shell: msys2 {0}
run: make test-integration
- name: Generate coverage report
shell: msys2 {0}
run: make coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: true
test-rdata:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential g++ libncurses-dev zlib1g-dev r-base
- name: Build sensor-data binary
run: make clean sensor-data COVERAGE=1
- name: Test RData output
run: |
# Create test JSON input
echo '{"sensor_id":"temp1","unit":"C","value":23.5}' > /tmp/test_input.json
# Transform to RData
./sensor-data transform -of rdata -o /tmp/test_output.RData /tmp/test_input.json
# Validate with R - load and verify structure
Rscript -e "
load('/tmp/test_output.RData')
stopifnot(exists('sensor_data'))
stopifnot(is.data.frame(sensor_data))
stopifnot(nrow(sensor_data) == 1)
print(sensor_data)
cat('RData validation passed!\n')
"
- name: Test RDS output
run: |
# Create test JSON input
echo '{"sensor":"ds18b20","sensor_id":"28-123","value":21.5}' > /tmp/test_rds.json
# Transform to RDS
./sensor-data transform -of rds -o /tmp/test_output.rds /tmp/test_rds.json
# Validate with R - load and verify structure
Rscript -e "
sensor_data <- readRDS('/tmp/test_output.rds')
stopifnot(is.data.frame(sensor_data))
stopifnot(nrow(sensor_data) == 1)
print(sensor_data)
cat('RDS validation passed!\n')
"
- name: Generate coverage report
run: make coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: true
build-deb:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential debhelper devscripts fakeroot lintian libncurses-dev
- name: Build Debian package
run: |
dpkg-buildpackage -us -uc -b
mkdir -p debian-output
cp ../sensor-tools_*.deb debian-output/
- name: Run lintian checks
run: |
lintian --info --display-info debian-output/*.deb || true
- name: Upload .deb artifact
uses: actions/upload-artifact@v4
with:
name: debian-package
path: debian-output/*.deb
retention-days: 14