File tree Expand file tree Collapse file tree 4 files changed +77
-0
lines changed Expand file tree Collapse file tree 4 files changed +77
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ function build_mod()
4+ {
5+ make all || exit 1
6+ }
7+
8+ function run_tests()
9+ {
10+ make check || exit 2
11+ }
12+
13+ build_mod
14+ run_tests
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ SOURCES=$( find $( git rev-parse --show-toplevel) | egrep " \.(cpp|cc|c|h)\$ " )
4+
5+ CLANG_FORMAT=$( which clang-format-12)
6+ if [ $? -ne 0 ]; then
7+ CLANG_FORMAT=$( which clang-format)
8+ if [ $? -ne 0 ]; then
9+ echo " [!] clang-format not installed. Unable to check source file format policy." >&2
10+ exit 1
11+ fi
12+ fi
13+
14+ set -x
15+
16+ for file in ${SOURCES} ;
17+ do
18+ $CLANG_FORMAT ${file} > expected-format
19+ diff -u -p --label=" ${file} " --label=" expected coding style" ${file} expected-format
20+ done
21+ exit $( $CLANG_FORMAT --output-replacements-xml ${SOURCES} | egrep -c " </replacement>" )
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -e -u -o pipefail
4+
5+ ret=0
6+ show=0
7+ # Reference: https://medium.com/@alexey.inkin/how-to-force-newline-at-end-of-files-and-why-you-should-do-it-fdf76d1d090e
8+ while IFS= read -rd ' ' f; do
9+ if file --mime-encoding " $f " | grep -qv binary; then
10+ tail -c1 < " $f " | read -r _ || show=1
11+ if [ $show -eq 1 ]; then
12+ echo " Warning: No newline at end of file $f "
13+ ret=1
14+ show=0
15+ fi
16+ fi
17+ done < <( git ls-files -z src tests/arch-test-target)
18+
19+ exit $ret
Original file line number Diff line number Diff line change 1+ name : main
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+
9+ workflow_dispatch :
10+
11+ jobs :
12+ validate :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - name : checkout code
16+ uses : actions/checkout@v4
17+ - name : validate coding style and functionality
18+ run : |
19+ sudo apt-get install -q -y clang-format-12
20+ .ci/check-newline.sh
21+ .ci/check-format.sh
22+ .ci/build-n-run.sh
23+ shell : bash
You can’t perform that action at this time.
0 commit comments