Changeset 55482 for branches/6.0/.github/workflows/coding-standards.yml
- Timestamp:
- 03/07/2023 07:36:29 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.0/.github/workflows/coding-standards.yml
r53595 r55482 21 21 - '**.js' 22 22 - '**.php' 23 # These files configure NPM. Changes could affect the outcome.23 # These files configure npm. Changes could affect the outcome. 24 24 - 'package*.json' 25 25 # These files configure Composer. Changes could affect the outcome. … … 48 48 # - Checks out the repository. 49 49 # - Sets up PHP. 50 # - Logs debug information.51 50 # - Configures caching for PHPCS scans. 52 # - Installs Composer dependencies (use cache if possible).51 # - Installs Composer dependencies. 53 52 # - Make Composer packages available globally. 54 # - Logs PHP_CodeSniffer debug information.55 53 # - Runs PHPCS on the full codebase with warnings suppressed. 54 # - Generate a report for displaying issues as pull request annotations. 56 55 # - Runs PHPCS on the `tests` directory without warnings suppressed. 56 # - Generate a report for displaying `test` directory issues as pull request annotations. 57 57 # - Ensures version-controlled files are not modified or deleted. 58 58 phpcs: … … 64 64 steps: 65 65 - name: Checkout repository 66 uses: actions/checkout@ 2541b1294d2704b0964813337f33b291d3f8596b # v3.0.266 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 67 67 68 68 - name: Set up PHP 69 uses: shivammathur/setup-php@ 3eda58347216592f618bb1dff277810b6698e4ca # v2.19.169 uses: shivammathur/setup-php@8e2ac35f639d3e794c1da1f28999385ab6fdf0fc # v2.23.0 70 70 with: 71 71 php-version: '7.4' 72 72 coverage: none 73 tools: composer, cs2pr 74 75 - name: Log debug information 76 run: | 77 php --version 78 composer --version 73 tools: cs2pr 79 74 80 75 # This date is used to ensure that the PHPCS cache is cleared at least once every week. … … 82 77 - name: "Get last Monday's date" 83 78 id: get-date 84 run: echo " ::set-output name=date::$(/bin/date -u --date='last Mon' "+%F")"79 run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT 85 80 86 81 - name: Cache PHPCS scan cache 87 uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4 88 with: 89 path: .cache/phpcs.json 82 uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 83 with: 84 path: | 85 .cache/phpcs-src.json 86 .cache/phpcs-tests.json 90 87 key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }} 91 88 89 # Since Composer dependencies are installed using `composer update` and no lock file is in version control, 90 # passing a custom cache suffix ensures that the cache is flushed at least once per week. 92 91 - name: Install Composer dependencies 93 uses: ramsey/composer-install@ f680dac46551dffb2234a240d65ae806c2999dd6 # v2.1.094 with: 95 c omposer-options: "--no-progress --no-ansi --no-interaction"92 uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0 93 with: 94 custom-cache-suffix: ${{ steps.get-date.outputs.date }} 96 95 97 96 - name: Make Composer packages available globally 98 97 run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH 99 98 100 - name: Log PHPCS debug information101 run: phpcs -i102 103 99 - name: Run PHPCS on all Core files 104 run: phpcs -q -n --report=checkstyle | cs2pr 100 id: phpcs-core 101 run: phpcs -n --report-full --cache=./.cache/phpcs-src.json --report-checkstyle=./.cache/phpcs-report.xml 102 103 - name: Show PHPCS results in PR 104 if: ${{ always() && steps.phpcs-core.outcome == 'failure' }} 105 run: cs2pr ./.cache/phpcs-report.xml 105 106 106 107 - name: Check test suite files for warnings 107 run: phpcs tests -q --report=checkstyle | cs2pr 108 id: phpcs-tests 109 run: phpcs tests --report-full --cache=./.cache/phpcs-tests.json --report-checkstyle=./.cache/phpcs-tests-report.xml 110 111 - name: Show test suite scan results in PR 112 if: ${{ always() && steps.phpcs-tests.outcome == 'failure' }} 113 run: cs2pr ./.cache/phpcs-tests-report.xml 108 114 109 115 - name: Ensure version-controlled files are not modified during the tests … … 116 122 # Performs the following steps: 117 123 # - Checks out the repository. 124 # - Sets up Node.js. 118 125 # - Logs debug information about the GitHub Action runner. 119 # - Installs NodeJS. 120 # - Logs updated debug information. 121 # _ Installs NPM dependencies. 126 # - Installs npm dependencies. 122 127 # - Run the WordPress JSHint checks. 123 128 # - Ensures version-controlled files are not modified or deleted. … … 132 137 steps: 133 138 - name: Checkout repository 134 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 139 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 140 141 - name: Set up Node.js 142 uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 143 with: 144 node-version-file: '.nvmrc' 145 cache: npm 135 146 136 147 - name: Log debug information … … 141 152 svn --version 142 153 143 - name: Install NodeJS 144 uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0 145 with: 146 node-version-file: '.nvmrc' 147 cache: npm 148 149 - name: Log debug information 150 run: | 151 npm --version 152 node --version 153 154 - name: Install Dependencies 154 - name: Install npm Dependencies 155 155 run: npm ci 156 156 … … 173 173 SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }} 174 174 SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }} 175 176 failed-workflow: 177 name: Failed workflow tasks 178 runs-on: ubuntu-latest 179 needs: [ phpcs, jshint, slack-notifications ] 180 if: | 181 always() && 182 github.repository == 'WordPress/wordpress-develop' && 183 github.event_name != 'pull_request' && 184 github.run_attempt < 2 && 185 ( 186 needs.phpcs.result == 'cancelled' || needs.phpcs.result == 'failure' || 187 needs.jshint.result == 'cancelled' || needs.jshint.result == 'failure' 188 ) 189 190 steps: 191 - name: Dispatch workflow run 192 uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0 193 with: 194 retries: 2 195 retry-exempt-status-codes: 418 196 script: | 197 github.rest.actions.createWorkflowDispatch({ 198 owner: context.repo.owner, 199 repo: context.repo.repo, 200 workflow_id: 'failed-workflow.yml', 201 ref: 'trunk', 202 inputs: { 203 run_id: '${{ github.run_id }}' 204 } 205 });
Note: See TracChangeset
for help on using the changeset viewer.