From 76adde5367196cd57da5bef49a4f09af6175fd3f Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Thu, 28 Jul 2022 23:25:11 -0700 Subject: [PATCH 1/7] test backlogged-updates branch --- .github/workflows/cpp-lint-action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cpp-lint-action.yml b/.github/workflows/cpp-lint-action.yml index d0a16da..4ef2b3b 100644 --- a/.github/workflows/cpp-lint-action.yml +++ b/.github/workflows/cpp-lint-action.yml @@ -28,7 +28,7 @@ jobs: run: mkdir build && cmake -Bbuild src - name: run linter as action - uses: cpp-linter/cpp-linter-action@latest + uses: cpp-linter/cpp-linter-action@backlogged-updates id: linter env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 3c2e77117435cd7b8ed52326cc28485463217ed7 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Tue, 9 Aug 2022 17:19:54 -0700 Subject: [PATCH 2/7] add a submodule and update the CI checkout steps --- .github/workflows/cpp-lint-action.yml | 2 ++ .github/workflows/cpp-lint-package.yml | 4 +++- .gitmodules | 3 +++ cpp-linter-action | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .gitmodules create mode 160000 cpp-linter-action diff --git a/.github/workflows/cpp-lint-action.yml b/.github/workflows/cpp-lint-action.yml index 4ef2b3b..e63911b 100644 --- a/.github/workflows/cpp-lint-action.yml +++ b/.github/workflows/cpp-lint-action.yml @@ -15,6 +15,8 @@ jobs: steps: - uses: actions/checkout@v2 + with: + submodules: true - name: Cache the build artifacts id: cache-build diff --git a/.github/workflows/cpp-lint-package.yml b/.github/workflows/cpp-lint-package.yml index 4720c21..b5e2554 100644 --- a/.github/workflows/cpp-lint-package.yml +++ b/.github/workflows/cpp-lint-package.yml @@ -11,12 +11,14 @@ jobs: matrix: clang-version: ['9','10', '11', '12', '13', '14'] repo: ['cpp-linter/cpp-linter-action'] - branch: ['latest'] + branch: ['backlogged-updates'] fail-fast: false steps: - uses: actions/checkout@v3 + with: + submodules: true - uses: actions/setup-python@v3 - name: Install clang-tools uses: KyleMayes/install-llvm-action@v1 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..bddf44e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "cpp-linter-action"] + path = cpp-linter-action + url = https://github.com/cpp-linter/cpp-linter-action.git diff --git a/cpp-linter-action b/cpp-linter-action new file mode 160000 index 0000000..894a549 --- /dev/null +++ b/cpp-linter-action @@ -0,0 +1 @@ +Subproject commit 894a54988abed9f2c7a37f5b54694e819de7f462 From 947c50fda5b8f40217ccccc18678e16e1b93a153 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Wed, 10 Aug 2022 03:53:27 -0700 Subject: [PATCH 3/7] make some changes to the demo sources --- src/demo.cpp | 3 +-- src/demo.hpp | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/demo.cpp b/src/demo.cpp index 8a4a9ed..66a1a54 100644 --- a/src/demo.cpp +++ b/src/demo.cpp @@ -7,8 +7,7 @@ size_t dummyFunc(size_t i) { return i; } int main() { - for (;;) - break; + for (;;) break; printf("Hello world!\n"); diff --git a/src/demo.hpp b/src/demo.hpp index 505b6b7..7cdecee 100644 --- a/src/demo.hpp +++ b/src/demo.hpp @@ -9,7 +9,7 @@ class Dummy { public: void *not_usefull(char *str){ useless = str; - return 0; + return nullptr; } }; @@ -37,5 +37,4 @@ class Dummy { struct LongDiff { long diff; - }; \ No newline at end of file From b5f734d06368e87bdd8e6f1d05ff895e0f308387 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Wed, 10 Aug 2022 04:37:23 -0700 Subject: [PATCH 4/7] Use NMake generator on Windows to get a DB --- .github/workflows/cpp-lint-package.yml | 2 +- src/demo.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cpp-lint-package.yml b/.github/workflows/cpp-lint-package.yml index b5e2554..070ebd1 100644 --- a/.github/workflows/cpp-lint-package.yml +++ b/.github/workflows/cpp-lint-package.yml @@ -38,7 +38,7 @@ jobs: - name: Generate compiler database if: steps.cache-build.outputs.cache-hit != 'true' - run: mkdir build && cmake -Bbuild src + run: mkdir build && cmake -Bbuild src -G "NMake Makefiles" - name: run linter as package id: linter diff --git a/src/demo.cpp b/src/demo.cpp index 66a1a54..6d17b23 100644 --- a/src/demo.cpp +++ b/src/demo.cpp @@ -3,6 +3,7 @@ #include #include +// using size_t from cstddef size_t dummyFunc(size_t i) { return i; } int main() From 1654350e18a41990b37180f517790b53cc98e4cf Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Wed, 10 Aug 2022 14:45:42 -0700 Subject: [PATCH 5/7] setup VS dev env in CI --- .github/workflows/cpp-lint-package.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cpp-lint-package.yml b/.github/workflows/cpp-lint-package.yml index 070ebd1..b0bfc9a 100644 --- a/.github/workflows/cpp-lint-package.yml +++ b/.github/workflows/cpp-lint-package.yml @@ -28,7 +28,9 @@ jobs: - name: Install linter package run: python3 -m pip install git+https://github.com/${{ matrix.repo }}/@${{ matrix.branch }} - + + - uses: seanmiddleditch/gha-setup-vsdevenv@v4 + - name: Cache the build artifacts id: cache-build uses: actions/cache@v3 From b06637f36eec6ad2e4d613ed2647361c00e3d381 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Wed, 10 Aug 2022 16:55:06 -0700 Subject: [PATCH 6/7] don't use database option when running as action modify demo.cpp don't use a database when using docker env --- .github/workflows/cpp-lint-action.yml | 25 ++++++++++++++----------- src/demo.cpp | 3 ++- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/cpp-lint-action.yml b/.github/workflows/cpp-lint-action.yml index e63911b..416b02d 100644 --- a/.github/workflows/cpp-lint-action.yml +++ b/.github/workflows/cpp-lint-action.yml @@ -18,16 +18,19 @@ jobs: with: submodules: true - - name: Cache the build artifacts - id: cache-build - uses: actions/cache@v3 - with: - path: build - key: ${{ hashFiles('src/CMakeLists.txt', 'src/demo.cpp', 'src/demo.hpp') }} - - - name: Generate compilation database - if: steps.cache-build.outputs.cache-hit != 'true' - run: mkdir build && cmake -Bbuild src + # - name: Cache the build artifacts + # id: cache-build + # uses: actions/cache@v3 + # with: + # path: build + # key: ${{ hashFiles('src/CMakeLists.txt', 'src/demo.cpp', 'src/demo.hpp') }} + + # - name: Generate compilation database + # if: steps.cache-build.outputs.cache-hit != 'true' + # run: mkdir build && cmake -Bbuild src + + # - name: Move database to src folder + # run: mv build/compile_commands.json src/ - name: run linter as action uses: cpp-linter/cpp-linter-action@backlogged-updates @@ -39,7 +42,7 @@ jobs: files-changed-only: ${{ matrix.clang-version == '12' }} # to ignore all build folder contents ignore: build - database: build + # database: build verbosity: 9 version: ${{ matrix.clang-version }} file-annotations: ${{ matrix.clang-version == '12' }} diff --git a/src/demo.cpp b/src/demo.cpp index 6d17b23..0c1db60 100644 --- a/src/demo.cpp +++ b/src/demo.cpp @@ -8,7 +8,8 @@ size_t dummyFunc(size_t i) { return i; } int main() { - for (;;) break; + for (;;) + break; printf("Hello world!\n"); From f451adef9f2e51f3505728e5ac21390fd810bb29 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Thu, 18 Aug 2022 23:49:26 -0700 Subject: [PATCH 7/7] ready PR for merging do thread comments when run as action revert some changes to the demo srcs --- .github/workflows/cpp-lint-action.yml | 6 +++--- .github/workflows/cpp-lint-package.yml | 26 +++++++++++++------------- src/demo.hpp | 5 +++-- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.github/workflows/cpp-lint-action.yml b/.github/workflows/cpp-lint-action.yml index 416b02d..3ca8d18 100644 --- a/.github/workflows/cpp-lint-action.yml +++ b/.github/workflows/cpp-lint-action.yml @@ -28,12 +28,12 @@ jobs: # - name: Generate compilation database # if: steps.cache-build.outputs.cache-hit != 'true' # run: mkdir build && cmake -Bbuild src - + # - name: Move database to src folder # run: mv build/compile_commands.json src/ - name: run linter as action - uses: cpp-linter/cpp-linter-action@backlogged-updates + uses: cpp-linter/cpp-linter-action@latest id: linter env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -45,7 +45,7 @@ jobs: # database: build verbosity: 9 version: ${{ matrix.clang-version }} - file-annotations: ${{ matrix.clang-version == '12' }} + thread-comments: ${{ matrix.clang-version == '12' }} - name: Fail fast?! if: steps.linter.outputs.checks-failed > 0 diff --git a/.github/workflows/cpp-lint-package.yml b/.github/workflows/cpp-lint-package.yml index b0bfc9a..dfdf3ea 100644 --- a/.github/workflows/cpp-lint-package.yml +++ b/.github/workflows/cpp-lint-package.yml @@ -9,9 +9,9 @@ jobs: strategy: matrix: - clang-version: ['9','10', '11', '12', '13', '14'] + clang-version: ['7', '8', '9','10', '11', '12', '13', '14'] repo: ['cpp-linter/cpp-linter-action'] - branch: ['backlogged-updates'] + branch: ['latest'] fail-fast: false steps: @@ -19,18 +19,18 @@ jobs: - uses: actions/checkout@v3 with: submodules: true - - uses: actions/setup-python@v3 + + - uses: actions/setup-python@v4 + + - name: install workflow deps + run: python -m pip install clang-tools git+https://github.com/${{ matrix.repo }}/@${{ matrix.branch }} + - name: Install clang-tools - uses: KyleMayes/install-llvm-action@v1 - with: - version: ${{ matrix.clang-version }} - directory: ${{ runner.temp }}/llvm - - - name: Install linter package - run: python3 -m pip install git+https://github.com/${{ matrix.repo }}/@${{ matrix.branch }} - - - uses: seanmiddleditch/gha-setup-vsdevenv@v4 - + run: clang-tools -install ${{ matrix.clang-version }} --directory ${{ runner.temp }}/llvm + + - name: Setup VS dev env + uses: seanmiddleditch/gha-setup-vsdevenv@v4 + - name: Cache the build artifacts id: cache-build uses: actions/cache@v3 diff --git a/src/demo.hpp b/src/demo.hpp index 7cdecee..2695731 100644 --- a/src/demo.hpp +++ b/src/demo.hpp @@ -9,7 +9,7 @@ class Dummy { public: void *not_usefull(char *str){ useless = str; - return nullptr; + return 0; } }; @@ -37,4 +37,5 @@ class Dummy { struct LongDiff { long diff; -}; \ No newline at end of file + +};