Skip to content

Commit

Permalink
Update format check action and call it from test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
aggarw13 committed Dec 23, 2020
1 parent 177ee1c commit bf9e7fb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ on:


jobs:
test-format-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
repository: FreeRTOS/coreMQTT
ref: main
path: coreMQTT
- name: Test formatting check action
uses: ./formatting
with:
path: coreMQTT
test-complexity-check:
runs-on: ubuntu-latest
steps:
Expand Down
16 changes: 12 additions & 4 deletions formatting/action.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
name: 'formatting'
description: 'CI formatting check'
inputs:
path-to-repo:
description: 'Path to repository folder'
path:
description: 'Path to repository folder to run formatting check for.'
required: false
default: ./
runs:
using: "composite"
steps:
- name: Install Uncrustify
run: sudo apt-get install uncrustify
shell: bash
- name: Run Uncrustify
run: find . -iname "*.[hc]" -exec uncrustify --check -c tools/uncrustify.cfg {} +
run: |
cd ${{ inputs.path }}
find . -iname "*.[hc]" -exec uncrustify --check -c tools/uncrustify.cfg {} +
shell: bash
- name: Check For Trailing Whitespace
run: |
cd ${{ inputs.path }}
set +e
grep --exclude="README.md" -rnI -e "[[:blank:]]$" .
if [ "$?" = "0" ]; then
Expand All @@ -22,13 +27,16 @@ runs:
else
exit 0
fi
shell: bash
- name: Check for CRLF
run: |
cd ${{ inputs.path }}
set +e
find . -path ./.git -prune -o -exec file {} + | grep "CRLF"
if [ "$?" = "0" ]; then
echo "Files have CRLF line endings."
exit 1
else
exit 0
fi
fi
shell: bash

0 comments on commit bf9e7fb

Please sign in to comment.