Make WordPress Core


Ignore:
Timestamp:
03/07/2023 07:36:29 PM (3 years ago)
Author:
desrosj
Message:

Build/Test Tools: Backport updates to GitHub Actions.

This backports several changesets to GitHub Actions workflows. These changesets:

  • address the deprecated notices related to save-output and set-output to ensure the workflows continue to run after these are removed.
  • adds support for automatically retrying a failed workflow once.
  • backports some Docker environment related tooling updates for the sake of consistency across branches.

Merges [53628], [53636], [53736], [53737], [53895], [53940], [53947], [54039], [54096], [54108], [54293], [54297], [54313], [54342], [54343], [54371], [54373], [54511], [54649], [54650], [54674], [54678], [54750], [54851], [54852], [54856], [54921], [55152] to the 6.0 branch.
See 55702, #52708, #55652, #55652, #55700, #55652, #56407, #56407, #56528, #55652, #55652, #55652, #54695, #55652, #55652, #55652, #55652, #56820, #56820, #56816, #55652, #55652, #56820, #56793, #56793, #53841, #57148, #57572, #56682.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/6.0/.github/workflows/coding-standards.yml

    r53595 r55482  
    2121      - '**.js'
    2222      - '**.php'
    23       # These files configure NPM. Changes could affect the outcome.
     23      # These files configure npm. Changes could affect the outcome.
    2424      - 'package*.json'
    2525      # These files configure Composer. Changes could affect the outcome.
     
    4848  # - Checks out the repository.
    4949  # - Sets up PHP.
    50   # - Logs debug information.
    5150  # - Configures caching for PHPCS scans.
    52   # - Installs Composer dependencies (use cache if possible).
     51  # - Installs Composer dependencies.
    5352  # - Make Composer packages available globally.
    54   # - Logs PHP_CodeSniffer debug information.
    5553  # - Runs PHPCS on the full codebase with warnings suppressed.
     54  # - Generate a report for displaying issues as pull request annotations.
    5655  # - Runs PHPCS on the `tests` directory without warnings suppressed.
     56  # - Generate a report for displaying `test` directory issues as pull request annotations.
    5757  # - Ensures version-controlled files are not modified or deleted.
    5858  phpcs:
     
    6464    steps:
    6565      - name: Checkout repository
    66         uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
     66        uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    6767
    6868      - name: Set up PHP
    69         uses: shivammathur/setup-php@3eda58347216592f618bb1dff277810b6698e4ca # v2.19.1
     69        uses: shivammathur/setup-php@8e2ac35f639d3e794c1da1f28999385ab6fdf0fc # v2.23.0
    7070        with:
    7171          php-version: '7.4'
    7272          coverage: none
    73           tools: composer, cs2pr
    74 
    75       - name: Log debug information
    76         run: |
    77           php --version
    78           composer --version
     73          tools: cs2pr
    7974
    8075      # This date is used to ensure that the PHPCS cache is cleared at least once every week.
     
    8277      - name: "Get last Monday's date"
    8378        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
    8580
    8681      - 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
    9087          key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }}
    9188
     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.
    9291      - name: Install Composer dependencies
    93         uses: ramsey/composer-install@f680dac46551dffb2234a240d65ae806c2999dd6 # v2.1.0
    94         with:
    95           composer-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 }}
    9695
    9796      - name: Make Composer packages available globally
    9897        run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
    9998
    100       - name: Log PHPCS debug information
    101         run: phpcs -i
    102 
    10399      - 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
    105106
    106107      - 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
    108114
    109115      - name: Ensure version-controlled files are not modified during the tests
     
    116122  # Performs the following steps:
    117123  # - Checks out the repository.
     124  # - Sets up Node.js.
    118125  # - Logs debug information about the GitHub Action runner.
    119   # - Installs NodeJS.
    120   # - Logs updated debug information.
    121   # _ Installs NPM dependencies.
     126  # - Installs npm dependencies.
    122127  # - Run the WordPress JSHint checks.
    123128  # - Ensures version-controlled files are not modified or deleted.
     
    132137    steps:
    133138      - 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
    135146
    136147      - name: Log debug information
     
    141152          svn --version
    142153
    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
    155155        run: npm ci
    156156
     
    173173      SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
    174174      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.