From 8b25e11f81ea87165f930a6580a0a3ef089869df Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Wed, 18 Dec 2024 15:31:27 -0500 Subject: [PATCH] ci: combine lint-clang and lint-error into lint-check --- .../{lint-error => lint-check}/action.yml | 29 ++++++++----------- .github/actions/lint-clang/action.yml | 16 ---------- .github/workflows/continuous-integration.yml | 16 +++++----- 3 files changed, 20 insertions(+), 41 deletions(-) rename .github/actions/{lint-error => lint-check}/action.yml (69%) delete mode 100644 .github/actions/lint-clang/action.yml diff --git a/.github/actions/lint-error/action.yml b/.github/actions/lint-check/action.yml similarity index 69% rename from .github/actions/lint-error/action.yml rename to .github/actions/lint-check/action.yml index 040aad6ce..5d626f4e7 100644 --- a/.github/actions/lint-error/action.yml +++ b/.github/actions/lint-check/action.yml @@ -1,26 +1,21 @@ -name: "Lint error" +name: "Lint Check" description: "Checks for lint errors and posts a helpful comment" -inputs: - format-command: - description: "The command to run to fix lint errors" - required: true - - format-tool: - description: "The name of the linting tool" - required: true - runs: using: "composite" steps: + - name: Install Dependencies + run: pipx install --global clang_format + shell: bash + - name: Run format command - run: ${{ inputs.format-command }} + run: find src/ -regex '.*\.\(cpp\|hpp\|cc\|cxx\|h\|c\|m\|mm\)' -exec clang-format -style=file --assume-filename=$(pwd)/.clang-format -i {} \; shell: bash - name: Find changes id: changes run: | - file=${{ inputs.format-tool }}.diff + file=clang-format.diff diff=$(git diff | tee $file) if [ -z "$diff" ]; then @@ -43,7 +38,7 @@ runs: if: steps.changes.outputs.diff uses: actions/upload-artifact@v4 with: - name: ${{ inputs.format-tool }}-diff + name: clang-format-diff path: ${{ steps.changes.outputs.file }} if-no-files-found: error @@ -54,9 +49,9 @@ runs: code_block="\`\`\`" summary=$(cat<> $GITHUB_STEP_SUMMARY file="ci_summary.md" - echo "❌🛠️ \`${{ inputs.format-tool }}\`: Lint errors, fix available." >> $file + echo "❌🛠️ \`clang-format\`: Lint errors, fix available." >> $file echo "file=$file" >> $GITHUB_OUTPUT shell: bash @@ -75,7 +70,7 @@ runs: if: steps.summary.outputs.file uses: actions/upload-artifact@v4 with: - name: summary-${{ inputs.format-tool }} + name: summary-clang-format path: ${{ steps.summary.outputs.file }} if-no-files-found: error diff --git a/.github/actions/lint-clang/action.yml b/.github/actions/lint-clang/action.yml deleted file mode 100644 index a7664fa80..000000000 --- a/.github/actions/lint-clang/action.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: "Lint clang" -description: "Lint with Clang formatter" - -runs: - using: "composite" - - steps: - - name: Install dependencies - shell: bash - run: pipx install --global clang_format - - - name: Linting with Clang formatter - uses: ./.github/actions/lint-error - with: - format-command: find src/ -regex '.*\.\(cpp\|hpp\|cc\|cxx\|h\|c\|m\|mm\)' -exec clang-format -style=file --assume-filename=$(pwd)/.clang-format -i {} \; - format-tool: "clang-format" diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index da0d6745b..620271524 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -34,7 +34,7 @@ jobs: # Always run this job, even if not on PR, since other jobs need it. pr-comment-flags: runs-on: ubuntu-latest - needs: lint-clang + needs: lint-check outputs: no-sonar: ${{ steps.check.outputs.no-sonar }} @@ -82,7 +82,7 @@ jobs: - name: Test summary uses: ./.github/actions/test-summary - lint-clang: + lint-check: runs-on: ubuntu-latest timeout-minutes: 5 @@ -90,11 +90,11 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Linting Clang - uses: ./.github/actions/lint-clang + - name: Lint Checker + uses: ./.github/actions/lint-check analyse-valgrind: - needs: lint-clang + needs: lint-check if: ${{ github.event_name == 'pull_request' }} uses: ./.github/workflows/valgrind-analysis.yml @@ -106,7 +106,7 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} main-build: - needs: lint-clang + needs: lint-check name: ${{ matrix.target.name }} runs-on: ${{ matrix.target.runs-on }} container: ${{ matrix.target.container }} @@ -242,7 +242,7 @@ jobs: # Technically, "unix" is a misnomer, but we use it here to mean "Unix-like BSD-derived". unix: - needs: lint-clang + needs: lint-check name: unix-${{ matrix.distro.name }} runs-on: ${{ vars.CI_UNIX_RUNNER || 'ubuntu-24.04' }} timeout-minutes: 20 @@ -275,7 +275,7 @@ jobs: ./build/bin/unittests ./build/bin/integtests || true flatpak: - needs: lint-clang + needs: lint-check runs-on: ubuntu-latest container: image: bilelmoussaoui/flatpak-github-actions:kde-6.7