Form Engine: Integration Branch (2) #8622
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] | |
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Post-Checkout Actions | |
uses: ./.github/actions/post-checkout | |
- name: ReviewDog | |
# See also `composer va:test:eslint` in composer.json | |
uses: reviewdog/action-eslint@9b5b0150e399e1f007ee3c27bc156549810a64e3 # v1.33.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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Stylelint modules | |
# See also `composer va:test:stylelint-modules` in composer.json | |
uses: reviewdog/action-stylelint@3957468a0ecd893d96e59774122c860fa98b0f82 # v1.30.0 | |
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@3957468a0ecd893d96e59774122c860fa98b0f82 # v1.30.0 | |
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Delete any existing comment. | |
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1 | |
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@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1 | |
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. |