-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
17 additions
and
43 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,42 +9,14 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cpp-linter/cpp-linter-action@v2 | ||
id: linter | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v4 | ||
- name: requirements | ||
run: | | ||
sudo apt-get -qq update | ||
sudo apt-get -qq install clang-tidy clang-format | ||
# checks are passing with less errors when used with this version. | ||
# The default installs v6.0 which did not work out well in my tests | ||
- name: Setup Git Specs | ||
run: | | ||
git config --global user.name github-actions[bot] | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
- name: Filename Formatter | ||
run: | | ||
wget https://raw.githubusercontent.com/TheAlgorithms/scripts/main/filename_formatter.sh | ||
chmod +x filename_formatter.sh | ||
./filename_formatter.sh . .cpp,.hpp | ||
- name: Get file changes | ||
run: | | ||
git branch | ||
git diff --diff-filter=dr --name-only origin/master > git_diff.txt | ||
echo "Files changed-- `cat git_diff.txt`" | ||
- name: Configure for static lint checks | ||
# compiling first gives clang-tidy access to all the header files and settings used to compile the programs. | ||
# This will check for macros, if any, on linux and not for Windows. But the use of portability checks should | ||
# be able to catch any errors for other platforms. | ||
run: cmake -B build -S . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON | ||
- name: Lint modified files | ||
shell: bash | ||
run: python3 scripts/file_linter.py | ||
- name: Commit and push changes | ||
run: | | ||
git diff DIRECTORY.md | ||
git commit -am "clang-format and clang-tidy fixes for ${GITHUB_SHA::8}" || true | ||
git push origin HEAD:$GITHUB_REF || true | ||
style: "file" | ||
tidy-checks: ".clang-tidy" | ||
thread-comments: ${{ github.event_name == 'pull_request' && 'update' }} | ||
|
||
build: | ||
name: Compile checks | ||
|
@@ -59,6 +31,8 @@ jobs: | |
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: GCC problem matcher | ||
uses: ammaraskar/[email protected] | ||
- run: | | ||
cmake -B ./build -S . | ||
cmake --build build --parallel 4 | ||
|
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