From c9d9cf8f86f6dc416f8d31d1346a05189ea46f5b Mon Sep 17 00:00:00 2001 From: realstealthninja <68815218+realstealthninja@users.noreply.github.com> Date: Mon, 4 Nov 2024 18:28:20 +0530 Subject: [PATCH 1/5] ci: make compile add warnings to file --- .github/workflows/awesome_workflow.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/awesome_workflow.yml b/.github/workflows/awesome_workflow.yml index 70dd717fa33..45039f8f629 100644 --- a/.github/workflows/awesome_workflow.yml +++ b/.github/workflows/awesome_workflow.yml @@ -13,10 +13,10 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@v4 - name: requirements - run: | + 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. + # 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: | @@ -33,8 +33,8 @@ jobs: 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 + # 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 @@ -59,6 +59,7 @@ jobs: - uses: actions/checkout@v4 with: submodules: true + - uses: root-project/gcc-problem-matcher-improved@v1 - run: | cmake -B ./build -S . cmake --build build --parallel 4 From 770d40a26f730bb909f0f763d738e4c9f2ad673e Mon Sep 17 00:00:00 2001 From: Stealthninja <68815218+realstealthninja@users.noreply.github.com> Date: Sun, 24 Nov 2024 12:53:04 +0530 Subject: [PATCH 2/5] chore: use cpp-linter instead of inhouse linter --- .github/workflows/awesome_workflow.yml | 45 ++++++-------------------- 1 file changed, 9 insertions(+), 36 deletions(-) diff --git a/.github/workflows/awesome_workflow.yml b/.github/workflows/awesome_workflow.yml index 45039f8f629..0afc5b00e3a 100644 --- a/.github/workflows/awesome_workflow.yml +++ b/.github/workflows/awesome_workflow.yml @@ -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,7 +31,8 @@ jobs: - uses: actions/checkout@v4 with: submodules: true - - uses: root-project/gcc-problem-matcher-improved@v1 + - name: GCC problem matcher + uses: ammaraskar/gcc-problem-matcher@0.3.0 - run: | cmake -B ./build -S . cmake --build build --parallel 4 From e91a7c04775fd144aa039536ca6c7b79c735f3cd Mon Sep 17 00:00:00 2001 From: Stealthninja <68815218+realstealthninja@users.noreply.github.com> Date: Sun, 24 Nov 2024 12:53:38 +0530 Subject: [PATCH 3/5] chore: use abinoda instead of pullreminders for label-when-approved --- .github/workflows/approved-label.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/approved-label.yml b/.github/workflows/approved-label.yml index 9fbc5ed0ae8..1d6a02abb25 100644 --- a/.github/workflows/approved-label.yml +++ b/.github/workflows/approved-label.yml @@ -5,10 +5,10 @@ jobs: name: Add "approved" label when approved runs-on: ubuntu-latest steps: - - name: Add "approved" label when approved - uses: pullreminders/label-when-approved-action@master - env: - APPROVALS: "1" - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ADD_LABEL: "approved" - REMOVE_LABEL: "" + - name: Add "approved" label when approved + uses: abinoda/label-when-approved-action@v1.0.7 + env: + APPROVALS: "1" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ADD_LABEL: "approved" + REMOVE_LABEL: "" From 284901364984ea66719ebe0fd16dbae6c6a32346 Mon Sep 17 00:00:00 2001 From: Stealthninja <68815218+realstealthninja@users.noreply.github.com> Date: Sun, 24 Nov 2024 13:27:02 +0530 Subject: [PATCH 4/5] fix: permissions awesome-ci --- .github/workflows/awesome_workflow.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/awesome_workflow.yml b/.github/workflows/awesome_workflow.yml index 0afc5b00e3a..475d4318cd9 100644 --- a/.github/workflows/awesome_workflow.yml +++ b/.github/workflows/awesome_workflow.yml @@ -1,6 +1,7 @@ name: Awesome CI Workflow on: [push, pull_request] permissions: + pull-requests: write contents: write jobs: From 5e76dbe2dee67fe05271bbcf3da573da35a3ff1c Mon Sep 17 00:00:00 2001 From: Stealthninja <68815218+realstealthninja@users.noreply.github.com> Date: Sun, 24 Nov 2024 13:34:23 +0530 Subject: [PATCH 5/5] fix: permission issue for github action --- .github/workflows/awesome_workflow.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/awesome_workflow.yml b/.github/workflows/awesome_workflow.yml index 475d4318cd9..f74b0acc541 100644 --- a/.github/workflows/awesome_workflow.yml +++ b/.github/workflows/awesome_workflow.yml @@ -3,6 +3,7 @@ on: [push, pull_request] permissions: pull-requests: write contents: write + issues: write jobs: MainSequence: