WordPress.org

Make WordPress Core

Changeset 51341


Ignore:
Timestamp:
07/06/2021 01:12:13 PM (3 months ago)
Author:
desrosj
Message:

Build/Test Tools: Use caching built into actions/setup-node.

This updates the actions/setup-node action to version 2.2.2 and takes advantage of the cache feature now built in. This removes the need for an additional step using actions/cache to cache NPM dependencies.

The cache key used will be ${{ runner.os }}-npm-${{ hashFiles('') }}, which matches the recommendation in the actions/cache documentation and the key currently in use in the WordPress workflows.

Props gziolo.
Fixes #53584.

Location:
trunk/.github/workflows
Files:
6 edited

Legend:

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

    r50930 r51341  
    103103  # - Logs debug information about the runner container.
    104104  # - Installs NodeJS 14.
    105   # - Sets up caching for NPM.
    106105  # - Logs updated debug information.
    107106  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
     
    127126
    128127      - name: Install NodeJS
    129         uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
     128        uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
    130129        with:
    131130          node-version: 14
    132 
    133       - name: Cache NodeJS modules
    134         uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
    135         env:
    136           cache-name: cache-node-modules
    137         with:
    138           # npm cache files are stored in `~/.npm` on Linux/macOS
    139           path: ~/.npm
    140           key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
     131          cache: npm
    141132
    142133      - name: Log debug information
  • trunk/.github/workflows/end-to-end-tests.yml

    r50930 r51341  
    3838  # - Logs debug information about the runner container.
    3939  # - Installs NodeJS 14.
    40   # - Sets up caching for NPM.
    4140  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
    4241  # - Builds WordPress to run from the `build` directory.
     
    7473
    7574      - name: Install NodeJS
    76         uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
     75        uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
    7776        with:
    7877          node-version: 14
    79 
    80       - name: Cache NodeJS modules
    81         uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
    82         env:
    83           cache-name: cache-node-modules
    84         with:
    85           # npm cache files are stored in `~/.npm` on Linux/macOS
    86           path: ~/.npm
    87           key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
     78          cache: npm
    8879
    8980      - name: Install Dependencies
  • trunk/.github/workflows/javascript-tests.yml

    r50930 r51341  
    4747  # - Logs debug information about the runner container.
    4848  # - Installs NodeJS 14.
    49   # - Sets up caching for NPM.
    5049  # - Logs updated debug information.
    5150  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
     
    6968
    7069      - name: Install NodeJS
    71         uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
     70        uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
    7271        with:
    7372          node-version: 14
    74 
    75       - name: Cache NodeJS modules
    76         uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
    77         env:
    78           cache-name: cache-node-modules
    79         with:
    80           # npm cache files are stored in `~/.npm` on Linux/macOS
    81           path: ~/.npm
    82           key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
     73          cache: npm
    8374
    8475      - name: Log debug information
  • trunk/.github/workflows/phpunit-tests.yml

    r50930 r51341  
    4444  # - Sets up the environment variables needed for testing with memcached (if desired).
    4545  # - Installs NodeJS 14.
    46   # - Sets up caching for NPM.
    4746  # - Installs NPM dependencies
    4847  # - Configures caching for Composer.
     
    115114
    116115      - name: Install NodeJS
    117         uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
     116        uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
    118117        with:
    119118          node-version: 14
    120 
    121       - name: Use cached Node modules
    122         uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
    123         env:
    124           cache-name: cache-node-modules
    125         with:
    126           # npm cache files are stored in `~/.npm` on Linux/macOS
    127           path: ~/.npm
    128           key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
     119          cache: npm
    129120
    130121      - name: Install Dependencies
  • trunk/.github/workflows/test-coverage.yml

    r50595 r51341  
    3535  # - Logs debug information about the runner container.
    3636  # - Installs NodeJS 14.
    37   # - Sets up caching for NPM.
    3837  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
    3938  # - Logs Docker debug information (about the Docker installation within the runner).
     
    8079
    8180      - name: Install NodeJS
    82         uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
     81        uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
    8382        with:
    8483          node-version: 14
    85 
    86       - name: Cache NodeJS modules
    87         uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
    88         env:
    89           cache-name: cache-node-modules
    90         with:
    91           # npm cache files are stored in `~/.npm` on Linux/macOS
    92           path: ~/.npm
    93           key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
     84          cache: npm
    9485
    9586      - name: Install Dependencies
  • trunk/.github/workflows/test-npm.yml

    r50930 r51341  
    4343  # - Logs debug information about the runner container.
    4444  # - Installs NodeJS 14.
    45   # - Sets up caching for NPM.
    4645  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
    4746  # - Builds WordPress to run from the `build` directory.
     
    7170
    7271      - name: Install NodeJS
    73         uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
     72        uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
    7473        with:
    7574          node-version: 14
    76 
    77       - name: Cache NodeJS modules (Ubuntu & MacOS)
    78         uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
    79         if: ${{ matrix.os != 'windows-latest' }}
    80         with:
    81           path: ~/.npm
    82           key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
    83 
    84       - name: Get NPM cache directory (Windows only)
    85         if: ${{ matrix.os == 'windows-latest' }}
    86         id: npm-cache
    87         run: echo "::set-output name=dir::$(npm config get cache)"
    88 
    89       - name: Cache NodeJS modules (Windows only)
    90         uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
    91         if: ${{ matrix.os == 'windows-latest' }}
    92         with:
    93           path: ${{ steps.npm-cache.outputs.dir }}
    94           key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
     75          cache: npm
    9576
    9677      - name: Install Dependencies
     
    11798  # - Logs debug information about the runner container.
    11899  # - Installs NodeJS 14.
    119   # - Sets up caching for NPM.
    120100  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
    121101  # - Builds WordPress to run from the `build` directory.
     
    140120
    141121      - name: Install NodeJS
    142         uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
     122        uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
    143123        with:
    144124          node-version: 14
    145 
    146       - name: Cache NodeJS modules
    147         uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
    148         if: ${{ matrix.os != 'windows-latest' }}
    149         with:
    150           path: ~/.npm
    151           key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
     125          cache: npm
    152126
    153127      - name: Install Dependencies
Note: See TracChangeset for help on using the changeset viewer.