mirror of
https://github.com/openstreetmap/mod_tile.git
synced 2025-08-03 07:49:53 +00:00
Upload astyle formatting patch file as artifact during CI pipeline run (#353)
This commit is contained in:
52
.github/workflows/lint.yml
vendored
52
.github/workflows/lint.yml
vendored
@ -7,6 +7,20 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
astyle:
|
astyle:
|
||||||
|
env:
|
||||||
|
ASTYLE_CMD: >-
|
||||||
|
astyle
|
||||||
|
--break-blocks
|
||||||
|
--indent-switches
|
||||||
|
--indent=force-tab=8
|
||||||
|
--lineend=linux
|
||||||
|
--options=none
|
||||||
|
--pad-header
|
||||||
|
--pad-oper
|
||||||
|
--style=1tbs
|
||||||
|
--suffix=none
|
||||||
|
--unpad-paren
|
||||||
|
includes/*.h includes/*.hpp src/*.c src/*.cpp
|
||||||
name: Lint with `Artistic Style`
|
name: Lint with `Artistic Style`
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@ -17,29 +31,35 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
packages: astyle
|
packages: astyle
|
||||||
- name: Check if any modifications were made by `astyle`
|
- name: Check if any modifications were made by `astyle`
|
||||||
env:
|
|
||||||
ASTYLE_CMD: >-
|
|
||||||
astyle
|
|
||||||
--break-blocks
|
|
||||||
--indent-switches
|
|
||||||
--indent=force-tab=8
|
|
||||||
--lineend=linux
|
|
||||||
--options=none
|
|
||||||
--pad-header
|
|
||||||
--pad-oper
|
|
||||||
--style=1tbs
|
|
||||||
--suffix=none
|
|
||||||
--unpad-paren
|
|
||||||
includes/*.h includes/*.hpp src/*.c src/*.cpp
|
|
||||||
run: |
|
run: |
|
||||||
ASTYLE_OUTPUT=$(${ASTYLE_CMD} --dry-run)
|
ASTYLE_OUTPUT=$(${ASTYLE_CMD} --dry-run)
|
||||||
if [ -n "$(echo "${ASTYLE_OUTPUT}" | grep -v "Unchanged")" ]; then
|
if [ -n "$(echo "${ASTYLE_OUTPUT}" | grep -v "Unchanged")" ]; then
|
||||||
echo "The following files are in need of formatting:"
|
echo "The following files are in need of formatting:"
|
||||||
echo "${ASTYLE_OUTPUT}" | grep -v "Unchanged" | awk '{print "\t"$2}'
|
echo "${ASTYLE_OUTPUT}" | grep -v "Unchanged" | awk '{print "`"$2"`"}'
|
||||||
|
echo ""
|
||||||
echo "Run the following command before submitting a pull request:"
|
echo "Run the following command before submitting a pull request:"
|
||||||
printf "\t${ASTYLE_CMD}\n" | tr -s ' '
|
echo '`'"${ASTYLE_CMD}"'`'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
- name: Write `$ASTYLE_OUTPUT` to `$GITHUB_STEP_SUMMARY`
|
||||||
|
if: failure()
|
||||||
|
run: |
|
||||||
|
ASTYLE_OUTPUT=$(${ASTYLE_CMD} --dry-run)
|
||||||
|
echo "### The following files are in need of formatting:" >> ${GITHUB_STEP_SUMMARY}
|
||||||
|
echo "${ASTYLE_OUTPUT}" | grep -v "Unchanged" | awk '{print "- `"$2"`"}' >> ${GITHUB_STEP_SUMMARY}
|
||||||
|
echo "### Run the following command before submitting a pull request:" >> ${GITHUB_STEP_SUMMARY}
|
||||||
|
echo -e '```shell\n'"${ASTYLE_CMD}"'\n```' >> ${GITHUB_STEP_SUMMARY}
|
||||||
|
- name: Generate `ArtisticStyleFormattingFixes.patch` file
|
||||||
|
if: failure()
|
||||||
|
run: |
|
||||||
|
${ASTYLE_CMD}
|
||||||
|
git diff --patch > ArtisticStyleFormattingFixes.patch
|
||||||
|
- name: Upload `ArtisticStyleFormattingFixes.patch` file
|
||||||
|
if: failure()
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ArtisticStyleFormattingFixes.patch
|
||||||
|
path: ArtisticStyleFormattingFixes.patch
|
||||||
|
|
||||||
cmakelint:
|
cmakelint:
|
||||||
name: Lint with `CMakeLint`
|
name: Lint with `CMakeLint`
|
||||||
|
Reference in New Issue
Block a user