🚧 feat(NFC) add client-server protocol idea doc, FSM dra… #54
This file contains 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 | |
pull_request: | |
branches: | |
- main | |
jobs: | |
compile: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v3 | |
with: | |
submodules: true # Initialize and update submodules automatically | |
fetch-depth: 0 # Fetch all history to ensure proper submodule handling | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y gcc-arm-none-eabi make | |
- name: Build project | |
run: | | |
cd firmware/iot-risk-logger-stm32l4 | |
make all | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-artifacts | |
path: | | |
firmware/iot-risk-logger-stm32l4/build/ | |
firmware/iot-risk-logger-stm32l4/*.elf | |
firmware/iot-risk-logger-stm32l4/*.map | |
calculate-memory-usage: | |
runs-on: ubuntu-latest | |
needs: compile | |
steps: | |
- name: Checkout artifacts branch | |
uses: actions/checkout@v3 | |
with: | |
ref: artifacts # Checkout the artifacts branch | |
submodules: true | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y gcc-arm-none-eabi | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-artifacts | |
- name: Calculate Flash and RAM usage | |
run: | | |
SIZE_OUTPUT=$(arm-none-eabi-size build/iot-risk-logger-stm32l4.elf) | |
TEXT_SIZE=$(echo "$SIZE_OUTPUT" | awk 'NR==2 {print $1}') | |
DATA_SIZE=$(echo "$SIZE_OUTPUT" | awk 'NR==2 {print $2}') | |
BSS_SIZE=$(echo "$SIZE_OUTPUT" | awk 'NR==2 {print $3}') | |
FLASH_USAGE=$((TEXT_SIZE + DATA_SIZE)) | |
RAM_USAGE=$((DATA_SIZE + BSS_SIZE)) | |
FLASH_KB=$(( (FLASH_USAGE + 1023) / 1024 )) # Round to nearest KB | |
RAM_KB=$(( (RAM_USAGE + 1023) / 1024 )) # Round to nearest KB | |
FLASH_MAX=128 # Maximum flash size in KB | |
SRAM_MAX=40 # Maximum RAM size in KB | |
FLASH_USAGE_PERCENT=$(( (FLASH_KB * 100) / FLASH_MAX )) | |
SRAM_USAGE_PERCENT=$(( (RAM_KB * 100) / SRAM_MAX )) | |
touch usage.json | |
echo "{ \"flash\": \"${FLASH_KB}K/${FLASH_MAX}K (${FLASH_USAGE_PERCENT}%)\", \"SRAM\": \"${RAM_KB}K/${SRAM_MAX}K (${SRAM_USAGE_PERCENT}%)\" }" > usage.json | |
cat usage.json | |
- name: Commit usage.json to artifacts branch | |
run: | | |
mkdir -p artifacts | |
mv usage.json artifacts/ | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -am "Update Flash and RAM usage artifacts" | |
git push origin artifacts | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
test: | |
runs-on: ubuntu-latest | |
needs: compile | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-artifacts | |
- name: Run tests | |
run: echo "Run your test commands here" | |
generate-diagrams: | |
runs-on: ubuntu-latest | |
needs: compile | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-artifacts | |
- name: Generate diagrams | |
run: echo "Run your diagram generation commands here" |