Skip to content

Commit addac50

Browse files
committed
ci: Simulate projects
1 parent 0d4fe76 commit addac50

File tree

5 files changed

+46
-2
lines changed

5 files changed

+46
-2
lines changed

.devcontainer/test.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
set -ef
44

5-
WORK_DIR=/home/esp/workspace/$1
6-
75
echo "Compiling $1"
86

97
cd /home/esp/workspace/$1
@@ -26,6 +24,8 @@ $HOME/.cargo/bin/cargo build
2624
if [[ "$1" == advanced/button-interrupt ]]; then
2725
$HOME/.cargo/bin/cargo build --example solution
2826
$HOME/.cargo/bin/cargo build --example solution_led
27+
# Simulate with Wokwi
28+
sed -i 's/^[[:space:]]*firmware[[:space:]]*=[[:space:]]*["'"'"']\([^"'"'"']*\)["'"'"']\([[:space:]]*\)$/\nfirmware = "target\/riscv32imc-esp-espidf\/debug\/examples\/solution"/' wokwi.toml
2929
fi
3030

3131
if [[ "$1" == advanced/i2c-sensor-reading ]]; then
@@ -36,6 +36,8 @@ fi
3636
if [[ "$1" == intro/http-client ]]; then
3737
$HOME/.cargo/bin/cargo build --example http_client
3838
$HOME/.cargo/bin/cargo build --example https_client
39+
# Simulate with Wokwi
40+
sed -i 's/^[[:space:]]*firmware[[:space:]]*=[[:space:]]*["'"'"']\([^"'"'"']*\)["'"'"']\([[:space:]]*\)$/\nfirmware = "target\/riscv32imc-esp-espidf\/debug\/examples\/http_client"/' wokwi.toml
3941
fi
4042

4143
if [[ "$1" == intro/http-server ]]; then

.github/button-interrupt.test.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: button-interrupt test
2+
version: 1
3+
author: Sergio Gasquez Arcos
4+
5+
steps:
6+
- delay: 100ms
7+
- wait-serial: "GPIO[9]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:1"
8+
# Press once
9+
- set-control:
10+
part-id: btn1
11+
control: pressed
12+
value: 1
13+
- delay: 100ms
14+
- set-control:
15+
part-id: btn1
16+
control: pressed
17+
value: 0
18+
- wait-serial: "Button pressed!"

.github/hardware-check.test.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: hardware-check test
2+
version: 1
3+
author: Sergio Gasquez Arcos
4+
5+
steps:
6+
- delay: 5000ms
7+
- wait-serial: "Hello, world!"

.github/http-client.test.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: http-client test
2+
version: 1
3+
author: Sergio Gasquez Arcos
4+
5+
steps:
6+
- delay: 5000ms
7+
- wait-serial: "Response code: 200"

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,13 @@ jobs:
6767
image: espressif/rust-std-training:latest
6868
options: -u esp -v ${{ github.workspace }}:/home/esp/workspace
6969
run: /bin/bash /home/esp/workspace/.devcontainer/test.sh ${{ matrix.project.path }}
70+
71+
- name: Wokwi CI check
72+
if: matrix.project.name == 'button-interrupt' || matrix.project.name == 'http-client' || matrix.project.name == 'hardware-check'
73+
uses: wokwi/wokwi-ci-action@v1
74+
with:
75+
token: ${{ secrets.WOKWI_CLI_TOKEN }}
76+
path: ${{ matrix.project.path }}
77+
timeout: 30000
78+
scenario: .github/${{ matrix.project.name }}.test.yaml
79+
fail_text: 'Error'

0 commit comments

Comments
 (0)