Changeset 53619 for branches/4.2/.github/workflows/test-npm.yml
- Timestamp:
- 06/30/2022 05:21:21 PM (3 years ago)
- Location:
- branches/4.2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.2
- Property svn:mergeinfo changed
/trunk merged: 50704,50930,51341,51355,51498,51511,51535,51921,51924-51925,51937,52002,52130,52183,52233,53112,53581-53582,53592
- Property svn:mergeinfo changed
-
branches/4.2/.github/workflows/test-npm.yml
r50642 r53619 4 4 push: 5 5 branches: 6 - master7 6 - trunk 8 7 - '3.[7-9]' … … 10 9 pull_request: 11 10 branches: 12 - master13 11 - trunk 14 12 - '3.[7-9]' … … 26 24 workflow_dispatch: 27 25 26 # Cancels all previous workflow runs for pull requests that have not completed. 27 concurrency: 28 # The concurrency group contains the workflow name and the branch name for pull requests 29 # or the commit hash for any other events. 30 group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} 31 cancel-in-progress: true 32 28 33 env: 29 34 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }} 30 35 31 36 jobs: 32 # Prepares the workflow.33 #34 # Performs the following steps:35 # - Cancels all previous workflow runs for pull requests that have not completed.36 prepare-workflow:37 name: Prepare the workflow38 runs-on: ubuntu-latest39 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}40 41 steps:42 - name: Cancel previous runs of this workflow (pull requests only)43 if: ${{ github.event_name == 'pull_request' }}44 uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.045 46 37 # Verifies that installing NPM dependencies and building WordPress works as expected. 47 38 # 48 39 # Performs the following steps: 49 40 # - Checks out the repository. 50 # - Logs debug information about the runner container. 51 # - Installs NodeJS 14. 52 # - Sets up caching for NPM. 53 # _ Installs NPM dependencies using install-changed to hash the `package.json` file. 41 # - Logs debug information about the GitHub Action runner. 42 # - Installs NodeJS. 43 # _ Installs NPM dependencies. 54 44 # - Builds WordPress to run from the `build` directory. 55 45 # - Cleans up after building WordPress to the `build` directory. … … 57 47 name: Test NPM on ${{ matrix.os }} 58 48 runs-on: ${{ matrix.os }} 49 timeout-minutes: 20 59 50 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 60 needs: prepare-workflow61 51 strategy: 62 52 fail-fast: false … … 66 56 steps: 67 57 - name: Checkout repository 68 uses: actions/checkout@ 5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.458 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 69 59 70 60 - name: Log debug information … … 77 67 78 68 - name: Install NodeJS 79 uses: actions/setup-node@ 46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.569 uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0 80 70 with: 81 node-version: 14 82 83 - name: Cache NodeJS modules (Ubuntu & MacOS) 84 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 85 if: ${{ matrix.os != 'windows-latest' }} 86 with: 87 path: ~/.npm 88 key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} 89 90 - name: Get NPM cache directory (Windows only) 91 if: ${{ matrix.os == 'windows-latest' }} 92 id: npm-cache 93 run: echo "::set-output name=dir::$(npm config get cache)" 94 95 - name: Cache NodeJS modules (Windows only) 96 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 97 if: ${{ matrix.os == 'windows-latest' }} 98 with: 99 path: ${{ steps.npm-cache.outputs.dir }} 100 key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} 71 node-version-file: '.nvmrc' 72 cache: npm 101 73 102 74 - name: Install Dependencies … … 111 83 # Verifies that installing NPM dependencies and building WordPress works as expected on MacOS. 112 84 # 113 # This is a separate job in order to that more strict conditions can be used. 85 # This is separate from the job above in order to use stricter conditions about when to run. 86 # This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate. 114 87 # 115 88 # Performs the following steps: 116 89 # - Checks out the repository. 117 # - Logs debug information about the runner container. 118 # - Installs NodeJS 14. 119 # - Sets up caching for NPM. 120 # _ Installs NPM dependencies using install-changed to hash the `package.json` file. 90 # - Logs debug information about the GitHub Action runner. 91 # - Installs NodeJS. 92 # _ Installs NPM dependencies. 121 93 # - Builds WordPress to run from the `build` directory. 122 94 # - Cleans up after building WordPress to the `build` directory. … … 125 97 runs-on: macos-latest 126 98 if: ${{ github.repository == 'WordPress/wordpress-develop' }} 127 needs: prepare-workflow128 99 steps: 129 100 - name: Checkout repository 130 uses: actions/checkout@ 5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4101 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 131 102 132 103 - name: Log debug information … … 139 110 140 111 - name: Install NodeJS 141 uses: actions/setup-node@ 46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5112 uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0 142 113 with: 143 node-version: 14 144 145 - name: Cache NodeJS modules 146 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 147 if: ${{ matrix.os != 'windows-latest' }} 148 with: 149 path: ~/.npm 150 key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} 114 node-version-file: '.nvmrc' 115 cache: npm 151 116 152 117 - name: Install Dependencies … … 158 123 - name: Clean after building 159 124 run: npm run grunt clean 125 126 slack-notifications: 127 name: Slack Notifications 128 uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk 129 needs: [ test-npm, test-npm-macos ] 130 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} 131 with: 132 calling_status: ${{ needs.test-npm.result == 'success' && needs.test-npm-macos.result == 'success' && 'success' || ( needs.test-npm.result == 'cancelled' || needs.test-npm-macos.result == 'cancelled' ) && 'cancelled' || 'failure' }} 133 secrets: 134 SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }} 135 SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }} 136 SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }} 137 SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
Note: See TracChangeset
for help on using the changeset viewer.