VACMS-16882: Resolves Error: Call to a member function getValue() on null #5838
Workflow file for this run
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
name: Continuous Integration | |
on: | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
permissions: | |
pull-requests: write | |
issues: write | |
jobs: | |
# Check whether certain fields exist in the CMS configuration. | |
check-fields: | |
name: Check Fields | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Check Corresponding Entity Reference Fields | |
# See also `composer va:test:check-cer` in composer.json | |
run: ./tests/scripts/check-cer.sh | |
- name: Check Revision Log fields | |
# See also `composer va:test:check-node-revision-logs` in composer.json | |
# See also `composer va:test:check-taxonomy-revision-logs` in composer.json | |
run: | | |
./tests/scripts/check-node-revision-logs.sh | |
./tests/scripts/check-taxonomy-revision-logs.sh | |
# Validate that the `composer.lock` hash is up-to-date. | |
composer-validate: | |
name: Composer Validate | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Composer Validate | |
run: composer validate | |
# Check style of ES/JS files with ESLint and ReviewDog. | |
eslint: | |
name: ESLint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Post-Checkout Actions | |
uses: ./.github/actions/post-checkout | |
- name: ReviewDog | |
# See also `composer va:test:eslint` in composer.json | |
uses: reviewdog/action-eslint@279acb08336462ec76183a2d9ef1dd43e4c6b391 # v1.21.0 | |
with: | |
reporter: github-pr-review | |
eslint_flags: '--max-warnings 0 -c .eslintrc.json --no-eslintrc docroot/modules/custom/**/*.es6.js docroot/themes/custom/**/*.es6.js tests/cypress/**/*.js' | |
fail_on_error: true | |
# Check for common PHP code smells with PHP_CodeSniffer. | |
php_codesniffer: | |
name: PHP_CodeSniffer | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Post-Checkout Actions | |
uses: ./.github/actions/post-checkout | |
- name: Run PHP_CodeSniffer and ReviewDog | |
# See also `composer va:test:php_codesniffer` in composer.json | |
run: | | |
export REVIEWDOG_GITHUB_API_TOKEN="${GITHUB_TOKEN}" | |
bin/phpcs \ | |
--report="checkstyle" \ | |
-q \ | |
| reviewdog \ | |
-name="PHP_CodeSniffer" \ | |
-f=checkstyle \ | |
-reporter=github-pr-review \ | |
-diff='git diff' | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
# Lint with PHP's built-in linting. | |
php_lint: | |
name: PHP Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Post-Checkout Actions | |
uses: ./.github/actions/post-checkout | |
- name: Run PHPLint | |
# See also `composer va:test:lint-php` in composer.json | |
run: ./tests/scripts/lint-php.sh | |
# Analyze the codebase for programming errors with PHPStan. | |
phpstan: | |
name: PHPStan | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Post-Checkout Actions | |
uses: ./.github/actions/post-checkout | |
- name: Run PHPStan and ReviewDog | |
# See also `composer va:test:phpstan` in composer.json | |
run: | | |
bin/phpstan analyze \ | |
--no-progress \ | |
--no-interaction \ | |
--error-format=raw \ | |
--memory-limit=1G \ | |
| reviewdog \ | |
-name="PHPStan" \ | |
-f=phpstan \ | |
-reporter=github-pr-review \ | |
-fail-on-error=true \ | |
-diff='git diff' \ | |
-tee | |
env: | |
REVIEWDOG_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
# Run unit tests against codebase with PHPUnit. | |
phpunit: | |
name: PHPUnit | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Post-Checkout Actions | |
uses: ./.github/actions/post-checkout | |
- name: Run PHPUnit (Unit Tests only) | |
# See also `composer va:test:phpunit-unit` in composer.json | |
run: bin/phpunit \ | |
--group unit \ | |
--exclude-group disabled \ | |
--coverage-text \ | |
tests/phpunit | |
# Check styles of modules and themes with Stylelint. | |
stylelint: | |
name: Stylelint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Stylelint modules | |
# See also `composer va:test:stylelint-modules` in composer.json | |
uses: reviewdog/action-stylelint@548276a94275c7865effa8d72fa8b6983d9f47c4 # v1.18.1 | |
with: | |
fail_on_error: true | |
github_token: ${{ secrets.github_token }} | |
packages: 'stylelint-config-sass-guidelines stylelint-order' | |
reporter: github-pr-review | |
stylelint_config: '.stylelintrc' | |
stylelint_input: 'docroot/modules/custom/**/*.css' | |
- name: Stylelint themes | |
# See also `composer va:test:stylelint-themes` in composer.json | |
uses: reviewdog/action-stylelint@548276a94275c7865effa8d72fa8b6983d9f47c4 # v1.18.1 | |
with: | |
fail_on_error: true | |
github_token: ${{ secrets.github_token }} | |
packages: 'stylelint-config-sass-guidelines stylelint-order' | |
reporter: github-pr-review | |
stylelint_config: '.stylelintrc' | |
stylelint_input: 'docroot/themes/custom/**/*.scss' | |
# Warn strongly if the `composer.lock` lines changed exceed a threshold. | |
check-composer-lock-changes: | |
name: Check composer.lock changes | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Delete any existing comment. | |
uses: thollander/actions-comment-pull-request@1d3973dc4b8e1399c0620d3f2b1aa5e795465308 # v2.4.3 | |
continue-on-error: true | |
with: | |
comment_tag: check-composer-lock-changes | |
mode: delete | |
message: | | |
Checking composer.lock changes... | |
- name: Check changes in composer.lock. | |
run: | | |
LINES_CHANGED=$(git diff --numstat origin/main..HEAD -- composer.lock | awk '{print $1+$2}') | |
THRESHOLD=200 | |
>&2 echo "LINES CHANGED=$LINES_CHANGED" | |
>&2 echo "THRESHOLD=$THRESHOLD" | |
echo "LINES_CHANGED=$LINES_CHANGED" >> $GITHUB_ENV | |
echo "THRESHOLD=$THRESHOLD" >> $GITHUB_ENV | |
- name: Comment if composer.lock changes exceed threshold. | |
uses: thollander/actions-comment-pull-request@1d3973dc4b8e1399c0620d3f2b1aa5e795465308 # v2.4.3 | |
if: env.LINES_CHANGED > env.THRESHOLD | |
continue-on-error: true | |
with: | |
comment_tag: check-composer-lock-changes | |
message: | | |
The number of lines changed in composer.lock exceeds the acceptable threshold. | |
- Lines changed: ${{ env.LINES_CHANGED }} | |
- Threshold: ${{ env.THRESHOLD }} | |
This is a warning only. Please review the changes and ensure that they are acceptable. |