Skip to content

feat: add LED activity indication for data transmission #12

feat: add LED activity indication for data transmission

feat: add LED activity indication for data transmission #12

Workflow file for this run

name: CI/CD Pipeline
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
workflow_dispatch:
inputs:
board:
description: 'Target board'
required: false
default: 'xiao_ble'
type: choice
options:
- xiao_ble
jobs:
build-and-test:
runs-on: ubuntu-latest
container:
# Zephyr toolchain from here:
# https://github.com/zephyrproject-rtos/docker-image/pkgs/container/ci
image: ghcr.io/zephyrproject-rtos/ci:v0.26.6
env:
# Tell cmake where to find the zephyr sdk
CMAKE_PREFIX_PATH: /opt/toolchains
strategy:
matrix:
board: [xiao_ble]
include:
- board: xiao_ble
description: "Seeed XIAO nRF52840"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: ♻️ Initialize Zephyr Workspace
# Set up the Zephyr workspace exactly as specified
run: |
mkdir -p /zephyr_workspace
cd /zephyr_workspace
west init -m https://github.com/nrfconnect/sdk-nrf.git --mr main
west update --narrow -o=--depth=1
- name: 📁 Copy App to Workspace
run: |
cp -r app /zephyr_workspace/app
- name: 💾 Cache ~/.cache/ccache
uses: actions/cache@v3
with:
path: ~/.cache/ccache
key: ccache-v1-${{ runner.os }}-${{ hashFiles('west.yml') }}
restore-keys: |
ccache-v1-${{ runner.os }}-
- name: 🔨 Build Project
run: |
cd /zephyr_workspace
ccache -z
west build \
--board ${{ matrix.board }} \
--pristine=always app
ccache -sv
- name: 📦 Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: firmware-${{ matrix.board }}
path: |
/zephyr_workspace/build/app/zephyr/zephyr.hex
/zephyr_workspace/build/app/zephyr/zephyr.uf2
/zephyr_workspace/build/app/zephyr/zephyr.bin
/zephyr_workspace/build/app/zephyr/zephyr.map
retention-days: 30
- name: 🔍 Verify Build Artifacts
run: |
cd /zephyr_workspace
echo "Checking for required files..."
[ -f build/app/zephyr/zephyr.hex ] && echo '✓ zephyr.hex found' || echo '✗ zephyr.hex missing'
[ -f build/app/zephyr/zephyr.bin ] && echo '✓ zephyr.bin found' || echo '✗ zephyr.bin missing'
[ -f build/app/zephyr/zephyr.uf2 ] && echo '✓ zephyr.uf2 found' || echo '✗ zephyr.uf2 missing'
echo 'Build size:'
ls -lh build/app/zephyr/zephyr.hex
security-scan:
runs-on: ubuntu-latest
needs: build-and-test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run security scan
run: |
echo "Running security analysis..."
# Check for common security issues in C code
find app/src -name '*.c' -o -name '*.h' | xargs grep -l 'strcpy\|sprintf\|gets' || echo 'No obvious security issues found'
release:
runs-on: ubuntu-latest
needs: [build-and-test, security-scan]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create release package
run: |
mkdir -p release
for board in xiao_ble; do
if [ -d "artifacts/firmware-$board" ]; then
mkdir -p "release/$board"
cp artifacts/firmware-$board/* "release/$board/"
fi
done
echo "Release package created:"
find release -type f
- name: Upload release artifacts
uses: actions/upload-artifact@v4
with:
name: release-package
path: release/
retention-days: 90