Skip to content

Commit

Permalink
Added code analysis action
Browse files Browse the repository at this point in the history
  • Loading branch information
rimi-itk committed Oct 2, 2023
1 parent 1b9fc14 commit 3313673
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,36 @@ jobs:
run: |
composer coding-standards-check/phpcs
php-code-analysis:
name: PHP code analysis
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [ '8.1' ]
dependency-version: [ prefer-lowest, prefer-stable ]
steps:
- uses: actions/checkout@master
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: json
coverage: none
tools: composer:v2
# https://github.com/shivammathur/setup-php#cache-composer-dependencies
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Code analysis
run: |
./scripts/code-analysis
markdownlint:
runs-on: ubuntu-latest
name: markdownlint
Expand Down
2 changes: 1 addition & 1 deletion scripts/code-analysis
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ echo "Module path: $module_path"
# Work around
# PHP Fatal error: Cannot redeclare drupal_get_filename() (previously declared in /Users/rimi/ITK/github/itk-dev/os2forms_selvbetjening/web/sites/default/modules/os2forms/vendor/drupal/core/includes/bootstrap.inc:190) in /Users/rimi/ITK/github/itk-dev/os2forms_selvbetjening/web/core/includes/bootstrap.inc on line 223
# Remove our non-develop requirements and a develop dependency requiring drupal/core.
docker run --rm --interactive efrecon/jq:1.7 'del(.require, ."require-dev"["drupal/maillog"])' < composer.json >| drupal-module-code-analysis-composer.json
docker run --volume ${PWD}:/app --workdir /app --rm efrecon/jq:1.7 'del(.require, ."require-dev"["drupal/maillog"])' composer.json >| drupal-module-code-analysis-composer.json

# It seems that the file system needs a little time to sync.
sleep 1
Expand Down

0 comments on commit 3313673

Please sign in to comment.