Skip to content

Commit ccb13b1

Browse files
committed
[SD] Run via GH:A
1 parent 4826b58 commit ccb13b1

File tree

7 files changed

+68
-51
lines changed

7 files changed

+68
-51
lines changed

.github/workflows/build-clang-doxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Brent Rubell for Adafruit Industries, 2023
1+
# SPDX-FileCopyrightText: Brent Rubell for Adafruit Industries, 2023-2024
22
#
33
# SPDX-License-Identifier: MIT
44
name: WipperSnapper Build CI

.github/workflows/release-callee.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Brent Rubell for Adafruit Industries, 2022
1+
# SPDX-FileCopyrightText: Brent Rubell for Adafruit Industries, 2022-2024
22
#
33
# SPDX-License-Identifier: MIT
44
name: WipperSnapper Release Callee

.github/workflows/release-caller.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Brent Rubell for Adafruit Industries, 2022
1+
# SPDX-FileCopyrightText: Brent Rubell for Adafruit Industries, 2022 - 2024
22
#
33
# SPDX-License-Identifier: MIT
44
name: WipperSnapper Release Workflow

.github/workflows/run-tests.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# SPDX-FileCopyrightText: Brent Rubell for Adafruit Industries, 2024
2+
#
3+
# SPDX-License-Identifier: MIT
4+
name: WipperSnapper Tests
5+
6+
on:
7+
pull_request:
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
test:
15+
- test_offline
16+
fail-fast: false
17+
steps:
18+
- name: Check out repository code
19+
uses: actions/checkout@v3
20+
21+
- name: Check out repository code
22+
uses: actions/checkout@v3
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.13'
28+
cache: 'pip'
29+
30+
- name: Install Python dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install -r tests/requirements.txt
34+
35+
- name: Install Wokwi CI server
36+
uses: wokwi/wokwi-ci-server-action@v1
37+
38+
- name: Install Wokwi CLI
39+
run: curl -L https://wokwi.com/ci/install.sh | sh
40+
41+
- name: Test on Wokwi
42+
run: pytest test_${{ matrix.test }}.py --junitxml=report.xml
43+
env:
44+
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}
45+
46+
- name: Publish Test Results
47+
uses: EnricoMi/publish-unit-test-result-action@v2
48+
if: always()
49+
with:
50+
files: |
51+
test-results/**/*.xml

tests/report.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="0" skipped="0" tests="4" time="78.504" timestamp="2024-11-20T12:44:02.173602-05:00" hostname="macbook-2"><testcase classname="test_offline" name="test_invalid_json" time="10.582" /><testcase classname="test_offline" name="test_analog_input" time="24.173" /><testcase classname="test_offline" name="test_digital_input" time="27.073" /><testcase classname="test_offline" name="test_ds18b20" time="16.646" /></testsuite></testsuites>

tests/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pytest

tests/test_offline.py

Lines changed: 12 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,72 +4,36 @@
44
import pytest
55
import subprocess
66

7-
def test_invalid_json():
8-
# Run the Wokwi CLI
7+
def run_wokwi_cli(binary, timeout, scenario, diagram):
98
result = subprocess.run(
109
[
1110
"wokwi-cli",
1211
"--elf",
13-
f"bin/offline/firmware.elf",
12+
binary,
1413
"--timeout",
15-
"120000",
14+
timeout,
1615
"--scenario",
17-
f"scenarios/offline/test-invalid-json.scenario.yaml",
16+
scenario,
1817
"--diagram-file",
19-
f"diagrams/offline.json",
18+
diagram,
2019
]
2120
)
21+
return result
22+
23+
def test_invalid_json():
24+
result = run_wokwi_cli(f"bin/offline/firmware.elf", "120000", f"scenarios/offline/test-invalid-json.scenario.yaml", f"diagrams/offline.json")
2225
assert result.returncode == 0
2326

2427

2528
def test_analog_input():
26-
# Run the Wokwi CLI
27-
result = subprocess.run(
28-
[
29-
"wokwi-cli",
30-
"--elf",
31-
f"bin/offline/firmware.elf",
32-
"--timeout",
33-
"120000",
34-
"--scenario",
35-
f"scenarios/offline/test-log-analogin.scenario.yaml",
36-
"--diagram-file",
37-
f"diagrams/offline.json",
38-
]
39-
)
29+
result = run_wokwi_cli(f"bin/offline/firmware.elf", "120000", f"scenarios/offline/test-log-analogin.scenario.yaml", f"diagrams/offline.json")
4030
assert result.returncode == 0
4131

4232

4333
def test_digital_input():
44-
# Run the Wokwi CLI
45-
result = subprocess.run(
46-
[
47-
"wokwi-cli",
48-
"--elf",
49-
f"bin/offline/firmware.elf",
50-
"--timeout",
51-
"120000",
52-
"--scenario",
53-
f"scenarios/offline/test-log-digital-in.scenario.yaml",
54-
"--diagram-file",
55-
f"diagrams/offline.json",
56-
]
57-
)
34+
result = run_wokwi_cli(f"bin/offline/firmware.elf", "120000", f"scenarios/offline/test-log-digital-in.scenario.yaml", f"diagrams/offline.json")
5835
assert result.returncode == 0
5936

6037
def test_ds18b20():
61-
# Run the Wokwi CLI
62-
result = subprocess.run(
63-
[
64-
"wokwi-cli",
65-
"--elf",
66-
f"bin/offline/firmware.elf",
67-
"--timeout",
68-
"120000",
69-
"--scenario",
70-
f"scenarios/offline/test-log-ds18b20.scenario.yaml",
71-
"--diagram-file",
72-
f"diagrams/offline.json",
73-
]
74-
)
38+
result = run_wokwi_cli(f"bin/offline/firmware.elf", "120000", f"scenarios/offline/test-log-ds18b20.scenario.yaml", f"diagrams/offline.json")
7539
assert result.returncode == 0

0 commit comments

Comments
 (0)