CI check clang-format added #17
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: BeeCom CI | |
on: | |
push: | |
branches: [ main, develop ] | |
pull_request: | |
branches: [ main, develop ] | |
jobs: | |
format-check: | |
runs-on: ubuntu-latest | |
name: Check Code Formatting | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up clang-format | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang-format | |
- name: Run clang-format | |
run: | | |
# Find all C source files in Inc and Src directories and check formatting | |
find {Inc,Src} -type f \( -iname "*.c" -o -iname "*.h" \) -exec clang-format -style=file -i {} \; | |
# Check if any files have changed | |
git diff --exit-code || (echo "Code formatting issues found." && git diff && exit 1) | |
build: | |
needs: format-check | |
runs-on: ubuntu-latest | |
name: Build Project | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up environment | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc-arm-none-eabi | |
sudo apt-get install -y make | |
- name: Build project | |
run: | | |
cd examples/STM32F407VE | |
make all |