ci: reduce cache pressure on non-Linux platform (#5213)

This commit is contained in:
LongYinan
2023-12-06 10:32:18 +00:00
parent 6cbf5b2a92
commit 1d9454118a

View File

@@ -70,24 +70,43 @@ runs:
id: yarn-cache id: yarn-cache
run: node -e "const p = $(yarn config cacheFolder --json).effective; console.log('yarn_global_cache=' + p)" >> $GITHUB_OUTPUT run: node -e "const p = $(yarn config cacheFolder --json).effective; console.log('yarn_global_cache=' + p)" >> $GITHUB_OUTPUT
- name: Cache non-full yarn cache - name: Cache non-full yarn cache on Linux
uses: actions/cache@v3 uses: actions/cache@v3
if: ${{ inputs.full-cache != 'true' }} if: ${{ inputs.full-cache != 'true' && runner.os == 'Linux' }}
with: with:
path: | path: |
node_modules node_modules
${{ steps.yarn-cache.outputs.yarn_global_cache }} ${{ steps.yarn-cache.outputs.yarn_global_cache }}
key: node_modules-cache-${{ github.job }}-${{ runner.os }} key: node_modules-cache-${{ github.job }}-${{ runner.os }}
- name: Cache full yarn cache # The network performance on macOS is very poor
# and the decompression performance on Windows is very terrible
# so we reduce the number of cached files on non-Linux systems by remove node_modules from cache path.
- name: Cache non-full yarn cache on non-Linux
uses: actions/cache@v3 uses: actions/cache@v3
if: ${{ inputs.full-cache == 'true' }} if: ${{ inputs.full-cache != 'true' && runner.os != 'Linux' }}
with:
path: |
${{ steps.yarn-cache.outputs.yarn_global_cache }}
key: node_modules-cache-${{ github.job }}-${{ runner.os }}
- name: Cache full yarn cache on Linux
uses: actions/cache@v3
if: ${{ inputs.full-cache == 'true' && runner.os == 'Linux' }}
with: with:
path: | path: |
node_modules node_modules
${{ steps.yarn-cache.outputs.yarn_global_cache }} ${{ steps.yarn-cache.outputs.yarn_global_cache }}
key: node_modules-cache-full-${{ runner.os }} key: node_modules-cache-full-${{ runner.os }}
- name: Cache full yarn cache on non-Linux
uses: actions/cache@v3
if: ${{ inputs.full-cache == 'true' && runner.os != 'Linux' }}
with:
path: |
${{ steps.yarn-cache.outputs.yarn_global_cache }}
key: node_modules-cache-full-${{ runner.os }}
- name: yarn install - name: yarn install
if: ${{ inputs.package-install == 'true' }} if: ${{ inputs.package-install == 'true' }}
continue-on-error: true continue-on-error: true