Skip to content

Reorganize repo and add OSS files #14

Reorganize repo and add OSS files

Reorganize repo and add OSS files #14

Workflow file for this run

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
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- 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
run: cargo install espup
- name: Install ESP Rust toolchain
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 --target riscv32imc-esp-espidf
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
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- 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
run: cargo install espup
- name: Install ESP Rust toolchain
run: |
espup install
. $HOME/export-esp.sh
- name: Run clippy
run: |
. $HOME/export-esp.sh
cd sensors/active-wing
cargo clippy --target riscv32imc-esp-espidf -- -D warnings
build:
name: Build Firmware
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- 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-espflash
- name: Install ESP Rust toolchain
run: |
espup install
. $HOME/export-esp.sh
- name: Build firmware
run: |
. $HOME/export-esp.sh
cargo build --release --target riscv32imc-esp-espidf
- name: Upload firmware artifact
uses: actions/upload-artifact@v4
with:
name: firmware-esp32c3
path: target/riscv32imc-esp-espidf/release/esp32-telemetry
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 [ -d "tools/python" ] && ls tools/python/*.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 tools/python/ - 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
if [ -f tools/python/requirements.txt ]; then
pip install -r tools/python/requirements.txt
fi
- name: Lint with flake8
if: steps.check_files.outputs.files_exist == 'true'
run: |
flake8 tools/python --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 tools/python --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 tools/python/*.py