Signal handler #18
Workflow file for this run
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: CMake Build and Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# - name: Build and install Google Test | |
# run: | | |
# git clone https://github.com/google/googletest.git | |
# cd googletest | |
# cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -S. | |
# cmake --build build | |
# sudo cmake --install build | |
- name: Install Dependecies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang-format | |
# - name: Build and run unit tests | |
# run: | | |
# cmake -B build/ -DBUILD_TESTS=ON | |
# make -C build/ | |
# ./build/unit_tests | |
- name: Check Code Formatting | |
run: | | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
YELLOW='\033[1;33m' | |
NC='\033[0m' # No Color | |
echo -e "${YELLOW}+ Checking formatter${NC}" | |
is_formatted=0 | |
for file in $(find srcs/ include/ -type f \( -name "*.cpp" -o -name "*.hpp" -o -name "*.h" \)); do | |
output=$(clang-format --dry-run -Werror "$file" 2>&1) | |
# Check if output contains any suggestions | |
if [[ -n "${output//[$'\n\r ']}" ]]; then | |
echo -e "${RED}x ${NC}$(basename $file)" | |
is_formatted=1 | |
else | |
echo -e "${GREEN}✓ ${NC}$(basename $file)" | |
fi | |
done | |
if [[ $is_formatted -eq 1 ]]; then | |
echo "Some files aren't properly formatted" | |
exit 1 | |
fi |