forked from thin-edge/modbus-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
63 lines (48 loc) · 1.97 KB
/
justfile
File metadata and controls
63 lines (48 loc) · 1.97 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
set dotenv-load := true
# Start the demo
up *args="":
docker compose up --build {{args}}
# Stop the demo
down *args="":
docker compose down {{args}}
# Stop the demo and destroy the data
down-all:
docker compose down -v
# Install python virtual environment
venv:
[ -d .venv ] || python3 -m venv .venv
./.venv/bin/pip3 install -r tests/requirements.txt -r requirements.txt -r requirements.dev.txt
# Format python code
format:
.venv/bin/python3 -m black .
# Run python linter
lint:
.venv/bin/python3 -m pylint operations
.venv/bin/python3 -m pylint tedge_modbus
# Build linux packages
build:
mkdir -p dist/
nfpm package --packager deb --target dist/
nfpm package --packager rpm --target dist/
# Build deb package
setup:
@mkdir -p ./tests/data
docker run --rm -v $PWD:/tmp -w /tmp goreleaser/nfpm package \
--config /tmp/nfpm.yaml \
--target /tmp/tests/data/tedge-modbus-plugin.deb \
--packager deb
# Run tests
test *args='':
./.venv/bin/python3 -m robot.run --outputdir output {{args}} tests
# Configure and register the device to the cloud
bootstrap *args="":
docker compose exec --env "DEVICE_ID=${DEVICE_ID:-}" --env "C8Y_BASEURL=${C8Y_BASEURL:-}" --env "C8Y_USER=${C8Y_USER:-}" --env "C8Y_PASSWORD=${C8Y_PASSWORD:-}" tedge bootstrap.sh {{args}}
# Start a shell
shell *args='bash':
docker compose exec tedge {{args}}
# Clean up
cleanup DEVICE_ID $CI="true":
echo "Removing device and child devices (including certificates)"
c8y devicemanagement certificates list -n --tenant "$(c8y currenttenant get --select name --output csv)" --filter "name eq ${DEVICE_ID}" --pageSize 2000 | c8y devicemanagement certificates delete --tenant "$(c8y currenttenant get --select name --output csv)"
c8y inventory find -n --owner "device_${DEVICE_ID}" -p 100 | c8y inventory delete
c8y users delete -n --id "device_${DEVICE_ID}$" --tenant "$(c8y currenttenant get --select name --output csv)" --silentStatusCodes 404 --silentExit