Changeset 58302 for branches/6.2/.github/workflows/coding-standards.yml
- Timestamp:
- 06/03/2024 05:36:35 PM (6 months ago)
- Location:
- branches/6.2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.2
- Property svn:mergeinfo changed
/trunk merged: 57124-57125,57249,57918,58157
- Property svn:mergeinfo changed
-
branches/6.2/.github/workflows/coding-standards.yml
r55487 r58302 41 41 cancel-in-progress: true 42 42 43 # Disable permissions for all available scopes by default. 44 # Any needed permissions should be configured at the job level. 45 permissions: {} 46 43 47 jobs: 44 48 # Runs PHP coding standards checks. 45 #46 # Violations are reported inline with annotations.47 #48 # Performs the following steps:49 # - Checks out the repository.50 # - Sets up PHP.51 # - Configures caching for PHPCS scans.52 # - Installs Composer dependencies.53 # - Make Composer packages available globally.54 # - Runs PHPCS on the full codebase with warnings suppressed.55 # - Generate a report for displaying issues as pull request annotations.56 # - Runs PHPCS on the `tests` directory without warnings suppressed.57 # - Generate a report for displaying `test` directory issues as pull request annotations.58 # - Ensures version-controlled files are not modified or deleted.59 49 phpcs: 60 50 name: PHP coding standards 61 runs-on: ubuntu-latest 62 timeout-minutes: 20 51 uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-php.yml@trunk 52 permissions: 53 contents: read 63 54 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 64 65 steps: 66 - name: Checkout repository 67 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 68 69 - name: Set up PHP 70 uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0 71 with: 72 php-version: '7.4' 73 coverage: none 74 tools: cs2pr 75 76 # This date is used to ensure that the PHPCS cache is cleared at least once every week. 77 # http://man7.org/linux/man-pages/man1/date.1.html 78 - name: "Get last Monday's date" 79 id: get-date 80 run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT 81 82 - name: Cache PHPCS scan cache 83 uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6 84 with: 85 path: | 86 .cache/phpcs-src.json 87 .cache/phpcs-tests.json 88 key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }} 89 90 # Since Composer dependencies are installed using `composer update` and no lock file is in version control, 91 # passing a custom cache suffix ensures that the cache is flushed at least once per week. 92 - name: Install Composer dependencies 93 uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0 94 with: 95 custom-cache-suffix: ${{ steps.get-date.outputs.date }} 96 97 - name: Make Composer packages available globally 98 run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH 99 100 - name: Run PHPCS on all Core files 101 id: phpcs-core 102 run: phpcs -n --report-full --cache=./.cache/phpcs-src.json --report-checkstyle=./.cache/phpcs-report.xml 103 104 - name: Show PHPCS results in PR 105 if: ${{ always() && steps.phpcs-core.outcome == 'failure' }} 106 run: cs2pr ./.cache/phpcs-report.xml 107 108 - name: Check test suite files for warnings 109 id: phpcs-tests 110 run: phpcs tests --report-full --cache=./.cache/phpcs-tests.json --report-checkstyle=./.cache/phpcs-tests-report.xml 111 112 - name: Show test suite scan results in PR 113 if: ${{ always() && steps.phpcs-tests.outcome == 'failure' }} 114 run: cs2pr ./.cache/phpcs-tests-report.xml 115 116 - name: Ensure version-controlled files are not modified during the tests 117 run: git diff --exit-code 55 with: 56 php-version: '7.4' 118 57 119 58 # Runs the JavaScript coding standards checks. 120 #121 # JSHint violations are not currently reported inline with annotations.122 #123 # Performs the following steps:124 # - Checks out the repository.125 # - Sets up Node.js.126 # - Logs debug information about the GitHub Action runner.127 # - Installs npm dependencies.128 # - Run the WordPress JSHint checks.129 # - Ensures version-controlled files are not modified or deleted.130 59 jshint: 131 60 name: JavaScript coding standards 132 runs-on: ubuntu-latest 133 timeout-minutes: 20 61 uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-javascript.yml@trunk 62 permissions: 63 contents: read 134 64 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 135 env:136 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}137 138 steps:139 - name: Checkout repository140 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0141 142 - name: Set up Node.js143 uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0144 with:145 node-version-file: '.nvmrc'146 cache: npm147 148 - name: Log debug information149 run: |150 npm --version151 node --version152 git --version153 svn --version154 155 - name: Install npm Dependencies156 run: npm ci157 158 - name: Run JSHint159 run: npm run grunt jshint160 161 - name: Ensure version-controlled files are not modified or deleted162 run: git diff --exit-code163 65 164 66 slack-notifications: 165 67 name: Slack Notifications 166 68 uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk 69 permissions: 70 actions: read 71 contents: read 167 72 needs: [ phpcs, jshint ] 168 73 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} … … 178 83 name: Failed workflow tasks 179 84 runs-on: ubuntu-latest 85 permissions: 86 actions: write 180 87 needs: [ phpcs, jshint, slack-notifications ] 181 88 if: |
Note: See TracChangeset
for help on using the changeset viewer.