Skip to content

Commit 56dc049

Browse files
CI: proof of concept
1 parent f4184a3 commit 56dc049

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Linux hardware test
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: self-hosted
9+
10+
steps:
11+
- uses: actions/checkout@master
12+
- name: Install necessary tools
13+
run: |
14+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
15+
sudo apt -y update
16+
sudo apt -y install i2c-tools python-smbus
17+
- name: Build it
18+
run: |
19+
python3 test.py

test.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from kellerLD import KellerLD
2+
import time
3+
4+
sensor = KellerLD(4)
5+
6+
if not sensor.init():
7+
print("Failed to initialize Keller LD sensor!")
8+
exit(1)
9+
10+
print("Testing Keller LD series pressure sensor")
11+
12+
for i in range(10):
13+
try:
14+
sensor.read()
15+
print("pressure: %7.4f bar\ttemperature: %0.2f C" % (sensor.pressure(), sensor.temperature()))
16+
# we shouldn't get anything out of these values in the test hardware
17+
assert 5 < sensor.temperature() < 50
18+
assert -1 < sensor.pressure() < 1
19+
time.sleep(0.2)
20+
except Exception as e:
21+
print(e)

0 commit comments

Comments
 (0)