forked from php/pecl-php-blenc
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from illuusio/code-format
Code formating for C and PHP code
- Loading branch information
Showing
8 changed files
with
981 additions
and
922 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
name: Test code formating guidelines | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
test-code-format: | ||
runs-on: "ubuntu-latest" | ||
container: "ubuntu:22.10" | ||
|
||
env: | ||
DEBIAN_FRONTEND: "noninteractive" | ||
TZ: "Etc/GMT" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Link correct timezone to '/etc/localtime' | ||
run: ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
- name: Run 'apt update' | ||
run: apt update | ||
- name: Install astyle | ||
run: apt install -y astyle php-codesniffer | ||
- name: Test code formating with astyle | ||
run: astyle --indent=spaces=4 --style=1tbs --max-code-length=120 --lineend=linux --align-pointer=name --align-reference=name --add-braces --formatted --convert-tabs --break-after-logical --pad-oper --break-blocks=all --indent-col1-comments *.c *.h > c_format_output.txt | ||
- name: Test code formating with PHPCS | ||
run: phpcs tools/blencode.php > php_format_output.txt | ||
- name: Test if there is problems | ||
run: | | ||
if [ "$(stat -c %s c_format_output.txt)" != "0" ] | ||
then | ||
echo "These C files are not formated as expected:" | ||
cat c_format_output.txt | ||
exit 1 | ||
fi | ||
if [ "$(stat -c %s php_format_output.txt)" != "0" ] | ||
then | ||
echo "These PHP files are not formated as expected:" | ||
cat php_format_output.txt | ||
exit 1 | ||
fi |
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
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
Oops, something went wrong.