Changeset 58357 for branches/6.0/.github/workflows/coding-standards.yml
- Timestamp:
- 06/06/2024 03:27:31 PM (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.0/.github/workflows/coding-standards.yml
r55490 r58357 10 10 - '[4-9].[0-9]' 11 11 tags: 12 - '3.[89]*' 13 - '[4-9].[0-9]*' 12 - '[0-9]+.[0-9]' 13 - '[0-9]+.[0-9].[0-9]+' 14 - '!3.7.[0-9]+' 14 15 pull_request: 15 16 branches: … … 40 41 cancel-in-progress: true 41 42 43 # Disable permissions for all available scopes by default. 44 # Any needed permissions should be configured at the job level. 45 permissions: {} 46 42 47 jobs: 43 48 # Runs PHP coding standards checks. 44 #45 # Violations are reported inline with annotations.46 #47 # Performs the following steps:48 # - Checks out the repository.49 # - Sets up PHP.50 # - Configures caching for PHPCS scans.51 # - Installs Composer dependencies.52 # - Make Composer packages available globally.53 # - Runs PHPCS on the full codebase with warnings suppressed.54 # - Generate a report for displaying issues as pull request annotations.55 # - Runs PHPCS on the `tests` directory without warnings suppressed.56 # - Generate a report for displaying `test` directory issues as pull request annotations.57 # - Ensures version-controlled files are not modified or deleted.58 49 phpcs: 59 50 name: PHP coding standards 60 runs-on: ubuntu-latest 61 timeout-minutes: 20 51 uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-php.yml@trunk 52 permissions: 53 contents: read 62 54 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 63 64 steps: 65 - name: Checkout repository 66 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 67 68 - name: Set up PHP 69 uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0 70 with: 71 php-version: '7.4' 72 coverage: none 73 tools: cs2pr 74 75 # This date is used to ensure that the PHPCS cache is cleared at least once every week. 76 # http://man7.org/linux/man-pages/man1/date.1.html 77 - name: "Get last Monday's date" 78 id: get-date 79 run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT 80 81 - name: Cache PHPCS scan cache 82 uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6 83 with: 84 path: | 85 .cache/phpcs-src.json 86 .cache/phpcs-tests.json 87 key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }} 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. 91 - name: Install Composer dependencies 92 uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0 93 with: 94 custom-cache-suffix: ${{ steps.get-date.outputs.date }} 95 96 - name: Make Composer packages available globally 97 run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH 98 99 - name: Run PHPCS on all Core files 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 106 107 - name: Check test suite files for warnings 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 114 115 - name: Ensure version-controlled files are not modified during the tests 116 run: git diff --exit-code 55 with: 56 php-version: '7.4' 117 57 118 58 # Runs the JavaScript coding standards checks. 119 #120 # JSHint violations are not currently reported inline with annotations.121 #122 # Performs the following steps:123 # - Checks out the repository.124 # - Sets up Node.js.125 # - Logs debug information about the GitHub Action runner.126 # - Installs npm dependencies.127 # - Run the WordPress JSHint checks.128 # - Ensures version-controlled files are not modified or deleted.129 59 jshint: 130 60 name: JavaScript coding standards 131 runs-on: ubuntu-latest 132 timeout-minutes: 20 61 uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-javascript.yml@trunk 62 permissions: 63 contents: read 133 64 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 134 env:135 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}136 137 steps:138 - name: Checkout repository139 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0140 141 - name: Set up Node.js142 uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0143 with:144 node-version-file: '.nvmrc'145 cache: npm146 147 - name: Log debug information148 run: |149 npm --version150 node --version151 git --version152 svn --version153 154 - name: Install npm Dependencies155 run: npm ci156 157 - name: Run JSHint158 run: npm run grunt jshint159 160 - name: Ensure version-controlled files are not modified or deleted161 run: git diff --exit-code162 65 163 66 slack-notifications: 164 67 name: Slack Notifications 165 68 uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk 69 permissions: 70 actions: read 71 contents: read 166 72 needs: [ phpcs, jshint ] 167 73 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} … … 177 83 name: Failed workflow tasks 178 84 runs-on: ubuntu-latest 85 permissions: 86 actions: write 179 87 needs: [ phpcs, jshint, slack-notifications ] 180 88 if: | … … 190 98 steps: 191 99 - name: Dispatch workflow run 192 uses: actions/github-script@ 98814c53be79b1d30f795b907e553d8679345975 # v6.4.0100 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 193 101 with: 194 102 retries: 2
Note: See TracChangeset
for help on using the changeset viewer.