-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
179 lines (150 loc) · 3.84 KB
/
Copy pathjustfile
File metadata and controls
179 lines (150 loc) · 3.84 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
# -- Settings ------------------------------------------------------------------
# Use latest version of PowerShell on Windows
set windows-shell := ["pwsh.exe", "-NoLogo", "-Command"]
# Load `.env` file data for environment variables
set dotenv-load := true
# -- Variables -----------------------------------------------------------------
package := "icoapi"
location := "localhost:33215/api/v1"
http_url := "http://" + location
ws_url := "ws://" + location
mac_address := env("TEST_SENSOR_NODE_EUI", "08-6B-D7-01-DE-81")
name := "Test-STH"
measurement_name := "Test Measurement"
sphinx_directory := "sphinx"
sphinx_input_directory := "doc/sphinx"
# -- Recipes -------------------------------------------------------------------
# Setup Python environment
[group('setup')]
setup:
uv venv --allow-existing
uv sync --all-extras
# Check code with various linters
[group('lint')]
check: setup
uv run mypy .
uv run flake8 .
uv run pylint .
# Run tests
[group('test')]
[default]
test *options: check
uv run pytest {{options}} --reruns 5 --reruns-delay 1
# Run hardware-independent tests
[group('test')]
test-no-hardware: (test "-m 'not hardware'")
# Run API server
[group('run')]
run:
uv run python "{{package}}/api.py"
# Release new package version
[group('release')]
[unix]
release version:
#!/usr/bin/env sh -e
uv version {{version}}
version="$(uv version --short)"
git commit -a -m "Release: Release version ${version}"
git tag "${version}"
git push
git push --tags
# Release new package version
[group('release')]
[windows]
release version:
#!pwsh
uv version {{version}}
set version "$(uv version --short)"
git commit -a -m "Release: Release version ${version}"
git tag "${version}"
git push
git push --tags
# ========
# = HTTP =
# ========
# Reset STU
[group('http')]
reset:
http PUT "{{http_url}}/stu/reset"
# Connect to sensor node
[group('http')]
connect:
http PUT "{{http_url}}/sth/connect" "mac_address={{mac_address}}"
# List sensor nodes
[group('http')]
list:
http GET "{{http_url}}/sth"
# Disconnect from sensor node
[group('http')]
disconnect:
http PUT "{{http_url}}/sth/disconnect"
# Rename sensor node
[group('http')]
rename:
http PUT "{{http_url}}/sth/rename" "mac_address={{mac_address}}" \
"new_name={{name}}"
# Get sensor configuration
[group('http')]
sensor:
http GET "{{http_url}}/sensor"
# Start measurement
[group('http')]
start-measurement: connect
http POST "{{http_url}}/measurement/start" \
"name={{measurement_name}}" \
"mac_address={{mac_address}}" \
time=100 \
first[channel_number]:=1 \
first[sensor_id]=acc100g_01 \
second[channel_number]:=0 \
second[sensor_id]="" \
third[channel_number]:=0 \
third[sensor_id]="" \
ift_requested:=true \
ift_channel="first" \
ift_window_width:=50 \
adc[prescaler]:=2 \
adc[acquisition_time]:=8 \
adc[oversampling_rate]:=64 \
adc[reference_voltage]:=3.3 \
meta[version]="" \
meta[profile]="" \
meta[parameters]:={}
# Add post-meta measurement data
[group('http')]
set-post-measurement-data:
http POST "{{http_url}}/measurement/post_meta" \
version="1.0" \
profile="default" \
parameters[test_post_metadata]="something"
# Check measurement status
[group('http')]
status:
http GET "{{http_url}}/measurement"
# Connect to measurement socket
[group('http')]
stream:
http "{{ws_url}}/measurement/stream"
# Stop current measurement
[group('http')]
stop-measurement:
http POST "{{http_url}}/measurement/stop"
# =================
# = Documentation =
# =================
# Generate documentation
[group('documentation')]
documentation: setup
uv run sphinx-build -M html {{sphinx_input_directory}} {{sphinx_directory}}
# Remove documentation
[group('documentation')]
[windows]
clean:
#!pwsh
Remove-Item -Recurse {{sphinx_directory}}
# Remove documentation
[group('documentation')]
[unix]
clean:
#!/usr/bin/env sh -e
rm -rf {{sphinx_directory}}