Skip to content

Commit 8df1d5c

Browse files
Inline pint and phpcs
1 parent c843378 commit 8df1d5c

File tree

1 file changed

+60
-3
lines changed

1 file changed

+60
-3
lines changed

.github/workflows/tests.yml

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,64 @@ jobs:
6060
uses: sudo-bot/action-scrutinizer@latest
6161
with:
6262
cli-args: "--format=php-clover tests/reports/clover.xml --revision=${{ github.event.pull_request.head.sha || github.sha }}"
63+
phpcs:
64+
runs-on: ubuntu-latest
65+
steps:
66+
- name: Checkout
67+
uses: actions/checkout@v4
68+
69+
- name: Setup PHP
70+
uses: shivammathur/setup-php@v2
71+
with:
72+
php-version: 8.4
73+
tools: cs2pr, phpcs
74+
75+
- name: Setup phpcs config
76+
run: |
77+
{
78+
echo '<?xml version="1.0"?>'
79+
echo '<ruleset name="DD Detection Standard">'
80+
echo '<description>Detects and fails for dd found in code.</description>'
81+
echo '<arg name="colors"/>'
82+
echo '<arg value="n"/>'
83+
echo '<rule ref="Generic.PHP.ForbiddenFunctions">'
84+
echo '<properties>'
85+
echo '<property name="forbiddenFunctions" type="array">'
86+
echo '<element key="dd" value="null"/>'
87+
echo '</property>'
88+
echo '</properties>'
89+
echo '</rule>'
90+
echo '</ruleset>'
91+
} > custom_phpcs_style.xml
92+
93+
- name: Run PHP CS Fixer
94+
run: |
95+
(phpcs --standard=custom_phpcs_style.xml --report=checkstyle ${{ inputs.dir }} | cs2pr) || true
96+
phpcs --standard=custom_phpcs_style.xml ${{ inputs.dir }}
6397
pint:
64-
uses: intouchinsight/github-workflows/.github/workflows/laravel-pint.yml@main
65-
with:
66-
php_version: '8.3'
98+
runs-on: ubuntu-latest
99+
steps:
100+
- name: Checkout
101+
uses: actions/checkout@v4
102+
103+
- name: Find pint version
104+
id: find_pint_version
105+
run: |
106+
PINT_VERSION='v1.13'
107+
echo "Attempting to load pint version from composer.lock"
108+
if [ -f composer.lock ]; then
109+
PINT_VERSION=$(jq '.["packages-dev"][] | select(.name == "laravel/pint") | .version' composer.lock)
110+
fi
111+
echo "Found pint version: $PINT_VERSION"
112+
echo "PINT_VERSION=$PINT_VERSION" >> $GITHUB_OUTPUT
113+
114+
- name: Setup PHP
115+
uses: shivammathur/setup-php@v2
116+
with:
117+
php-version: 8.4
118+
tools: cs2pr, pint:${{ steps.find_pint_version.outputs.PINT_VERSION }}
119+
120+
- name: Run pint
121+
run: |
122+
(pint --test --format=checkstyle | cs2pr) || true
123+
pint --test -v --ansi

0 commit comments

Comments
 (0)