FreeBSD via Vagrant allows reuse of existing actions #198
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Lint | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
- develop | |
jobs: | |
astyle: | |
name: Lint with `astyle` | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Provision environment | |
uses: ./.github/actions/dependencies/install/apt-get | |
with: | |
packages: 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: | | |
ASTYLE_OUTPUT=$(${ASTYLE_CMD} --dry-run) | |
if [ -n "$(echo "${ASTYLE_OUTPUT}" | grep -v "Unchanged")" ]; then | |
echo "The following files are in need of formatting:" | |
echo "${ASTYLE_OUTPUT}" | grep -v "Unchanged" | awk '{print "\t"$2}' | |
echo "Run the following command before submitting a pull request:" | |
printf "\t${ASTYLE_CMD}\n" | tr -s ' ' | |
exit 1 | |
fi |