Reorganize repo and add OSS files #30
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| check: | |
| name: Check Compilation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust nightly | |
| uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| components: rust-src | |
| - name: Install ESP-IDF prerequisites | |
| run: | | |
| sudo apt-get update | |
| 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 | |
| - name: Install espup and ldproxy | |
| run: | | |
| cargo install espup | |
| cargo install ldproxy | |
| - name: Install ESP-IDF | |
| run: | | |
| espup install | |
| . $HOME/export-esp.sh | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Check compilation | |
| run: | | |
| . $HOME/export-esp.sh | |
| cd sensors/active-wing | |
| cargo check | |
| fmt: | |
| name: Format Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| clippy: | |
| name: Clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust nightly | |
| uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| components: rust-src, clippy | |
| - name: Run clippy | |
| run: | | |
| cd sensors/active-wing | |
| cargo clippy -- -D warnings | |
| build: | |
| name: Build Firmware | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust nightly | |
| uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| components: rust-src | |
| - name: Install ESP-IDF prerequisites | |
| run: | | |
| sudo apt-get update | |
| 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 | |
| - name: Install espup and cargo-espflash | |
| run: | | |
| cargo install espup | |
| cargo install cargo-espflash espflash ldproxy | |
| - name: Install ESP-IDF | |
| run: | | |
| espup install | |
| . $HOME/export-esp.sh | |
| - name: Build firmware | |
| run: | | |
| . $HOME/export-esp.sh | |
| cd sensors/active-wing | |
| cargo build --release | |
| - name: List build artifacts | |
| run: | | |
| echo "Listing target directory:" | |
| ls -la sensors/active-wing/target/riscv32imc-esp-espidf/release/ | |
| echo "Looking for binaries:" | |
| find sensors/active-wing/target/riscv32imc-esp-espidf/release/ -type f -executable -o -name "*.bin" -o -name "*.elf" | |
| - name: Upload firmware artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: firmware-esp32c3 | |
| path: sensors/active-wing/target/riscv32imc-esp-espidf/release/active-wing | |
| python-lint: | |
| name: Python Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check if Python files exist | |
| id: check_files | |
| run: | | |
| if ls *.py 1> /dev/null 2>&1; then | |
| echo "files_exist=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "files_exist=false" >> $GITHUB_OUTPUT | |
| echo "⚠️ No Python files found in root - skipping lint" | |
| fi | |
| - name: Set up Python | |
| if: steps.check_files.outputs.files_exist == 'true' | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| if: steps.check_files.outputs.files_exist == 'true' | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install flake8 black paho-mqtt | |
| - name: Lint with flake8 | |
| if: steps.check_files.outputs.files_exist == 'true' | |
| run: | | |
| flake8 *.py --count --select=E9,F63,F7,F82 --show-source --statistics | |
| flake8 *.py --count --exit-zero --max-complexity=10 --max-line-length=100 --statistics | |
| - name: Check formatting with black | |
| if: steps.check_files.outputs.files_exist == 'true' | |
| run: black --check *.py |