Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Housekeeping to Check Code Style with clang-format #1674

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/housekeeping.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Housekeeping Checks

on:
# allows us to run workflows manually
workflow_dispatch:
pull_request:
branches:
- develop

jobs:
Housekeeping:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Dependencies
run: |
sudo apt-get install -y clang-format

- name: Setup environment
run: |
echo "REPO_SLUG=${GITHUB_REPOSITORY}" >> $GITHUB_ENV
echo "PULL_REQUEST=$(echo $GITHUB_REF | cut -d"/" -f3)" >> $GITHUB_ENV

- name: Housekeeping
run: |
cd $GITHUB_WORKSPACE
git config --global --add safe.directory /__w/cyclus/cyclus
find src/ \( -name "*.hpp" -o -name "*.cpp" -o -name "*.hh" -o -name "*.cc" -o -name "*.h" \) \
-exec clang-format -style=file -i {} \;
clang_diffs=`git status --porcelain`
if [ -z "${clang_diffs}" ]; then
echo -e "\033[32mStyle guide checker passed!\033[0m"
else
echo -e "\033[1;31mERROR: Style guide checker failed. Please run clang-format.\033[0m"
echo -e "\033[33mclang_diffs: ${clang_diffs}\033[0m"
git diff
exit 1
fi
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Since last release
* Created Package class and optional declaration of packages in input files (#1673, #1699), package id is a member of resources (materials/products) (#1675)
* CI support for Rocky Linux (#1691)
* Added support for a ResBuf to behave as a single bulk storage with mixing & extraction of resources (#1687)
* Add Housekeeping to Check Code Style with `clang-format` (#1674)

**Changed:**

Expand Down