Skip to content

Commit

Permalink
CI: proof of concept
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani committed Jul 13, 2021
1 parent f4184a3 commit 4339146
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/hardware-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Linux hardware test

on: [push, pull_request]

jobs:
build:

runs-on: self-hosted

steps:
- uses: actions/checkout@master
- name: Install necessary tools
run: |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt -y update
sudo apt -y install i2c-tools
pip3 install smbus
- name: Build it
run: |
python3 test.py
21 changes: 21 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from kellerLD import KellerLD
import time

sensor = KellerLD(4)

if not sensor.init():
print("Failed to initialize Keller LD sensor!")
exit(1)

print("Testing Keller LD series pressure sensor")

for i in range(10):
try:
sensor.read()
print("pressure: %7.4f bar\ttemperature: %0.2f C" % (sensor.pressure(), sensor.temperature()))
# we shouldn't get anything out of these values in the test hardware
assert 5 < sensor.temperature() < 50
assert -1 < sensor.pressure() < 1
time.sleep(0.2)
except Exception as e:
print(e)

0 comments on commit 4339146

Please sign in to comment.