Skip to content

Commit

Permalink
Add composer validate and normalize checks
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbalandan committed Aug 7, 2024
1 parent e9a1903 commit 9a6cfea
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion .github/workflows/static-code-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ jobs:
run: |
echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_OUTPUT
- name: Get packages' directories
id: components
run: |
echo COMPONENTS=$(find src/Nexus -mindepth 2 -type f -name composer.json | cut -d '/' -f 1-3 | sort -fh) >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
Expand All @@ -51,7 +56,41 @@ jobs:
${{ github.workflow }}-PHP_${{ matrix.php-version }}-
- name: Install dependencies
run: composer update --ansi
run: |
composer update --ansi
composer global require --ansi ergebnis/composer-normalize
- name: Check - Composer validate
run: |
validate() {
local exit=0
OUTPUT=$(bash -xc "composer validate --strict --ansi --working-dir $1 2>&1") || exit=$?
printf "::group::$1\n"
echo $OUTPUT
printf "::endgroup::"
}
export -f validate
validate .
echo "${{ steps.components.outputs.COMPONENTS }}[@]" | xargs -n1 validate {}
- name: Check - Composer normalize
run: |
normalize() {
local exit=0
OUTPUT=$(bash -xc "composer normalize --dry-run --diff --ansi --working-dir $1 2>&1") || exit=$?
printf "::group::$1\n"
echo $OUTPUT
printf "::endgroup::"
exit $?
}
export -f normalize
normalize .
echo "${{ steps.components.outputs.COMPONENTS }}[@]" | xargs -n1 normalize {}
- name: Check - file permissions
run: bin/check-file-permissions
Expand Down

0 comments on commit 9a6cfea

Please sign in to comment.