Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: proof of concept #7

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/hardware-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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 python3-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)