1212
1313jobs :
1414 check :
15- name : Check
15+ name : Check Compilation
1616 runs-on : ubuntu-latest
1717 steps :
1818 - uses : actions/checkout@v4
2222 with :
2323 components : rustfmt, clippy
2424
25+ - name : Install ESP-IDF prerequisites
26+ run : |
27+ sudo apt-get update
28+ sudo apt-get install -y git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
29+
30+ - name : Install espup
31+ run : cargo install espup
32+
33+ - name : Install ESP Rust toolchain
34+ run : |
35+ espup install
36+ . $HOME/export-esp.sh
37+
2538 - name : Cache cargo registry
2639 uses : actions/cache@v3
2740 with :
@@ -34,28 +47,13 @@ jobs:
3447 path : ~/.cargo/git
3548 key : ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
3649
37- - name : Cache cargo build
38- uses : actions/cache@v3
39- with :
40- path : target
41- key : ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
42-
43- - name : Check framework and drivers
50+ - name : Check compilation
4451 run : |
45- # Build exclusion list for all sensor projects (they need ESP32 target)
46- EXCLUDES=""
47- for sensor_dir in sensors/*/; do
48- if [ -f "${sensor_dir}Cargo.toml" ]; then
49- sensor_name=$(basename "$sensor_dir")
50- EXCLUDES="$EXCLUDES --exclude $sensor_name"
51- fi
52- done
53-
54- echo "Checking workspace (excluding sensor projects)..."
55- cargo check --workspace $EXCLUDES --all-features
52+ . $HOME/export-esp.sh
53+ cargo check --target riscv32imc-esp-espidf
5654
5755 fmt :
58- name : Format
56+ name : Format Check
5957 runs-on : ubuntu-latest
6058 steps :
6159 - uses : actions/checkout@v4
@@ -79,141 +77,57 @@ jobs:
7977 with :
8078 components : clippy
8179
82- - name : Run clippy on framework and drivers
80+ - name : Install ESP-IDF prerequisites
8381 run : |
84- # Build exclusion list for all sensor projects
85- EXCLUDES=""
86- for sensor_dir in sensors/*/; do
87- if [ -f "${sensor_dir}Cargo.toml" ]; then
88- sensor_name=$(basename "$sensor_dir")
89- EXCLUDES="$EXCLUDES --exclude $sensor_name"
90- fi
91- done
92-
93- echo "Running clippy (excluding sensor projects)..."
94- cargo clippy --workspace $EXCLUDES --all-features -- -D warnings
95-
96- test :
97- name : Test
98- runs-on : ubuntu-latest
99- steps :
100- - uses : actions/checkout@v4
101-
102- - name : Install Rust
103- uses : dtolnay/rust-toolchain@stable
104-
105- - name : Run tests on framework and drivers
82+ sudo apt-get update
83+ sudo apt-get install -y git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
84+
85+ - name : Install espup
86+ run : cargo install espup
87+
88+ - name : Install ESP Rust toolchain
10689 run : |
107- # Build exclusion list for all sensor projects
108- EXCLUDES=""
109- for sensor_dir in sensors/*/; do
110- if [ -f "${sensor_dir}Cargo.toml" ]; then
111- sensor_name=$(basename "$sensor_dir")
112- EXCLUDES="$EXCLUDES --exclude $sensor_name"
113- fi
114- done
115-
116- echo "Running tests (excluding sensor projects)..."
117- cargo test --workspace $EXCLUDES
90+ espup install
91+ . $HOME/export-esp.sh
92+
93+ - name : Run clippy
94+ run : |
95+ . $HOME/export-esp.sh
96+ cargo clippy --target riscv32imc-esp-espidf -- -D warnings
11897
119- build-sensor-projects :
120- name : Build Sensor Projects
98+ build :
99+ name : Build Firmware
121100 runs-on : ubuntu-latest
122101 steps :
123102 - uses : actions/checkout@v4
124103
125104 - name : Install Rust
126105 uses : dtolnay/rust-toolchain@stable
127- with :
128- components : rust-src
129106
130- - name : Install build dependencies
107+ - name : Install ESP-IDF prerequisites
131108 run : |
132109 sudo apt-get update
133- sudo apt-get install -y git wget flex bison gperf python3 python3-pip python3-venv \
134- cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0 libudev-dev
135-
136- - name : Install ldproxy and cargo-espflash
137- run : cargo install ldproxy cargo-espflash
138-
139- - name : Discover and build all sensor projects
110+ sudo apt-get install -y git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
111+
112+ - name : Install espup and cargo-espflash
140113 run : |
141- # Find all sensor projects (directories with Cargo.toml in sensors/)
142- build_count=0
143- failed_count=0
144-
145- for sensor_dir in sensors/*/; do
146- if [ -f "${sensor_dir}Cargo.toml" ]; then
147- sensor_name=$(basename "$sensor_dir")
148- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
149- echo "Building sensor project: $sensor_name"
150- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
151-
152- # Build from the sensor directory to use its .cargo/config.toml
153- # The embuild system will download ESP-IDF automatically
154- if (cd "$sensor_dir" && cargo build --release); then
155- echo "✅ Successfully built $sensor_name"
156- ((build_count++))
157- else
158- echo "❌ Failed to build $sensor_name"
159- ((failed_count++))
160- fi
161- fi
162- done
163-
164- echo ""
165- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
166- echo "Build Summary:"
167- echo " ✅ Successful: $build_count"
168- echo " ❌ Failed: $failed_count"
169- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
170-
171- # Fail the job if any builds failed
172- if [ $failed_count -gt 0 ]; then
173- exit 1
174- fi
175-
176- - name : Collect firmware binaries
177- id : collect_binaries
114+ cargo install espup cargo-espflash
115+
116+ - name : Install ESP Rust toolchain
178117 run : |
179- # Create a directory to collect all sensor binaries
180- mkdir -p firmware-artifacts
181-
182- # Find and copy all sensor project binaries
183- # The binary is in sensors/<name>/target/<target>/release/<name>
184- for sensor_dir in sensors/*/; do
185- if [ -f "${sensor_dir}Cargo.toml" ]; then
186- sensor_name=$(basename "$sensor_dir")
187-
188- # Find the binary in the sensor's target directory
189- binary_path="${sensor_dir}target/riscv32imc-esp-espidf/release/$sensor_name"
190-
191- if [ -f "$binary_path" ]; then
192- echo "✅ Found binary: $sensor_name"
193- cp "$binary_path" "firmware-artifacts/"
194- ls -lh "$binary_path"
195- else
196- echo "⚠️ Binary not found: $binary_path"
197- # Try alternate location (workspace target dir)
198- alt_path="target/riscv32imc-esp-espidf/release/$sensor_name"
199- if [ -f "$alt_path" ]; then
200- echo "✅ Found binary at: $alt_path"
201- cp "$alt_path" "firmware-artifacts/"
202- fi
203- fi
204- fi
205- done
206-
207- echo ""
208- echo "Firmware artifacts collected:"
209- ls -lh firmware-artifacts/ || echo "No binaries found"
118+ espup install
119+ . $HOME/export-esp.sh
120+
121+ - name : Build firmware
122+ run : |
123+ . $HOME/export-esp.sh
124+ cargo build --release --target riscv32imc-esp-espidf
210125
211- - name : Upload firmware artifacts
212- uses : actions/upload-artifact@v4
126+ - name : Upload firmware artifact
127+ uses : actions/upload-artifact@v3
213128 with :
214- name : sensor-firmware-${{ matrix.target }}
215- path : firmware-artifacts/
216- if-no-files-found : error
129+ name : firmware-esp32c3
130+ path : target/riscv32imc-esp-espidf/release/esp32-telemetry
217131
218132 python-lint :
219133 name : Python Lint
@@ -230,50 +144,12 @@ jobs:
230144 run : |
231145 python -m pip install --upgrade pip
232146 pip install flake8 black
233-
234- # Install requirements from all sensor projects that have them
235- for sensor_dir in sensors/*/; do
236- if [ -f "${sensor_dir}tools/python/requirements.txt" ]; then
237- echo "Installing Python requirements for $(basename "$sensor_dir")..."
238- pip install -r "${sensor_dir}tools/python/requirements.txt"
239- fi
240- done
241-
242- - name : Lint Python tools with flake8
243- run : |
244- # Find all sensor projects with Python tools
245- python_dirs=$(find sensors/*/tools/python -type d 2>/dev/null || true)
246-
247- if [ -z "$python_dirs" ]; then
248- echo "No Python tools found in any sensor projects"
249- exit 0
250- fi
251-
252- # Lint each Python tools directory
253- for py_dir in $python_dirs; do
254- if [ -d "$py_dir" ] && [ "$(ls -A $py_dir/*.py 2>/dev/null)" ]; then
255- sensor_name=$(echo "$py_dir" | cut -d'/' -f2)
256- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
257- echo "Linting Python tools for: $sensor_name"
258- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
259-
260- # Stop on syntax errors or undefined names
261- flake8 "$py_dir" --count --select=E9,F63,F7,F82 --show-source --statistics
262-
263- # Exit-zero treats all errors as warnings
264- flake8 "$py_dir" --count --exit-zero --max-complexity=10 --max-line-length=100 --statistics
265- fi
266- done
267-
268- - name : Check Python formatting with black
147+ pip install -r tools/python/requirements.txt
148+
149+ - name : Lint with flake8
269150 run : |
270- # Find all Python files in sensor tools directories
271- python_files=$(find sensors/*/tools/python -name "*.py" 2>/dev/null || true)
272-
273- if [ -z "$python_files" ]; then
274- echo "No Python files found in sensor projects"
275- exit 0
276- fi
277-
278- echo "Checking formatting for Python files..."
279- black --check $python_files
151+ flake8 tools/python --count --select=E9,F63,F7,F82 --show-source --statistics
152+ flake8 tools/python --count --exit-zero --max-complexity=10 --max-line-length=100 --statistics
153+
154+ - name : Check formatting with black
155+ run : black --check tools/python/*.py
0 commit comments