ci: combine lint-clang and lint-error into lint-check
This commit is contained in:
@ -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<<EOF
|
||||
❌ \`${{ inputs.format-tool }}\`: It looks like your changes don't match our code style.
|
||||
❌ \`clang-format\`: It looks like your changes don't match our code style.
|
||||
|
||||
🛠️ Please either run \`${{ inputs.format-command }}\` or apply this patch with \`git apply\`:
|
||||
🛠️ Please either run \`clang-format -i\` on the file or apply this patch with \`git apply\`:
|
||||
|
||||
[\`${{ steps.changes.outputs.file }}\`](${{ steps.upload.outputs.artifact-url }})
|
||||
$code_block diff
|
||||
@ -67,7 +62,7 @@ runs:
|
||||
echo "$summary" >> $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
|
||||
|
||||
16
.github/actions/lint-clang/action.yml
vendored
16
.github/actions/lint-clang/action.yml
vendored
@ -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"
|
||||
16
.github/workflows/continuous-integration.yml
vendored
16
.github/workflows/continuous-integration.yml
vendored
@ -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
|
||||
|
||||
Reference in New Issue
Block a user