forked from php/pecl-php-blenc
-
Notifications
You must be signed in to change notification settings - Fork 6
46 lines (42 loc) · 1.5 KB
/
code-format.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
name: Test code formating guidelines
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test-code-format:
runs-on: "ubuntu-latest"
container: "ubuntu:23.04"
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