Skip to content

main: fix state handling in main #402

main: fix state handling in main

main: fix state handling in main #402

name: State Machine Verification
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
pull_request:
paths:
- "app/src/main.c"
- "app/src/modules/network/network.c"
- "app/src/modules/cloud/cloud.c"
- "app/src/modules/fota/fota.c"
- "app/src/modules/storage/storage.c"
- "tests/state_machines/**/*"
jobs:
verify-state-machines:
name: Verify State Machines
runs-on: ubuntu-latest
timeout-minutes: 15 # Prevent hanging jobs
container:
image: python:3.12.5-slim-bookworm
strategy:
matrix:
include:
- name: MAIN
c_file: app/src/main.c
uml_file: tests/state_machines/source_of_truth/main.puml
- name: NETWORK
c_file: app/src/modules/network/network.c
uml_file: tests/state_machines/source_of_truth/network.puml
- name: CLOUD
c_file: app/src/modules/cloud/cloud.c
uml_file: tests/state_machines/source_of_truth/cloud.puml
- name: CLOUD-MQTT
c_file: examples/modules/cloud/cloud_mqtt.c
uml_file: tests/state_machines/source_of_truth/cloud_mqtt.puml
- name: FOTA
c_file: app/src/modules/fota/fota.c
uml_file: tests/state_machines/source_of_truth/fota.puml
- name: STORAGE
c_file: app/src/modules/storage/storage.c
uml_file: tests/state_machines/source_of_truth/storage.puml
- name: LOCATION
c_file: app/src//modules/location/location.c
uml_file: tests/state_machines/source_of_truth/location.puml
# Don't cancel all jobs if one fails
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
pip install openai
- name: Verify ${{ matrix.name }} State Machine
id: verify
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
python tests/state_machines/verify_machine.py \
--c-file ${{ matrix.c_file }} \
--uml-file ${{ matrix.uml_file }}